]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
url: use blank credentials when using proxy w/o username and password
authorDiven Qi <diven.qi@zoom.us>
Mon, 7 Sep 2020 09:30:04 +0000 (17:30 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 7 Sep 2020 22:48:09 +0000 (00:48 +0200)
Fixes proxy regression brought in commit ad829b21ae (7.71.0)

Fixed #5911
Closes #5914

lib/url.c

index b3884572d624cf7c059f74df06e600049dbf54da..af2a1c06dd50d068aef0c4f210c605bebf8adc44 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -2379,8 +2379,10 @@ static CURLcode parse_proxy(struct Curl_easy *data,
 static CURLcode parse_proxy_auth(struct Curl_easy *data,
                                  struct connectdata *conn)
 {
-  char *proxyuser = data->set.str[STRING_PROXYUSERNAME];
-  char *proxypasswd = data->set.str[STRING_PROXYPASSWORD];
+  const char *proxyuser = data->set.str[STRING_PROXYUSERNAME] ?
+    data->set.str[STRING_PROXYUSERNAME] : "";
+  const char *proxypasswd = data->set.str[STRING_PROXYPASSWORD] ?
+    data->set.str[STRING_PROXYPASSWORD] : "";
   CURLcode result = CURLE_OK;
 
   if(proxyuser)