getinfo: provide info which auth was used for HTTP and proxy

CURLINFO_HTTPAUTH_USED and CURLINFO_PROXYAUTH_USED

Tested in 590 and 694

Ref: #12668
Idea-by: Ganesh Viswanathan
Closes #15450
This commit is contained in:
Daniel Stenberg 2024-10-29 16:53:32 +01:00
parent f3efab1bb4
commit 9d5ecc9613
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
15 changed files with 409 additions and 9 deletions

View file

@ -101,7 +101,7 @@ test652 test653 test654 test655 test656 test658 test659 test660 test661 \
test662 test663 test664 test665 test666 test667 test668 test669 test670 \
test671 test672 test673 test674 test675 test676 test677 test678 test679 \
test680 test681 test682 test683 test684 test685 test686 test687 test688 \
test689 test690 test691 test692 test693 \
test689 test690 test691 test692 test693 test694 \
\
test700 test701 test702 test703 test704 test705 test706 test707 test708 \
test709 test710 test711 test712 test713 test714 test715 test716 test717 \

127
tests/data/test694 Normal file
View file

@ -0,0 +1,127 @@
<testcase>
<info>
<keywords>
HTTP
HTTP POST
POST callback
HTTP proxy
HTTP proxy NTLM auth
NTLM
</keywords>
</info>
# Server-side
<reply>
<data>
HTTP/1.1 401 Authorization Required
Server: Apache/1.3.27 (Darwin) PHP/4.1.2
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Content-Type: text/html; charset=iso-8859-1
Content-Length: 26
This is not the real page
</data>
# this is returned first since we get no proxy-auth
<data1001>
HTTP/1.1 401 Authorization Required
WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==
Content-Length: 34
Hey you, authenticate or go away!
</data1001>
# This is supposed to be returned when the server gets the second
# Authorization: NTLM line passed-in from the client
<data1002>
HTTP/1.1 200 Things are fine
Server: Microsoft-IIS/5.0
Content-Type: text/html; charset=iso-8859-1
Content-Length: 42
Contents of that page you requested, sir.
</data1002>
# This is supposed to be returned when the server gets the second
# request.
<data10>
HTTP/1.1 200 Things are fine
Content-Type: yeah/maybe
Content-Length: 42
Contents of that second request. Differn.
</data10>
<datacheck>
HTTP/1.1 401 Authorization Required
Server: Apache/1.3.27 (Darwin) PHP/4.1.2
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Content-Type: text/html; charset=iso-8859-1
Content-Length: 26
HTTP/1.1 401 Authorization Required
WWW-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==
Content-Length: 34
HTTP/1.1 200 Things are fine
Server: Microsoft-IIS/5.0
Content-Type: text/html; charset=iso-8859-1
Content-Length: 42
Contents of that page you requested, sir.
HTTP/1.1 200 Things are fine
Content-Type: yeah/maybe
Content-Length: 42
Contents of that second request. Differn.
</datacheck>
</reply>
# Client-side
<client>
<server>
http
</server>
# tool to use
<tool>
lib%TESTNUMBER
</tool>
<features>
NTLM
!SSPI
</features>
<name>
HTTP with NTLM twice, verify CURLINFO_HTTPAUTH_USED
</name>
<command>
http://%HOSTIP:%HTTPPORT/path/mine http://%HOSTIP:%HTTPPORT/path/%TESTNUMBER0010
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol crlf="yes">
GET /path/mine HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
GET /path/mine HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
Accept: */*
GET /path/mine HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAAAgACAHAAAAALAAsAcgAAAAAAAAAAAAAAhoIBAAQt1KW5CgG4YdWWcfXyfXBz1ZMCzYp37xYjBiAizmw58O6eQS7yR66eqYGWeSwl9W1lV09SS1NUQVRJT04=
Accept: */*
GET /path/6940010 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
</verify>
</testcase>