http: clear credentials better on redirect

Verify with test 2506: netrc with redirect using proxy

Updated test 998 which was wrong.

Reported-by: Muhamad Arga Reksapati

Closes #21345
This commit is contained in:
Daniel Stenberg 2026-04-16 14:26:20 +02:00
parent 3e0e2cc1ab
commit b4024bf808
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 165 additions and 65 deletions

View file

@ -265,7 +265,7 @@ test2309 \
\
test2400 test2401 test2402 test2403 test2404 test2405 test2406 test2407 \
\
test2500 test2501 test2502 test2503 test2504 test2505 \
test2500 test2501 test2502 test2503 test2504 test2505 test2506 \
\
test2600 test2601 test2602 test2603 test2604 test2605 \
\

64
tests/data/test2506 Normal file
View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="US-ASCII"?>
<testcase>
<info>
<keywords>
HTTP
cookies
</keywords>
</info>
<reply>
<data crlf="headers" nocheck="yes">
HTTP/1.1 301 redirect
Date: Tue, 09 Nov 2010 14:49:00 GMT
Content-Length: 3
Location: http://numbertwo.example/%TESTNUMBER0002
ok
</data>
<data2 crlf="headers" nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Content-Length: 4
yes
</data2>
</reply>
<client>
<server>
http
</server>
<features>
proxy
</features>
<tool>
lib%TESTNUMBER
</tool>
<name>
netrc with redirect using proxy
</name>
<file name="%LOGDIR/netrc2506">
machine site.example login batman password robin
</file>
<command>
http://%HOSTIP:%HTTPPORT http://site.example/ %LOGDIR/netrc2506
</command>
</client>
<verify>
<protocol crlf="headers">
GET http://site.example/ HTTP/1.1
Host: site.example
Authorization: Basic %b64[batman:robin]b64%
Accept: */*
Proxy-Connection: Keep-Alive
GET http://numbertwo.example/25060002 HTTP/1.1
Host: numbertwo.example
Accept: */*
Proxy-Connection: Keep-Alive
</protocol>
</verify>
</testcase>

View file

@ -77,7 +77,6 @@ Proxy-Connection: Keep-Alive
GET http://somewhere.else.example/a/path/9980002 HTTP/1.1
Host: somewhere.else.example
Authorization: Basic %b64[alberto:einstein]b64%
User-Agent: curl/%VERSION
Accept: */*
Proxy-Connection: Keep-Alive