aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-07-28 21:27:33 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-07-28 21:27:33 +0000
commitb9f1dd7691f3de2dc3c333579340f55aff72198d (patch)
treee014ecd6203237e1e8ad949c6857e13161760bd2 /lib/url.c
parenta7bed4fc7c8b734c66a731a49f92ee4c9b9ba707 (diff)
Bertrand Demiddelaer fixed the host name to get setup properly even when
a connection is re-used, when a proxy is in use.
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/url.c b/lib/url.c
index 467ae94be..42ac2fee6 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3071,10 +3071,17 @@ static CURLcode CreateConnection(struct SessionHandle *data,
conn->bits.user_passwd = old_conn->bits.user_passwd;
conn->bits.proxy_user_passwd = old_conn->bits.proxy_user_passwd;
+ /* host can change, when doing keepalive with a proxy ! */
+ if (conn->bits.httpproxy) {
+ free(conn->host.rawalloc);
+ conn->host=old_conn->host;
+ }
+
/* get the newly set value, not the old one */
conn->bits.no_body = old_conn->bits.no_body;
- free(old_conn->host.rawalloc); /* free the newly allocated name buffer */
+ if (!conn->bits.httpproxy)
+ free(old_conn->host.rawalloc); /* free the newly allocated name buffer */
free(conn->pathbuffer); /* free the newly allocated path pointer */
conn->pathbuffer = old_conn->pathbuffer; /* use the old one */
@@ -3126,7 +3133,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
*in_connect = conn; /* return this instead! */
infof(data, "Re-using existing connection! (#%ld) with host %s\n",
- conn->connectindex, conn->host.dispname);
+ conn->connectindex,
+ conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
}
else {
/*
@@ -3211,6 +3219,9 @@ static CURLcode CreateConnection(struct SessionHandle *data,
hostaddr = NULL;
conn->dns_entry = NULL; /* we don't connect now so we don't have any fresh
dns entry struct to point to */
+
+ if (conn->bits.httpproxy)
+ fix_hostname(conn, &conn->host);
}
else {
/* this is a fresh connect */
@@ -3503,7 +3514,8 @@ CURLcode Curl_done(struct connectdata **connp,
}
else
infof(data, "Connection #%ld to host %s left intact\n",
- conn->connectindex, conn->host.dispname);
+ conn->connectindex,
+ conn->bits.httpproxy?conn->proxy.dispname:conn->host.dispname);
return result;
}