mirror of
https://github.com/curl/curl.git
synced 2026-08-25 12:33:35 +03:00
setopt: clear proxy auth properties when switching
Verify with test 1588 Closes #21453
This commit is contained in:
parent
7586ca7455
commit
c1cfdf59ac
6 changed files with 275 additions and 2 deletions
17
lib/setopt.c
17
lib/setopt.c
|
|
@ -49,6 +49,7 @@
|
|||
#include "curlx/strdup.h"
|
||||
#include "escape.h"
|
||||
#include "bufref.h"
|
||||
#include "vauth/vauth.h"
|
||||
|
||||
static CURLcode setopt_set_timeout_sec(timediff_t *ptimeout_ms, long secs)
|
||||
{
|
||||
|
|
@ -1622,6 +1623,20 @@ static CURLcode cookiefile(struct Curl_easy *data, const char *ptr)
|
|||
#endif
|
||||
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
|
||||
static CURLcode setproxy(struct Curl_easy *data, const char *proxy)
|
||||
{
|
||||
if((data->set.str[STRING_PROXY] && proxy) &&
|
||||
/* there was one set, is this a new one? */
|
||||
!strcmp(data->set.str[STRING_PROXY], proxy))
|
||||
return CURLE_OK; /* same one as before */
|
||||
|
||||
Curl_auth_digest_cleanup(&data->state.proxydigest);
|
||||
memset(&data->state.authproxy, 0, sizeof(data->state.authproxy));
|
||||
return Curl_setstropt(&data->set.str[STRING_PROXY], proxy);
|
||||
}
|
||||
|
||||
|
||||
static CURLcode setopt_cptr_proxy(struct Curl_easy *data, CURLoption option,
|
||||
const char *ptr)
|
||||
{
|
||||
|
|
@ -1717,7 +1732,7 @@ static CURLcode setopt_cptr_proxy(struct Curl_easy *data, CURLoption option,
|
|||
* Setting it to NULL, means no proxy but allows the environment variables
|
||||
* to decide for us (if CURLOPT_PRE_PROXY setting it to NULL).
|
||||
*/
|
||||
return Curl_setstropt(&s->str[STRING_PROXY], ptr);
|
||||
return setproxy(data, ptr);
|
||||
case CURLOPT_PRE_PROXY:
|
||||
/*
|
||||
* Set proxy server:port to use as SOCKS proxy.
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
|||
/* This is used to clean up the digest specific data */
|
||||
void Curl_auth_digest_cleanup(struct digestdata *digest);
|
||||
#else
|
||||
#define Curl_auth_digest_cleanup(x)
|
||||
#define Curl_auth_is_digest_supported() FALSE
|
||||
#endif /* !CURL_DISABLE_DIGEST_AUTH */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue