mirror of
https://github.com/curl/curl.git
synced 2026-08-25 11:13:32 +03:00
url: detect proxy changes read from environment
When a proxy is set from an environment variable, detect if that proxy is not the same as previously and flush state. Verified by test1647: verify changing proxy with env variables and make sure Digest state is flushed in the second use Closes #21666
This commit is contained in:
parent
d99dcfb04a
commit
5c225384b8
6 changed files with 239 additions and 5 deletions
11
lib/url.c
11
lib/url.c
|
|
@ -305,6 +305,9 @@ CURLcode Curl_close(struct Curl_easy **datap)
|
|||
Curl_freeset(data);
|
||||
Curl_headers_cleanup(data);
|
||||
Curl_netrc_cleanup(&data->state.netrc);
|
||||
#ifndef CURL_DISABLE_DIGEST_AUTH
|
||||
curlx_free(data->state.envproxy);
|
||||
#endif
|
||||
curlx_free(data);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
|
@ -2007,6 +2010,14 @@ static CURLcode url_set_conn_proxies(struct Curl_easy *data,
|
|||
result = CURLE_UNSUPPORTED_PROTOCOL;
|
||||
goto out;
|
||||
#else
|
||||
#ifndef CURL_DISABLE_DIGEST_AUTH
|
||||
if(!Curl_safecmp(data->state.envproxy, proxy)) {
|
||||
/* proxy changed */
|
||||
Curl_auth_digest_cleanup(&data->state.proxydigest);
|
||||
curlx_free(data->state.envproxy);
|
||||
data->state.envproxy = curlx_strdup(proxy);
|
||||
}
|
||||
#endif
|
||||
/* force this connection's protocol to become HTTP if compatible */
|
||||
if(!(conn->scheme->protocol & PROTO_FAMILY_HTTP)) {
|
||||
if((conn->scheme->flags & PROTOPT_PROXY_AS_HTTP) &&
|
||||
|
|
|
|||
|
|
@ -671,6 +671,7 @@ struct UrlState {
|
|||
void (*prev_signal)(int sig);
|
||||
#endif
|
||||
#ifndef CURL_DISABLE_DIGEST_AUTH
|
||||
char *envproxy; /* last proxy string used for proxy-related state */
|
||||
struct digestdata digest; /* state data for host Digest auth */
|
||||
struct digestdata proxydigest; /* state data for proxy Digest auth */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue