From 5cf78472e1195be215df3831ca11cb532ac75466 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 8 Jul 2009 07:00:40 +0000 Subject: - 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. --- lib/http.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'lib/http.c') 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; -- cgit v1.2.3