tests: verify setting bearer and doing redirects

Test 778, 779 and 795
This commit is contained in:
Daniel Stenberg 2025-12-10 10:49:54 +01:00
parent 1a822275d3
commit f72c377914
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 250 additions and 3 deletions

View file

@ -110,9 +110,9 @@ test736 test737 test738 test739 test740 test741 test742 test743 test744 \
test745 test746 test747 test748 test749 test750 test751 test752 test753 \
test754 test755 test756 test757 test758 test759 test760 test761 test762 \
test763 test764 test765 test766 test767 test768 test769 test770 test771 \
test772 test773 test774 test775 test776 test777 \
test780 test781 test782 test783 test784 test785 test786 test787 test788 \
test789 test790 test791 test792 test793 test794 test796 test797 \
test772 test773 test774 test775 test776 test777 test778 test779 test780 \
test781 test782 test783 test784 test785 test786 test787 test788 test789 \
test790 test791 test792 test793 test794 test795 test796 test797 \
\
test799 test800 test801 test802 test803 test804 test805 test806 test807 \
test808 test809 test810 test811 test812 test813 test814 test815 test816 \

97
tests/data/test778 Normal file
View file

@ -0,0 +1,97 @@
<testcase>
<info>
<keywords>
HTTP
HTTP proxy
HTTP Basic auth
HTTP proxy Basic auth
followlocation
oauth2-bearer
</keywords>
</info>
#
# Server-side
<reply>
<data>
HTTP/1.1 302 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Location: http://goto.second.host.now/%TESTNUMBER0002
Content-Length: 8
Connection: close
contents
</data>
<data2>
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Content-Length: 9
contents
</data2>
<datacheck>
HTTP/1.1 302 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Location: http://goto.second.host.now/%TESTNUMBER0002
Content-Length: 8
Connection: close
HTTP/1.1 200 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Content-Length: 9
contents
</datacheck>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<name>
HTTP --oauth2-bearer redirect to new host (not passed on)
</name>
<command>
http://first.host.it.is/we/want/that/page/%TESTNUMBER -x %HOSTIP:%HTTPPORT --oauth2-bearer s3cr3t --proxy-user testing:this --location
</command>
<features>
proxy
</features>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol crlf="headers">
GET http://first.host.it.is/we/want/that/page/%TESTNUMBER HTTP/1.1
Host: first.host.it.is
Proxy-Authorization: Basic %b64[testing:this]b64%
Authorization: Bearer s3cr3t
User-Agent: curl/%VERSION
Accept: */*
Proxy-Connection: Keep-Alive
GET http://goto.second.host.now/%TESTNUMBER0002 HTTP/1.1
Host: goto.second.host.now
Proxy-Authorization: Basic %b64[testing:this]b64%
User-Agent: curl/%VERSION
Accept: */*
Proxy-Connection: Keep-Alive
</protocol>
</verify>
</testcase>

76
tests/data/test779 Normal file
View file

@ -0,0 +1,76 @@
<testcase>
<info>
<keywords>
HTTP
IMAP
oauth2-bearer
followlocation
</keywords>
</info>
#
# Server-side
<reply>
<servercmd>
AUTH XOAUTH2
REPLY AUTHENTICATE +
REPLY dXNlcj12AWF1dGg9QmVhcmVyIHMzY3IzdAEB B002 OK AUTHENTICATE completed
</servercmd>
<data>
HTTP/1.1 302 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Location: imap://v@host:%IMAPPORT/%TESTNUMBER0002/
Content-Length: 8
Connection: close
contents
</data>
<datacheck>
HTTP/1.1 302 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Location: imap://v@host:%IMAPPORT/%TESTNUMBER0002/
Content-Length: 8
Connection: close
</datacheck>
</reply>
#
# Client-side
<client>
<server>
http
imap
</server>
<name>
HTTP --oauth2-bearer redirects to IMAP
</name>
<command>
http://%HOSTIP:%HTTPPORT/page/%TESTNUMBER --oauth2-bearer s3cr3t --location --proto-redir imap --resolve host:%IMAPPORT:%HOSTIP
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol crlf="yes">
GET /page/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Bearer s3cr3t
User-Agent: curl/%VERSION
Accept: */*
B001 CAPABILITY
</protocol>
# curl: (67) Login denied
<errorcode>
67
</errorcode>
</verify>
</testcase>

74
tests/data/test795 Normal file
View file

@ -0,0 +1,74 @@
<testcase>
<info>
<keywords>
HTTP
IMAP
followlocation
</keywords>
</info>
#
# Server-side
<reply>
<servercmd>
AUTH PLAIN
CAPA SASL-IR
REPLY AUTHENTICATE B002 OK AUTHENTICATE completed
</servercmd>
<data>
HTTP/1.1 302 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Location: imap://v@host:%IMAPPORT/%TESTNUMBER0002/
Content-Length: 8
Connection: close
contents
</data>
<datacheck>
HTTP/1.1 302 OK
Date: Tue, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Content-Type: text/html
Funny-head: yesyes
Location: imap://v@host:%IMAPPORT/%TESTNUMBER0002/
Content-Length: 8
Connection: close
</datacheck>
</reply>
#
# Client-side
<client>
<server>
http
imap
</server>
<name>
HTTP with credentials redirects to IMAP
</name>
<command>
http://@%HOSTIP:%HTTPPORT/page/%TESTNUMBER -u user:secret --location --proto-redir imap --resolve host:%IMAPPORT:%HOSTIP
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol crlf="yes">
GET /page/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Basic %b64[user:secret]b64%
User-Agent: curl/%VERSION
Accept: */*
B001 CAPABILITY
B002 AUTHENTICATE PLAIN AHYA
B003 LIST "%TESTNUMBER0002" *
B004 LOGOUT
</protocol>
</verify>
</testcase>