From d6464f991cbb029d5f65cf6d88a72ad9b527d292 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 14 Apr 2026 15:51:24 +0200 Subject: [PATCH] fixup make test 2011 run as well --- lib/http.c | 7 +++++++ lib/transfer.c | 20 ++++++++++++++++---- lib/transfer.h | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/http.c b/lib/http.c index e7e46c7a1c..f976987111 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1289,6 +1289,13 @@ CURLcode Curl_http_follow(struct Curl_easy *data, const char *newurl, } } DEBUGASSERT(follow_url); + { + CURLcode result = Curl_reset_proxypwd(data); + if(result) { + curlx_free(follow_url); + return result; + } + } if(type == FOLLOW_FAKE) { /* we are only figuring out the new URL if we would have followed locations diff --git a/lib/transfer.c b/lib/transfer.c index 4757c1118b..57debdecaf 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -451,15 +451,25 @@ CURLcode Curl_reset_userpwd(struct Curl_easy *data) if(!result) result = Curl_setstropt(&data->state.aptr.passwd, data->set.str[STRING_PASSWORD]); + return result; +} + +/* + * Restore the proxy credentials to those set in options. + */ +CURLcode Curl_reset_proxypwd(struct Curl_easy *data) +{ #ifndef CURL_DISABLE_PROXY - if(!result) - result = Curl_setstropt(&data->state.aptr.proxyuser, - data->set.str[STRING_PROXYUSERNAME]); + CURLcode result = Curl_setstropt(&data->state.aptr.proxyuser, + data->set.str[STRING_PROXYUSERNAME]); if(!result) result = Curl_setstropt(&data->state.aptr.proxypasswd, data->set.str[STRING_PROXYPASSWORD]); -#endif return result; +#else + (void)data; + return CURLE_OK; +#endif } /* @@ -612,6 +622,8 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) if(!result) result = Curl_reset_userpwd(data); + if(!result) + result = Curl_reset_proxypwd(data); data->req.headerbytecount = 0; Curl_headers_cleanup(data); diff --git a/lib/transfer.h b/lib/transfer.h index 41edc4ff9c..b29e70b9ec 100644 --- a/lib/transfer.h +++ b/lib/transfer.h @@ -32,6 +32,7 @@ char *Curl_checkheaders(const struct Curl_easy *data, void Curl_init_CONNECT(struct Curl_easy *data); CURLcode Curl_reset_userpwd(struct Curl_easy *data); +CURLcode Curl_reset_proxypwd(struct Curl_easy *data); CURLcode Curl_pretransfer(struct Curl_easy *data); CURLcode Curl_sendrecv(struct Curl_easy *data);