aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2018-12-09 19:34:47 -0500
committerDaniel Stenberg <daniel@haxx.se>2018-12-11 13:28:20 +0100
commit552f0205e6901889a965fe679f4afeeeed7f4955 (patch)
tree0305ae744e93fe9c84666fc4475d2581d28afc05 /lib/http.c
parentc8bf8cc1e4e8f6e8c29b104a2bcc47c626e18081 (diff)
downloadgnurl-552f0205e6901889a965fe679f4afeeeed7f4955.tar.gz
gnurl-552f0205e6901889a965fe679f4afeeeed7f4955.tar.bz2
gnurl-552f0205e6901889a965fe679f4afeeeed7f4955.zip
http: fix HTTP auth to include query in URI
- Include query in the path passed to generate HTTP auth. Recent changes to use the URL API internally (46e1640, 7.62.0) inadvertently broke authentication URIs by omitting the query. Fixes https://github.com/curl/curl/issues/3353 Closes #3356
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/http.c b/lib/http.c
index 7d50750a4..345100f6c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -702,7 +702,7 @@ output_auth_headers(struct connectdata *conn,
*
* @param conn all information about the current connection
* @param request pointer to the request keyword
- * @param path pointer to the requested path
+ * @param path pointer to the requested path; should include query part
* @param proxytunnel boolean if this is the request setting up a "proxy
* tunnel"
*
@@ -2000,9 +2000,18 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
}
/* setup the authentication headers */
- result = Curl_http_output_auth(conn, request, path, FALSE);
- if(result)
- return result;
+ {
+ char *pq = NULL;
+ if(query && *query) {
+ pq = aprintf("%s?%s", path, query);
+ if(!pq)
+ return CURLE_OUT_OF_MEMORY;
+ }
+ result = Curl_http_output_auth(conn, request, (pq ? pq : path), FALSE);
+ free(pq);
+ if(result)
+ return result;
+ }
if((data->state.authhost.multipass || data->state.authproxy.multipass) &&
(httpreq != HTTPREQ_GET) &&