diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-05-21 08:08:48 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-05-21 08:08:48 +0000 |
commit | d5043133e63290e0abedc34ddd1889bbd4bb953e (patch) | |
tree | 50ff25c5d923a49b999cd078bdfae19439b4d1a6 /lib/url.c | |
parent | 509f69a45769bf3fa3ae6d08daeab944b051beb4 (diff) |
Gisle Vanem made curl build with djgpp on DOS.
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -2149,6 +2149,33 @@ static CURLcode CreateConnection(struct SessionHandle *data, if(proxy && *proxy) { /* we have a proxy here to set */ + char *ptr; + char user[MAX_CURL_USER_LENGTH]; + char passwd[MAX_CURL_PASSWORD_LENGTH]; + + /* skip the possible protocol piece */ + ptr=strstr(proxy, "://"); + if(ptr) + ptr += 3; + else + ptr = proxy; + + /* check for an @-letter */ + ptr = strchr(ptr, '@'); + if(ptr && (2 == sscanf(proxy, "%" MAX_CURL_USER_LENGTH_TXT"[^:]:" + "%" MAX_CURL_PASSWORD_LENGTH_TXT "[^@]", + user, passwd))) { + /* found user and password, rip them out */ + strcpy(data->state.proxyuser, user); + strcpy(data->state.proxypasswd, passwd); + conn->bits.proxy_user_passwd = TRUE; /* enable it */ + + ptr = strdup(ptr+1); + free(proxy); /* free the former data */ + proxy = ptr; /* now use this instead */ + } + + data->change.proxy = proxy; data->change.proxy_alloc=TRUE; /* this needs to be freed later */ conn->bits.httpproxy = TRUE; |