mirror of
https://github.com/moparisthebest/curl
synced 2024-12-24 17:18:48 -05:00
conn: do not reuse connection if SOCKS proxy credentials differ
Closes #4835
This commit is contained in:
parent
c0d7b05c41
commit
34e6bc42b0
33
lib/url.c
33
lib/url.c
@ -882,9 +882,37 @@ proxy_info_matches(const struct proxy_info* data,
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
socks_proxy_info_matches(const struct proxy_info* data,
|
||||||
|
const struct proxy_info* needle)
|
||||||
|
{
|
||||||
|
if(!proxy_info_matches(data, needle))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* the user information is case-sensitive
|
||||||
|
or at least it is not defined as case-insensitive
|
||||||
|
see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
|
||||||
|
if((data->user == NULL) != (needle->user == NULL))
|
||||||
|
return FALSE;
|
||||||
|
/* curl_strequal does a case insentive comparison, so do not use it here! */
|
||||||
|
if(data->user &&
|
||||||
|
needle->user &&
|
||||||
|
strcmp(data->user, needle->user) != 0)
|
||||||
|
return FALSE;
|
||||||
|
if((data->passwd == NULL) != (needle->passwd == NULL))
|
||||||
|
return FALSE;
|
||||||
|
/* curl_strequal does a case insentive comparison, so do not use it here! */
|
||||||
|
if(data->passwd &&
|
||||||
|
needle->passwd &&
|
||||||
|
strcmp(data->passwd, needle->passwd) != 0)
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* disabled, won't get called */
|
/* disabled, won't get called */
|
||||||
#define proxy_info_matches(x,y) FALSE
|
#define proxy_info_matches(x,y) FALSE
|
||||||
|
#define socks_proxy_info_matches(x,y) FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* A connection has to have been idle for a shorter time than 'maxage_conn' to
|
/* A connection has to have been idle for a shorter time than 'maxage_conn' to
|
||||||
@ -1143,8 +1171,9 @@ ConnectionExists(struct Curl_easy *data,
|
|||||||
needle->bits.socksproxy != check->bits.socksproxy)
|
needle->bits.socksproxy != check->bits.socksproxy)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(needle->bits.socksproxy && !proxy_info_matches(&needle->socks_proxy,
|
if(needle->bits.socksproxy &&
|
||||||
&check->socks_proxy))
|
!socks_proxy_info_matches(&needle->socks_proxy,
|
||||||
|
&check->socks_proxy))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(needle->bits.conn_to_host != check->bits.conn_to_host)
|
if(needle->bits.conn_to_host != check->bits.conn_to_host)
|
||||||
|
Loading…
Reference in New Issue
Block a user