aboutsummaryrefslogtreecommitdiff
path: root/src/tool_operate.c
AgeCommit message (Collapse)Author
2013-08-16urlglob: better detect unclosed braces, empty lists and overflowsDaniel Stenberg
A rather big overhaul and cleanup. 1 - curl wouldn't properly detect and reject globbing that ended with an open brace if there were brackets or braces before it. Like "{}{" or "[0-1]{" 2 - curl wouldn't properly reject empty lists so that "{}{}" would result in curl getting (nil) strings in the output. 3 - By using strtoul() instead of sscanf() the code will now detected over and underflows. It now also better parses the step argument to only accept positive numbers and only step counters that is smaller than the delta between the maximum and minimum numbers. 4 - By switching to unsigned longs instead of signed ints for the counters, the max values for []-ranges are now very large (on 64bit machines). 5 - Bumped the maximum number of globs in a single URL to 100 (from 10) 6 - Simplified the code somewhat and now it stores fixed strings as single- entry lists. That's also one of the reasons why I did (5) as now all strings between "globs" will take a slot in the array. Added test 1234 and 1235 to verify. Updated test 87. This commit fixes three separate bug reports. Bug: http://curl.haxx.se/bug/view.cgi?id=1264 Bug: http://curl.haxx.se/bug/view.cgi?id=1265 Bug: http://curl.haxx.se/bug/view.cgi?id=1266 Reported-by: Will Dietz
2013-07-29tool_operate.c: fix brace placement for vi/emacs delimiter matchingYang Tse
2013-07-29tool_operate.c: move <fabdef.h> header inclusion locationYang Tse
2013-07-22curl: fix upload of a zip file in OpenVMSJohn E. Malmberg
Two fixes: 1. Force output file format to be stream-lf so that partial downloads can be continued. This should have minor impact as if the file does not exist, it was created with stream-lf format. The only time this was an issue is if there was already an existing file with a different format. 2. Fix file uploads are now fixed. a. VMS binary files such as ZIP archives are now uploaded correctly. b. VMS text files are read once to get the correct size and then converted to line-feed terminated records as they are read into curl. The default VMS text formats do not contain either line-feed or carriage-return terminated records. Those delimiters are added by the operating system file read calls if the application requests them. Bug: http://curl.haxx.se/bug/view.cgi?id=496
2013-07-22curl: fix symbolic names for CURL_NETRC_* enum in --libcurl outputYang Tse
2013-07-22curl: fix symbolic names for CURLUSESSL_* enum in --libcurl outputYang Tse
2013-07-22tool_operate.c: fix passing curl_easy_setopt long arg on some x64 ABIsYang Tse
We no longer pass our 'bool' data type variables nor constants as an argument to my_setopt(), instead we use proper 1L or 0L values. This also fixes macro used to pass string argument for CURLOPT_SSLCERT, CURLOPT_SSLKEY and CURLOPT_EGDSOCKET using my_setopt_str() instead of my_setopt(). This also casts enum or int argument data types to long when passed to my_setopt_enum().
2013-07-14src/tool: allow timeouts to accept decimal valuesDave Reisner
Implement wrappers around strtod to convert the user argument to a double with sane error checking. Use this to allow --max-time and --connect-timeout to accept decimal values instead of strictly integers. The manpage is updated to make mention of this feature and, additionally, forewarn that the actual timeout of the operation can vary in its precision (particularly as the value increases in its decimal precision).
2013-04-27Corrected version numbers after bumpSteve Holme
2013-04-27sasl-ir: Added --sasl-ir option to curl command line toolSteve Holme
2013-03-07checksrc: ban unsafe functionsDaniel Stenberg
The list of unsafe functions currently consists of sprintf, vsprintf, strcat, strncat and gets. Subsequently, some existing code needed updating to avoid warnings on this.
2013-02-19metalink: fix improbable crash parsing metalink filenameNick Zitzmann
The this_url pointer wasn't being initialized, so if strdup() would return null when copying the filename in a metalink file, then hilarity would ensue during the cleanup phase. This change was brought to you by clang, which noticed this and raised a warning.
2013-02-06vms_show: post VMS patch cleanup - IIYang Tse
- remove multiple declarations of vms_show and add comments
2013-02-05VMS: fix and generate the VMS build configJohn E. Malmberg
config_h.com is a new file that generates a config.h file based on the curl_config.h.in file and a quick scan of the configure script. This is actually a generic procedure that is shared with other VMS packages. The existing pre-built config-vms.h had over 100 entries that were not correct and in some cases conflicted with the build options available in the build_vms.com. generate_config_vms_h_curl.com is a helper procedure to the config_h.com. It covers the cases that the generic config_h.com is not able to figure out, and accepts input from the build_vms.com procedure. build_curlbuild_h.com is a new file to generate the curlbuild.h file that Curl is now using when it is using a curl_config.h file. post-config-vms.h is a new file that is needed to provide VMS specific definitions, and most of them need to be set before the system header files are included. The VMS build procedure is fixed: 1. Fixed to link in the correct HP ssl library. 2. Fixed to detect if HP Kerberos is installed. 3. Fixed to detect if HP LDAP is installed. 4. Fixed to detect if gnv$libzshr is installed. 5. Simplified the input parameter parsing to not use a loop. 6. Warn that 64 bit pointer option support is not complete in comments. 7. Default to IEEE floating if platform supports it so resulting libcurl will be compatible with other open source projects on VMS. 8. Default to LARGEFILE if platform supports it. 9. Default to enable SSL, LDAP, Kerberos, libz if the libraries are present. 10. Build with exact case global symbols for libcurl. 11. Generate linker option file needed. 12. Compiler list option only commonly needed items. 13. fulllist option for those who really want it. 14. Create debug symbol file on Alpha, IA64.
2013-01-06Revert changes relative to lib/*.[ch] recent renamingYang Tse
This reverts renaming and usage of lib/*.h header files done 28-12-2012, reverting 2 commits: f871de0... build: make use of 76 lib/*.h renamed files ffd8e12... build: rename 76 lib/*.h files This also reverts removal of redundant include guard (redundant thanks to changes in above commits) done 2-12-2013, reverting 1 commit: c087374... curl_setup.h: remove redundant include guard This also reverts renaming and usage of lib/*.c source files done 3-12-2013, reverting 3 commits: 13606bb... build: make use of 93 lib/*.c renamed files 5b6e792... build: rename 93 lib/*.c files 7d83dff... build: commit 13606bbfde follow-up 1 Start of related discussion thread: http://curl.haxx.se/mail/lib-2013-01/0012.html Asking for confirmation on pushing this revertion commit: http://curl.haxx.se/mail/lib-2013-01/0048.html Confirmation summary: http://curl.haxx.se/mail/lib-2013-01/0079.html NOTICE: The list of 2 files that have been modified by other intermixed commits, while renamed, and also by at least one of the 6 commits this one reverts follows below. These 2 files will exhibit a hole in history unless git's '--follow' option is used when viewing logs. lib/curl_imap.h lib/curl_smtp.h
2013-01-03build: make use of 93 lib/*.c renamed filesYang Tse
93 *.c source files renamed to use our standard naming scheme. This change affects 77 files in libcurl's source tree.
2012-12-28build: make use of 76 lib/*.h renamed filesYang Tse
76 private header files renamed to use our standard naming scheme. This change affects 322 files in libcurl's source tree.
2012-12-14setup_once.h: refactor inclusion of <unistd.h> and <sys/socket.h>Yang Tse
Inclusion of top two most included header files now done in setup_once.h
2012-11-06curl: set CURLOPT_SSL_VERIFYHOST to 0 to disableDaniel Stenberg
2012-08-06operate: fix clang-analyzer warnings for never read variablesDaniel Stenberg
Two separate "Value stored to 'XXX' is never read" warnings
2012-08-06operate: fix clang-analyzer warningDaniel Stenberg
Value stored to 'separator' is never read
2012-07-22tool_operate: fix misplaced initialization of orig_noprogressKamil Dudka
... and orig_isatty which caused --silent to be entirely ignored in case the standard output was redirected to a file!
2012-06-28Metalink: message updatesTatsuhiro Tsujikawa
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-27Metalink: updated message formatTatsuhiro Tsujikawa
2012-06-22Metalink: ignore --include if --metalink is used.Tatsuhiro Tsujikawa
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-21curl: Prefixed all Metalink related messages with "Metalink: "Tatsuhiro Tsujikawa
2012-06-21curl: Restore noprogress and isatty config values.Tatsuhiro Tsujikawa
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-21curl: Made --metalink option toggle Metalink functionalityTatsuhiro Tsujikawa
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-09Fixes allowing 26 more test cases in 1334 to 1393 range to succeedYang Tse
2012-06-08metalink: build fixes and adjustments IIYang Tse
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-07metalink: build fixes and adjustments IYang Tse
2012-06-07Fixes allowing HTTP test cases 1338, 1339, 1368 and 1369 to succeedYang Tse
2012-05-26Reduced #ifdef HAVE_METALINKTatsuhiro Tsujikawa
2012-05-26Disable hash check if neither OpenSSL nor GNUTLS is installed.Tatsuhiro Tsujikawa
2012-05-26Minimize usage of structs from libmetalinkTatsuhiro Tsujikawa
2012-05-26Check checksum of downloaded file if checksum is availableTatsuhiro Tsujikawa
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-26Always create directory hierarchy for Metalink.Tatsuhiro Tsujikawa
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-26Support media-type parameter in Content-TypeTatsuhiro Tsujikawa
2012-05-26metalink: parse downloaded Metalink fileTatsuhiro Tsujikawa
Parse downloaded Metalink file and add downloads described there. Fixed compile error without metalink support.
2012-05-26metalink: minor metalinkfile fixTatsuhiro Tsujikawa
Don't update config->metalinkfile_last in operate(). Use local variable to point to the current metalinkfile.
2012-05-26metalink: show help message even if disabledTatsuhiro Tsujikawa
Print message if --metalink is used while metalink support is not enabled. Migrated Metalink support in tool_operate.c and removed operatemetalink().
2012-05-26Support Metalink.Tatsuhiro Tsujikawa
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-25Made -D option work with -O and -J.Tatsuhiro Tsujikawa
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-04-19Take in account that CURLAUTH_* bitmasks are now 'unsigned long' - follow-upYang Tse
MIPSPro compiler detected curl_easy_getinfo() related missing adjustments. SunPro compiler detected curl tool --libcurl option related missing adjustments.
2012-04-18Take in account that CURLAUTH_* bitmasks are now 'unsigned long'Yang Tse
Data type of internal vars holding CURLAUTH_* bitmasks changed from 'long' to 'unsigned long' for proper handling and operating.
2012-04-18Some explicit conversion to 'long' of curl_easy_setopt() third argumentYang Tse
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-12tool_operate.c: fix compiler warningYang Tse
2012-04-08curl tool: make curl.h first header included in tool_setup.hYang Tse
2012-04-06curl tool: use configuration files from lib directoryYang Tse
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-05curl: add --post303 to set the CURL_REDIR_POST_303 optionDaniel Stenberg