aboutsummaryrefslogtreecommitdiff
path: root/src/tool_operate.c
AgeCommit message (Collapse)Author
2014-01-19tool: Fixed incorrect return code if command line parser runs out of memorySteve Holme
In the rare instance where getparameter() may return PARAM_NO_MEM whilst parsing a URL, cURL would return this error code, which is equivalent to CURLE_FTP_ACCEPT_FAILED in cURL error codes terms. Instead, return CURLE_FAILED_INIT and output the failure reason as per the other usage of getparameter().
2013-12-14login options: remove the ;[options] support from CURLOPT_USERPWDDaniel Stenberg
To avoid the regression when users pass in passwords containing semi- colons, we now drop the ability to set the login options with the same options. Support for login options in CURLOPT_USERPWD was added in 7.31.0. Test case 83 was modified to verify that colons and semi-colons can be used as part of the password when using -u (CURLOPT_USERPWD). Bug: http://curl.haxx.se/bug/view.cgi?id=1311 Reported-by: Petr Bahula Assisted-by: Steve Holme Signed-off-by: Daniel Stenberg <daniel@haxx.se>
2013-10-15tool: use XFERFUNCTION to save some castsDave Reisner
2013-09-13curl: Fixed usage of DNS options when not using c-ares resolverSteve Holme
Commit 32352ed6adddcb introduced various DNS options, however, these would cause curl to exit with CURLE_NOT_BUILT_IN when c-ares wasn't being used as the backend resolver even if the options weren't set by the user. Additionally corrected some minor coding style errors from the same commit.
2013-09-12curl: Add support for various DNS binding options.Ben Greear
(Passed on to c-ares.) Allows something like this: curl --dns-interface sta8 --dns-ipv4-addr 8.8.1.111 --interface sta8 \ --localaddr 8.8.1.111 --dns-servers 8.8.8.1 www.google.com Signed-off-by: Ben Greear <greearb@candelatech.com>
2013-08-27tool_operate.c: Fixed compilation warningSteve Holme
warning: implicit declaration of function 'checkpasswd'
2013-08-27curl: Moved check for password out of get parameter loopSteve Holme
Moved the calls to checkpasswd() out of the getparameter() function which allows for any related arguments to be specified on the command line before or after --user (and --proxy-user). For example: --bearer doesn't need to be specified before --user to prevent curl from asking for an unnecessary password as is the case with commit e7dcc454c67a2f.
2013-08-26curl: added basic SASL XOAUTH2 supportKyle L. Huff
Added the ability to specify an XOAUTH2 bearer token [RFC6750] via the --bearer option. Example usage: curl --url "imaps://imap.gmail.com:993/INBOX/;UID=1" --ssl-reqd --bearer ya29.AHES6Z...OMfsHYI --user username@example.com
2013-08-20curl_easy_perform_ev: debug/test functionDaniel Stenberg
This function is meant to work *exactly* as curl_easy_perform() but will use the event-based libcurl API internally instead of curl_multi_perform(). To avoid relying on an actual event-based library and to not use non-portable functions (like epoll or similar), there's a rather inefficient emulation layer implemented on top of Curl_poll() instead. There's currently some convenience logging done in curl_easy_perform_ev which helps when tracking down problems. They may be suitable to remove or change once things seem to be fine enough. curl has a new --test-event option when built with debug enabled that then uses curl_easy_perform_ev() instead of curl_easy_perform(). If built without debug, using --test-event will only output a warning message. NOTE: curl_easy_perform_ev() is not part if the public API on purpose. It is only present in debug builds of libcurl and MUST NOT be considered stable even then. Use it for libcurl-testing purposes only. runtests.pl now features an -e command line option that makes it use --test-event for all curl command line tests. The man page is updated.
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().