mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
CONNECT: send correct Host: with IPv6 numerical address
When the target host was given as a IPv6 numerical address, it was not properly put within square brackets for the Host: header in the CONNECT request. The "normal" request did fine. Reported by: "zooloo" Bug: http://curl.haxx.se/bug/view.cgi?id=3482093
This commit is contained in:
parent
f710aa40b3
commit
466150bc64
@ -116,6 +116,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
/* Setup the proxy-authorization header, if any */
|
/* Setup the proxy-authorization header, if any */
|
||||||
result = Curl_http_output_auth(conn, "CONNECT", host_port, TRUE);
|
result = Curl_http_output_auth(conn, "CONNECT", host_port, TRUE);
|
||||||
|
|
||||||
|
free(host_port);
|
||||||
|
|
||||||
if(CURLE_OK == result) {
|
if(CURLE_OK == result) {
|
||||||
char *host=(char *)"";
|
char *host=(char *)"";
|
||||||
const char *proxyconn="";
|
const char *proxyconn="";
|
||||||
@ -124,10 +126,11 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
"1.0" : "1.1";
|
"1.0" : "1.1";
|
||||||
|
|
||||||
if(!Curl_checkheaders(data, "Host:")) {
|
if(!Curl_checkheaders(data, "Host:")) {
|
||||||
host = aprintf("Host: %s\r\n", host_port);
|
host = aprintf("Host: %s%s%s:%hu\r\n", conn->bits.ipv6_ip?"[":"",
|
||||||
|
hostname, conn->bits.ipv6_ip?"]":"",
|
||||||
|
remote_port);
|
||||||
if(!host) {
|
if(!host) {
|
||||||
free(req_buffer);
|
free(req_buffer);
|
||||||
free(host_port);
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,7 +177,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending CONNECT to proxy");
|
failf(data, "Failed sending CONNECT to proxy");
|
||||||
}
|
}
|
||||||
free(host_port);
|
|
||||||
Curl_safefree(req_buffer);
|
Curl_safefree(req_buffer);
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user