aboutsummaryrefslogtreecommitdiff
path: root/lib/http.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-07-08 07:00:40 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-07-08 07:00:40 +0000
commit5cf78472e1195be215df3831ca11cb532ac75466 (patch)
tree854a7226b471a2c6f83b0d6182b0520e2838e367 /lib/http.c
parent2aaff16a8721f2a9232ba5569672653f2c304cc1 (diff)
- Constantine Sapuntzakis posted bug report #2813123
(http://curl.haxx.se/bug/view.cgi?id=2813123) and an a patch that fixes the problem: Url A is accessed using auth. Url A redirects to Url B (on a different server0. Url B reuses a persistent connection. Url B has auth, even though it's on a different server. Note: if Url B does not reuse a persistent connection, auth is not sent.
Diffstat (limited to 'lib/http.c')
-rw-r--r--lib/http.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/http.c b/lib/http.c
index 9523da38f..227675ed7 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1780,17 +1780,6 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
}
#endif /* CURL_DISABLE_PROXY */
- if(!data->state.this_is_a_follow) {
- /* this is not a followed location, get the original host name */
- if(data->state.first_host)
- /* Free to avoid leaking memory on multiple requests*/
- free(data->state.first_host);
-
- data->state.first_host = strdup(conn->host.name);
- if(!data->state.first_host)
- return CURLE_OUT_OF_MEMORY;
- }
-
if(conn->protocol & PROT_HTTPS) {
/* perform SSL initialization */
if(data->state.used_interface == Curl_if_multi) {
@@ -2094,6 +2083,17 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
else
http = data->state.proto.http;
+ if(!data->state.this_is_a_follow) {
+ /* this is not a followed location, get the original host name */
+ if(data->state.first_host)
+ /* Free to avoid leaking memory on multiple requests*/
+ free(data->state.first_host);
+
+ data->state.first_host = strdup(conn->host.name);
+ if(!data->state.first_host)
+ return CURLE_OUT_OF_MEMORY;
+ }
+
if( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
data->set.upload) {
httpreq = HTTPREQ_PUT;