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
This commit is contained in:
Jay Satiro 2018-12-09 19:34:47 -05:00 committed by Daniel Stenberg
parent c8bf8cc1e4
commit 552f0205e6
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 89 additions and 5 deletions

View file

@ -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) &&