From 9b167fd090f596eac828817d48c247eeae53407f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 21 Jun 2017 23:35:08 +0200 Subject: --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 --- lib/http.c | 4 ++-- lib/url.c | 6 +++--- lib/urldata.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/http.c b/lib/http.c index 2d04705ba..b8f4c8a21 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2269,8 +2269,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done) if(result) return result; - if(data->set.strip_path_slash) - ppath++; + if(data->set.str[STRING_TARGET]) + ppath = data->set.str[STRING_TARGET]; /* url */ if(paste_ftp_userpwd) diff --git a/lib/url.c b/lib/url.c index 23b243f83..3b3143ab8 100644 --- a/lib/url.c +++ b/lib/url.c @@ -829,9 +829,9 @@ CURLcode Curl_setopt(struct Curl_easy *data, CURLoption option, then this can be changed to HEAD later on) */ data->set.httpreq = HTTPREQ_GET; break; - case CURLOPT_STRIP_PATH_SLASH: - arg = va_arg(param, long); - data->set.strip_path_slash = (bool)arg; + case CURLOPT_REQUEST_TARGET: + result = setstropt(&data->set.str[STRING_TARGET], + va_arg(param, char *)); break; case CURLOPT_FILETIME: /* diff --git a/lib/urldata.h b/lib/urldata.h index 9310abc17..8c4a029fe 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1588,7 +1588,7 @@ enum dupstring { #ifdef USE_UNIX_SOCKETS STRING_UNIX_SOCKET_PATH, /* path to Unix socket, if used */ #endif - + STRING_TARGET, /* CURLOPT_REQUEST_TARGET */ /* -- end of zero-terminated strings -- */ STRING_LASTZEROTERMINATED, -- cgit v1.2.3