Commit Graph

50 Commits

Author SHA1 Message Date
Kamil Dudka 487406c3c0 tool_operate: fix misplaced initialization of orig_noprogress
... and orig_isatty which caused --silent to be entirely ignored in case
the standard output was redirected to a file!
2012-07-22 02:06:22 +02:00
Tatsuhiro Tsujikawa bf4580d5fd Metalink: message updates
Print "parsing (...) OK" only when no warnings are generated.  If
no file is found in Metalink, treat it FAILED.

If no digest is provided, print WARNING in parse_metalink().
Also print validating FAILED after download.

These changes make tests 2012 to 2016 pass.
2012-06-28 00:26:16 +02:00
Tatsuhiro Tsujikawa 3e6dfe138a Metalink: updated message format 2012-06-27 13:15:59 +02:00
Tatsuhiro Tsujikawa 7f59577fdd Metalink: ignore --include if --metalink is used.
Including headers in response body will break Metalink XML parser.
If it is included in the file described in Metalink XML, hash check
will fail. Therefore, --include should be ignored if --metalink is
used.
2012-06-22 18:58:30 +02:00
Tatsuhiro Tsujikawa aefb9196cf curl: Prefixed all Metalink related messages with "Metalink: " 2012-06-21 17:34:54 +02:00
Tatsuhiro Tsujikawa 7561a0fc83 curl: Restore noprogress and isatty config values.
The noprogress and isatty in Configurable are global, in a sense
that they persist in one curl invocation. Currently once one
download writes its response data to tty, they are set to FALSE
and they are not restored on successive downloads.  This change
first backups the current noprogress and isatty, and restores
them when download does not write its data to tty.
2012-06-21 03:35:52 +02:00
Tatsuhiro Tsujikawa 196c8242ca curl: Made --metalink option toggle Metalink functionality
In this change, --metalink option no longer takes argument.  If
it is specified, given URIs are processed as Metalink XML file.
If given URIs are remote (e.g., http URI), curl downloads it
first. Regardless URI is local file (e.g., file URI scheme) or
remote, Metalink XML file is not written to local file system and
the received data is fed into Metalink XML parser directly.  This
means with --metalink option, filename related options like -O
and -o are ignored.

Usage examples:

$ curl --metalink http://example.org/foo.metalink

This will download foo.metalink and parse it and then download
the URI described there.

$ curl --metalink file://foo.metalink

This will parse local file foo.metalink and then download the URI
described there.
2012-06-21 03:35:23 +02:00
Yang Tse a884ffe430 Fixes allowing 26 more test cases in 1334 to 1393 range to succeed 2012-06-09 05:49:49 +02:00
Yang Tse eeeba1496c metalink: build fixes and adjustments II
Additionally, make hash checking ability mandatory in order to allow metalink
support in curl.

A command line option could be introduced to skip hash checking at runtime,
but the ability to check hashes should always be built-in when providing
metalink support.
2012-06-08 14:27:45 +02:00
Yang Tse 04ca9aecd1 metalink: build fixes and adjustments I 2012-06-07 23:50:12 +02:00
Yang Tse 7352ac408b Fixes allowing HTTP test cases 1338, 1339, 1368 and 1369 to succeed 2012-06-07 21:57:53 +02:00
Tatsuhiro Tsujikawa 1bfd750f3f Reduced #ifdef HAVE_METALINK 2012-05-26 23:12:09 +02:00
Tatsuhiro Tsujikawa 7bdb9fba95 Disable hash check if neither OpenSSL nor GNUTLS is installed. 2012-05-26 23:12:02 +02:00
Tatsuhiro Tsujikawa 6a655ca192 Minimize usage of structs from libmetalink 2012-05-26 23:11:52 +02:00
Tatsuhiro Tsujikawa 9f7f7925da Check checksum of downloaded file if checksum is available
Metalink file contains several hash types of checksums, such as
md5, sha-1, sha-256, etc. To deal with these checksums, I created
abstraction layer based on lib/curl_md5.h and
lib/md5.c. Basically, they are almost the same but I changed the
code so that it is not hash type dependent. Currently,
GNUTLS(nettle or gcrypt) and OpenSSL functions are supported.

Checksum checking is done by reopening download file.  If there
is an I/O error, the current implementation just prints error
message and does not try next resource.

In this patch, the supported hash types are: md5, sha-1 and sha-256.
2012-05-26 23:11:46 +02:00
Tatsuhiro Tsujikawa c3ef63f167 Always create directory hierarchy for Metalink.
Filenames contained in Metalink file can include directory information.
Filenames are unique in Metalink file, taking into account the directory
information. So we need to create the directory hierarchy.

Curl has --create-dirs option, but we create directory hierarchy for
Metalink downloads regardless of the option value.

This patch also put metalink int variable outside of HAVE_LIBMETALINK
guard. This reduces the number of #ifdefs.
2012-05-26 23:11:40 +02:00
Tatsuhiro Tsujikawa 383641d70a Support media-type parameter in Content-Type 2012-05-26 23:11:06 +02:00
Tatsuhiro Tsujikawa 53f2c02ac7 metalink: parse downloaded Metalink file
Parse downloaded Metalink file and add downloads described there. Fixed
compile error without metalink support.
2012-05-26 23:09:37 +02:00
Tatsuhiro Tsujikawa 9f9f9ed1b2 metalink: minor metalinkfile fix
Don't update config->metalinkfile_last in operate(). Use local variable
to point to the current metalinkfile.
2012-05-26 23:08:56 +02:00
Tatsuhiro Tsujikawa a0d7a26e32 metalink: show help message even if disabled
Print message if --metalink is used while metalink support is not
enabled. Migrated Metalink support in tool_operate.c and removed
operatemetalink().
2012-05-26 23:08:13 +02:00
Tatsuhiro Tsujikawa b5fdbe848b Support Metalink.
This change adds experimental Metalink support to curl.
To enable Metalink support, run configure with --with-libmetalink.
To feed Metalink file to curl, use --metalink option like this:

  $ curl -O --metalink foo.metalink

We use libmetalink to parse Metalink files.
2012-05-26 23:07:42 +02:00
Tatsuhiro Tsujikawa b061fed981 Made -D option work with -O and -J.
To achieve this, first new structure HeaderData is defined to hold
necessary data to perform header-related work.  Then tool_header_cb now
receives HeaderData pointer as userdata.  All header-related work
(currently, dumping header and Content-Disposition inspection) are done
in this callback function.  HeaderData.outs->config is used to determine
whether each work is done.

Unit tests were also updated because after this change, curl code always
sets CURLOPT_HEADERFUNCTION and CURLOPT_HEADERDATA.

Tested with -O -J -D, -O -J -i and -O -J -D -i and all worked fine.
2012-05-25 23:06:08 +02:00
Yang Tse 94111bbbd4 Take in account that CURLAUTH_* bitmasks are now 'unsigned long' - follow-up
MIPSPro compiler detected curl_easy_getinfo() related missing adjustments.
SunPro compiler detected curl tool --libcurl option related missing adjustments.
2012-04-19 16:31:11 +02:00
Yang Tse 9421b06397 Take in account that CURLAUTH_* bitmasks are now 'unsigned long'
Data type of internal vars holding CURLAUTH_* bitmasks changed from 'long' to
'unsigned long' for proper handling and operating.
2012-04-18 23:04:35 +02:00
Yang Tse ce8a321dd0 Some explicit conversion to 'long' of curl_easy_setopt() third argument
Explicit conversion to 'long' of curl_easy_setopt() third argument for options
CURLOPT_HTTPAUTH and CURLOPT_PROXYAUTH given that this is how its bitmasks are
docummented to be used.
2012-04-18 21:03:20 +02:00
Yang Tse 5f04843e5b tool_operate.c: fix compiler warning 2012-04-12 21:21:09 +02:00
Yang Tse 01b0f1061d curl tool: make curl.h first header included in tool_setup.h 2012-04-08 13:50:18 +02:00
Yang Tse 919c97fa65 curl tool: use configuration files from lib directory
Configuration files such as curl_config.h and all config-*.h no longer exist
nor are generated/copied into 'src' directory, now these only exist in 'lib'
directory from where curl tool sources uses them.

Additionally old src/setup.h has been refactored into src/tool_setup.h which
now pulls lib/setup.h

The possibility of a makefile needing an include path adjustment exists.
2012-04-06 23:37:05 +02:00
Daniel Stenberg 29e68b200c curl: add --post303 to set the CURL_REDIR_POST_303 option 2012-04-05 23:34:12 +02:00
Dave Reisner ddfe821bcf curl tool: add filename_effective token for --write-out
By modifying the parameter list for ourWriteOut() and passing the
OutStruct that collects data in tool_operate, we get access to the
remote name that we're writing to. Shell scripters should find this
useful when used in conjuntion with the --remote-header-name option.
2012-04-01 23:52:05 +02:00
Colin Hogben 9954242980 Generate lists and use symbols in --libcurl code output.
This patch improves the output of curl's --libcurl option by
generating code which builds curl_httppost and curl_slist lists, and
uses symbolic names for enum and flag values.  Variants of the
my_setopt macro in tool_setopt.h are added in order to pass extra type
information to the code-generation step in tool_setopt.c.

If curl is configured with --disable-libcurl-option then the macros
call curl_easy_setopt directly.
2012-02-23 22:32:57 +01:00
Steve Holme a053560cfa curl: Added support for --mail-auth
Added an extra command-line argument to support the optional AUTH
parameter in SMTPs MAIL FROM command.
2012-02-16 13:19:47 +01:00
Colin Hogben 2b26eb9857 configure: add option disable --libcurl output 2012-02-13 22:36:10 +01:00
Daniel Stenberg 62d15f159e --ssl-allow-beast added
This new option tells curl to not work around a security flaw in the
SSL3 and TLS1.0 protocols. It uses the new libcurl option
CURLOPT_SSL_OPTIONS with the CURLSSLOPT_ALLOW_BEAST bit set.
2012-02-09 22:28:58 +01:00
Dave Reisner 2a266c1c7c curl: use new library-side TCP_KEEPALIVE options
Use the new library CURLOPT_TCP_KEEPALIVE rather than disabling this via
the sockopt callback. If --keepalive-time is used, apply the value to
CURLOPT_TCP_KEEPIDLE and CURLOPT_TCP_KEEPINTVL.
2012-02-09 19:05:40 +01:00
Yang Tse 4405039fdc curl tool: allow glob-loops to abort again upon critical errors
This prevents clobbering of non recoverable error return codes while
retaining intended functionality of commit 65103efe
2012-02-07 22:10:01 +01:00
Daniel Stenberg 65103efe49 curl tool: don't abort glob-loop due to failures
We want to continue to the next URL to try even on failures returned
from libcurl. This makes -f with ranges still get subsequent URLs even
if occasional ones return error. This was a regression as it used to
work and broke in the 7.23.0 release.

Added test case 1328 to verify the fix.

Bug: http://curl.haxx.se/bug/view.cgi?id=3481223
Reported by: Juan Barreto
2012-02-06 16:52:17 +01:00
Colin Hogben 51c485342b Remove bogus optimisation of telnet upload.
Remove wrongly implemented optimisation of telnet upload, apparently
intended to allow the library to avoid manually polling for input.
2012-01-18 22:17:46 +01:00
Daniel Stenberg b0eb963bc7 operate: removed a single trailing space 2011-12-21 21:17:34 +01:00
Dan Fandrich 2cf9e78a22 --retry: Retry transfers on timeout and DNS errors 2011-12-21 11:09:09 -08:00
Daniel Stenberg c532604b13 -J -O: use -O name if no Content-Disposition header comes!
A regression between 7.22.0 and 7.23.0 -- downloading a file with the
flags -O and -J results in the content being written to stdout if and
only if there was no Content-Disposition header in the http response. If
there is a C-D header with a filename attribute, the output is correctly
written.

Reported by: Dave Reisner
Bug: http://curl.haxx.se/mail/archive-2011-11/0030.html
2011-11-20 23:35:49 +01:00
Yang Tse cc76bbe79b tool_operate.c: OOM handling fix
Move curl_easy_perform source code geneartion out of curl_easy_perform's loop
for proper OOM handling and source code geneartion.
2011-10-22 14:49:02 +02:00
Daniel Stenberg b229c8ca8b --show-error: position indepdenent
Previously we required that -S/--show-error was used _after_
-s/--silent. This was slightly confusing since we strive to make
arguments as position independent as possible.

Now, you can use them in any order and the result should still be the
same.

Bug: http://curl.haxx.se/bug/view.cgi?id=3424286
Reported by: Andreas Olsson
2011-10-16 23:39:59 +02:00
Yang Tse 17f48fe879 libcurl: some OOM handling fixes 2011-10-07 20:50:57 +02:00
Yang Tse f7bfdbabf2 curl tool: reviewed code moved to tool_*.[ch] files 2011-10-06 17:39:00 +02:00
Yang Tse 7296b2aa25 curl tool: OOM handling fixes 2011-10-05 22:01:42 +02:00
Yang Tse 6c849321d7 curl tool: reviewed code moved to tool_*.[ch] files 2011-10-05 20:16:16 +02:00
Yang Tse 5bf0d74120 curl tool: OOM handling fixes 2011-10-05 15:06:26 +02:00
Yang Tse aa7d5b946a curl tool: header inclusion adjustment 2011-10-05 01:19:58 +02:00
Yang Tse 49b79b7631 curl tool: code moved to tool_*.[ch] files 2011-10-05 00:03:58 +02:00