1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

remake Host: for each connection and it'll work with proxies too

This commit is contained in:
Daniel Stenberg 2001-03-09 16:48:18 +00:00
parent 67d5c0a970
commit ac0bad2433

View File

@ -469,10 +469,14 @@ CURLcode Curl_http(struct connectdata *conn)
http->sendit = Curl_getFormData(data->httppost, &http->postsize); http->sendit = Curl_getFormData(data->httppost, &http->postsize);
} }
if(!checkheaders(data, "Host:") && if(!checkheaders(data, "Host:")) {
!conn->allocptr.host) { /* if ptr_host is already set, it is almost OK since we only re-use
/* if ptr_host is already set, it is OK since we only re-use connections connections to the very same host and port, but when we use a HTTP
to the very same host and port */ proxy we have a persistant connect and yet we must change the Host:
header! */
if(conn->allocptr.host)
free(conn->allocptr.host);
if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) || if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) ||
(!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) ) (!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) )