1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 16:45:06 -05:00

http: fix proxy auth with blank password

Regression in 7.71.0

Added test case 346 to verify.

Reported-by: Kristoffer Gleditsch
Fixes #5613
Closes #5616
This commit is contained in:
Daniel Stenberg 2020-06-26 14:16:21 +02:00
parent fc3cba22c7
commit ff43fb6dec
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 62 additions and 2 deletions

View File

@ -308,7 +308,7 @@ static CURLcode http_output_basic(struct connectdata *conn, bool proxy)
pwd = conn->passwd;
}
out = aprintf("%s:%s", user, pwd);
out = aprintf("%s:%s", user, pwd ? pwd : "");
if(!out)
return CURLE_OUT_OF_MEMORY;

View File

@ -58,7 +58,7 @@ test307 test308 test309 test310 test311 test312 test313 test314 test315 \
test316 test317 test318 test319 test320 test321 test322 test323 test324 \
test325 test326 test327 test328 test329 test330 test331 test332 test333 \
test334 test335 test336 test337 test338 test339 test340 test341 test342 \
test343 test344 test345 \
test343 test344 test345 test346 \
test350 test351 test352 test353 test354 test355 test356 test357 test358 \
test359 \
test393 test394 test395 \

60
tests/data/test346 Normal file
View File

@ -0,0 +1,60 @@
<testcase>
<info>
<keywords>
HTTP
proxy
</keywords>
</info>
#
# Server-side
<reply>
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
#
# Client-side
<client>
<features>
proxy
</features>
<server>
http
</server>
<name>
HTTP GET over proxy with credentials using blank passwords
</name>
<command>
-x http://%HOSTIP:%HTTPPORT/346 -U puser: -u suser: http://remote.example/346
</command>
</client>
#
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET http://remote.example/346 HTTP/1.1
Host: remote.example
Proxy-Authorization: Basic cHVzZXI6
Authorization: Basic c3VzZXI6
Accept: */*
Proxy-Connection: Keep-Alive
</protocol>
</verify>
</testcase>