diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-03-09 16:50:08 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-03-09 16:50:08 +0000 |
commit | e9b763ff05d2eb2f6236e1d59e2d2181254a439c (patch) | |
tree | c07ef67d58cda6168ba58f6a7c84dc772f98cfe2 /lib | |
parent | ac0bad2433a35c274cf8ad14e158251b88817b33 (diff) |
use the new name and hostname even though an old connection is reused, since
we can re-use a proxy connection that actually has different host names on
the same connection
Diffstat (limited to 'lib')
-rw-r--r-- | lib/url.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -200,7 +200,7 @@ CURLcode Curl_open(CURL **curl, char *url) return CURLE_OUT_OF_MEMORY; } - data-> headersize=HEADERSIZE; + data->headersize=HEADERSIZE; data->out = stdout; /* default output to stdout */ data->in = stdin; /* default input from stdin */ @@ -1627,12 +1627,17 @@ static CURLcode Connect(struct UrlData *data, * just allocated before we can move along and use the previously * existing one. */ - char *path = conn->path; /* setup the current path pointer properly */ - if(conn->proxyhost) - free(conn->proxyhost); - free(conn); /* we don't need this new one */ + struct connectdata *old_conn = conn; + char *path = old_conn->path; /* setup the current path pointer properly */ + if(old_conn->proxyhost) + free(old_conn->proxyhost); conn = conn_temp; /* use this connection from now on */ free(conn->path); /* free the previous path pointer */ + + /* we need these pointers if we speak over a proxy */ + conn->name = old_conn->name; + conn->hostname = old_conn->hostname; + conn->path = path; /* use this one */ conn->ppath = path; /* set this too */ @@ -1640,6 +1645,8 @@ static CURLcode Connect(struct UrlData *data, conn->maxdownload = 0; /* might have been used previously! */ conn->bits.reuse = TRUE; /* yes, we're re-using here */ + free(old_conn); /* we don't need this anymore */ + *in_connect = conn; /* return this instead! */ infof(data, "Re-using existing connection! (#%d)\n", conn->connectindex); |