diff options
author | Daniel Stenberg <daniel@haxx.se> | 2017-06-21 23:35:08 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2017-06-21 23:39:10 +0200 |
commit | 9b167fd090f596eac828817d48c247eeae53407f (patch) | |
tree | d89ba04374722be9ca36d633a82e07616abbe0f6 /src | |
parent | 8de8f4eb7e7c276eb2b2a2f7888c88d0779bed39 (diff) |
--request-target: instead of --strip-path-slash
... and CURLOPT_REQUEST_TARGET instead of CURLOPT_STRIP_PATH_SLASH.
This option instead provides the full "alternative" target to use in the
request, instead of extracting the path from the URL.
Test 1298 and 1299 updated accordingly.
Idea-by: Evert Pot
Suggestion: https://daniel.haxx.se/blog/2017/06/19/options-with-curl/comment-page-1/#comment-18373
Closes #1593
Diffstat (limited to 'src')
-rw-r--r-- | src/tool_cfgable.c | 4 | ||||
-rw-r--r-- | src/tool_cfgable.h | 2 | ||||
-rw-r--r-- | src/tool_getparam.c | 6 | ||||
-rw-r--r-- | src/tool_help.c | 12 | ||||
-rw-r--r-- | src/tool_operate.c | 3 |
5 files changed, 13 insertions, 14 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index f00a0d1e7..675e88b45 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -123,7 +123,7 @@ static void free_config_fields(struct OperationConfig *config) Curl_safefree(config->pubkey); Curl_safefree(config->hostpubmd5); Curl_safefree(config->engine); - + Curl_safefree(config->request_target); Curl_safefree(config->customrequest); Curl_safefree(config->krblevel); diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index f6536e8e4..8b6e0cfa7 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -139,12 +139,12 @@ struct OperationConfig { bool crlf; char *customrequest; char *krblevel; + char *request_target; long httpversion; bool nobuffer; bool readbusy; /* set when reading input returns EAGAIN */ bool globoff; bool use_httpget; - bool strip_path_slash; bool insecure_ok; /* set TRUE to allow insecure SSL connects */ bool proxy_insecure_ok; /* set TRUE to allow insecure SSL connects for proxy */ diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 642bba832..6cb394139 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -257,7 +257,7 @@ static const struct LongShort aliases[]= { {"Fs", "form-string", ARG_STRING}, {"g", "globoff", ARG_BOOL}, {"G", "get", ARG_NONE}, - {"Ga", "strip-path-slash", ARG_BOOL}, + {"Ga", "request-target", ARG_STRING}, {"h", "help", ARG_BOOL}, {"H", "header", ARG_STRING}, {"Hp", "proxy-header", ARG_STRING}, @@ -1592,8 +1592,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */ break; case 'G': /* HTTP GET */ - if(subletter == 'a') { /* --strip-path-slash */ - config->strip_path_slash = TRUE; + if(subletter == 'a') { /* --request-target */ + GetStr(&config->request_target, nextarg); } else config->use_httpget = TRUE; diff --git a/src/tool_help.c b/src/tool_help.c index 6d36e550f..2acc994d5 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -160,8 +160,8 @@ static const struct helptxt helptext[] = { "Disable URL sequences and ranges using {} and []"}, {"-I, --head", "Show document info only"}, - {"-H, --header <header>", - "Pass custom header LINE to server"}, + {"-H, --header <header/@file>", + "Pass custom header(s) to server"}, {"-h, --help", "This help text"}, {" --hostpubmd5 <md5>", @@ -298,8 +298,8 @@ static const struct helptxt helptext[] = { "Set a CRL list for proxy"}, {" --proxy-digest", "Use Digest authentication on the proxy"}, - {" --proxy-header <header>", - "Pass custom header LINE to proxy"}, + {" --proxy-header <header/@file>", + "Pass custom header(s) to proxy"}, {" --proxy-insecure", "Do HTTPS proxy connections without verifying the proxy"}, {" --proxy-key <key>", @@ -352,6 +352,8 @@ static const struct helptxt helptext[] = { "Set the remote file's time on the local output"}, {"-X, --request <command>", "Specify request command to use"}, + {" --request-target", + "Specify the target for this request"}, {" --resolve <host:port:address>", "Resolve the host+port to this address"}, {" --retry <num>", @@ -400,8 +402,6 @@ static const struct helptxt helptext[] = { "Use SSLv3"}, {" --stderr", "Where to redirect stderr"}, - {" --strip-path-slash", - "Strip off the first slash of the path"}, {" --suppress-connect-headers", "Suppress proxy CONNECT response headers"}, {" --tcp-fastopen", diff --git a/src/tool_operate.c b/src/tool_operate.c index 51a9aa9f6..147081438 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -972,8 +972,7 @@ static CURLcode operate_do(struct GlobalConfig *global, #endif /* !CURL_DISABLE_PROXY */ my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror?1L:0L); - my_setopt(curl, CURLOPT_STRIP_PATH_SLASH, - config->strip_path_slash?1L:0L); + my_setopt(curl, CURLOPT_REQUEST_TARGET, config->request_target); my_setopt(curl, CURLOPT_UPLOAD, uploadfile?1L:0L); my_setopt(curl, CURLOPT_DIRLISTONLY, config->dirlistonly?1L:0L); my_setopt(curl, CURLOPT_APPEND, config->ftp_append?1L:0L); |