Commit Graph

120 Commits

Author SHA1 Message Date
Steve Holme 4efa1d29e2 tool: Moved --trace and --verbose to the global config 2014-02-27 21:01:08 +00:00
Steve Holme 5577540ad5 tool: Moved --silient to the global config
Other global options such as --libcurl, --trace and --verbose to
follow.
2014-02-27 20:31:27 +00:00
Steve Holme 249dc83571 tool: Moved --showerror to the global config
Other global options such as --libcurl, --trace and --verbose to
follow.
2014-02-25 20:52:36 +00:00
Steve Holme 0704dd770d tool_getparam: Added global config to getparameter()
In preparation for parsing global options added the GlobalConfig
structure to the getparameter() function.
2014-02-25 19:38:17 +00:00
Steve Holme f35668985e tool_cfgable: Added support for knowing the current operation 2014-02-24 21:25:36 +00:00
Steve Holme c27cc68815 tool_operate: Moved easy handle cleanup into tool_main 2014-02-24 20:35:48 +00:00
Steve Holme 59b5ef444e tool_main: Moved easy handle into global config structure 2014-02-24 20:01:37 +00:00
Steve Holme 705a4cb549 tool_cfgable: Renamed Configurable structure to OperationConfig
To allow for the addition of a global config structure and prevent
confusion between the two.
2014-02-23 13:09:20 +00:00
Steve Holme 6512e93be1 tool: Fixed incorrect return code with --version from commit c10bf9bb36 2014-02-23 12:13:39 +00:00
Steve Holme 8c80840d01 tool_getparam: Moved tool_help() call into operate() 2014-02-23 11:16:05 +00:00
Steve Holme 24e22e1078 tool_getparam: Moved hugehelp() call into operate() 2014-02-23 11:12:03 +00:00
Steve Holme c10bf9bb36 tool_getparam: Moved tool_version_info() call into operate() 2014-02-23 11:10:01 +00:00
Steve Holme e6e8b14405 tool_cfgable: Removed list_engine flag from config structure
In preparation for separating the global config options from the per
operation config options, reworked the list engines code to not use a
member variable in the Configurable structure.
2014-02-22 21:00:03 +00:00
Steve Holme b914e7ed02 tool_operate: Start to use CURLcode rather than int for return codes
To help assist with the detection of incorrect return codes, as per
commits ee23d13a79, 33b8960dc8 and aba98991a5, updated the operate
based functions to return CURLcode error codes.
2014-02-22 18:57:02 +00:00
Steve Holme ee23d13a79 tool: Fixed incorrect return code when setting HTTP request fails
During initialisation SetHTTPrequest() may fail and cURL would return
PARAM_BAD_USE, which is equivalent to CURLE_NOT_BUILT_IN in cURL error
terms.

Instead, return CURLE_FAILED_INIT as we do for other functions that may
fail during initialisation.
2014-02-22 18:14:33 +00:00
Steve Holme 6969e24aee tool_operate: Moved list engines into separate function in tool_help 2014-02-22 16:47:59 +00:00
Steve Holme f3bae6ed73 tool_paramhlp: Added URL index to password prompt for multiple operations 2014-02-16 11:13:16 +00:00
Steve Holme 2de045ff7c tool_operate: Changed the required argument check/get to be upfront
Rather than check for required arguments, and prompt for any host and
proxy passwords, as each operation is performed, changed the code so
all configurations are checked before any operations are performed.

This allows the user to input all the required passwords, for example,
upfront rather than wait for each operation.
2014-02-15 18:59:12 +00:00
Steve Holme f80ca7a05a tool_operate: Moved required argument getting into separate function 2014-02-15 16:31:32 +00:00
Marc Hoersken 91c13d759a curl: output protocol headers using binary mode
Since protocol headers contain explicit line-endings there should
be no automatic conversion to ASCII text or CRLF line-endings.

This might break third party tools that already depend on this
behaviour. We might need to introduce an option to make this optional.
2014-02-14 20:12:28 +01:00
Steve Holme c8d1733d12 tool_cfgable: Moved easy handle cleanup to fix pingpong logout issues
Commmit c5f8e2f5f4 removed the easy handle clean-up from tool_operate,
letting the code that was already present in free_config_fields()
perform the task. Unfortunately, this wasn't the correct place to do
this as it broke protocols, that would perform a logout, as the main
clean-up in tool_main had already been called.
2014-02-10 22:23:52 +00:00
Fabian Frank 909a68c121 NPN/ALPN: allow disabling via command line
when using --http2 one can now selectively disable NPN or ALPN with
--no-alpn and --no-npn. for now honored with NSS only.

TODO: honor this option with GnuTLS and OpenSSL
2014-02-10 13:06:17 +01:00
Steve Holme 86a40f5d1a tool_operate: Move the trace and error file closure to tool_cfgable 2014-02-09 17:16:15 +00:00
Steve Holme 8cf63f88c2 tool_operate: Added support for performing URL specific operations 2014-02-09 11:03:57 +00:00
Steve Holme c5f8e2f5f4 tool_operate: Let curl handle cleanup take place in config_free() 2014-02-09 10:57:56 +00:00
Steve Holme d10065c05a tool_operate: Removed unused argument parameters from operate_do() 2014-02-06 20:52:12 +00:00
Steve Holme 456169f9e5 tool_operate: Moved list SSL engines code into operate() 2014-02-06 19:50:32 +00:00
Steve Holme dd97828df7 tool_operate: Moved argument parsing into operate() 2014-02-06 19:40:41 +00:00
Steve Holme f8abd56450 tool_operate: Moved .curlrc parsing code into operate() 2014-02-05 20:49:57 +00:00
Steve Holme 61ba1daba0 tool_operate: Moved locale setup code into operate_init() 2014-02-05 20:38:57 +00:00
Dan Fandrich ff0547e70e tool_operate: shortened too-long source line 2014-02-04 21:49:40 +01:00
Steve Holme 7d242658ac tool_operate: Introduced operate_free() function 2014-02-04 20:15:50 +00:00
Steve Holme dde3081085 tool_operate: Introduced operate_init() function 2014-02-04 20:14:39 +00:00
Steve Holme 2dc7ad23fd tool_operate: Introduced new operate() function 2014-02-04 20:07:35 +00:00
Steve Holme 6127e54f40 tool_operate: Moved libcurl information gathering to tool_main 2014-02-03 22:56:58 +00:00
Steve Holme c35d05aa62 tool_operate: Moved command line argument parsing into separate function 2014-02-03 18:38:14 +00:00
Steve Holme 8034b08e0e tool_operate: Simplified parse .curlrc decision logic 2014-02-03 16:16:17 +00:00
Steve Holme b811200f64 tool_operate: Moved main initialisation and cleanup code into tool_main 2014-02-03 12:31:16 +00:00
Steve Holme 0104678c79 tool_operate: Moved memory tracking initialisation into tool_main 2014-02-02 13:48:36 +00:00
Steve Holme 9ab0dc618f tool_operate: Moved initial config setup into new init_config() function 2014-02-02 10:18:21 +00:00
Steve Holme aba98991a5 tool: Fixed incorrect return code if command line parser runs out of memory
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().
2014-01-19 12:31:34 +00:00
Daniel Stenberg 169fedbdce login options: remove the ;[options] support from CURLOPT_USERPWD
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-12-14 22:40:37 +01:00
Dave Reisner d774802eec tool: use XFERFUNCTION to save some casts 2013-10-15 20:42:05 +02:00
Steve Holme c243d45aad curl: Fixed usage of DNS options when not using c-ares resolver
Commit 32352ed6ad 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-13 18:50:11 +01:00
Ben Greear 32352ed6ad curl: Add support for various DNS binding options.
(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-09-12 21:11:47 +02:00
Steve Holme d7a39f8f97 tool_operate.c: Fixed compilation warning
warning: implicit declaration of function 'checkpasswd'
2013-08-27 16:39:16 +01:00
Steve Holme 3c929ff9f6 curl: Moved check for password out of get parameter loop
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 e7dcc454c6.
2013-08-27 15:31:21 +01:00
Kyle L. Huff e7dcc454c6 curl: added basic SASL XOAUTH2 support
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-26 20:43:02 +01:00
Daniel Stenberg 6cf8413e31 curl_easy_perform_ev: debug/test function
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-20 11:56:06 +02:00
Daniel Stenberg 5ca96cb844 urlglob: better detect unclosed braces, empty lists and overflows
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-08-16 11:52:08 +02:00