mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
Fixed how the user name is extracted from http_proxy environment variable
when set.
This commit is contained in:
parent
40d9855df2
commit
dd2add82ee
@ -2351,6 +2351,8 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
char proxyuser[MAX_CURL_USER_LENGTH];
|
char proxyuser[MAX_CURL_USER_LENGTH];
|
||||||
char proxypasswd[MAX_CURL_PASSWORD_LENGTH];
|
char proxypasswd[MAX_CURL_PASSWORD_LENGTH];
|
||||||
|
|
||||||
|
char *fineptr;
|
||||||
|
|
||||||
/* skip the possible protocol piece */
|
/* skip the possible protocol piece */
|
||||||
ptr=strstr(proxy, "://");
|
ptr=strstr(proxy, "://");
|
||||||
if(ptr)
|
if(ptr)
|
||||||
@ -2358,9 +2360,12 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
else
|
else
|
||||||
ptr = proxy;
|
ptr = proxy;
|
||||||
|
|
||||||
|
fineptr = ptr;
|
||||||
|
|
||||||
/* check for an @-letter */
|
/* check for an @-letter */
|
||||||
ptr = strchr(ptr, '@');
|
ptr = strchr(ptr, '@');
|
||||||
if(ptr && (2 == sscanf(proxy, "%" MAX_CURL_USER_LENGTH_TXT"[^:]:"
|
if(ptr && (2 == sscanf(fineptr,
|
||||||
|
"%" MAX_CURL_USER_LENGTH_TXT"[^:]:"
|
||||||
"%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]",
|
"%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]",
|
||||||
proxyuser, proxypasswd))) {
|
proxyuser, proxypasswd))) {
|
||||||
/* found user and password, rip them out */
|
/* found user and password, rip them out */
|
||||||
@ -2378,7 +2383,7 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
|
|
||||||
conn->bits.proxy_user_passwd = TRUE; /* enable it */
|
conn->bits.proxy_user_passwd = TRUE; /* enable it */
|
||||||
|
|
||||||
ptr = strdup(ptr+1);
|
ptr = strdup(ptr+1); /* the right side of the @-letter */
|
||||||
free(proxy); /* free the former data */
|
free(proxy); /* free the former data */
|
||||||
proxy = ptr; /* now use this instead */
|
proxy = ptr; /* now use this instead */
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ http://we.want.that.site.com/63
|
|||||||
</strip>
|
</strip>
|
||||||
<protocol>
|
<protocol>
|
||||||
GET http://we.want.that.site.com/63 HTTP/1.1
|
GET http://we.want.that.site.com/63 HTTP/1.1
|
||||||
Proxy-authorization: Basic aHR0cDovL2Zha2U6dXNlcg==
|
Proxy-authorization: Basic ZmFrZTp1c2Vy
|
||||||
Host: we.want.that.site.com
|
Host: we.want.that.site.com
|
||||||
Pragma: no-cache
|
Pragma: no-cache
|
||||||
Accept: */*
|
Accept: */*
|
||||||
|
Loading…
Reference in New Issue
Block a user