xref: /aosp_15_r20/external/curl/tests/data/test1286 (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker<testcase>
2*6236dae4SAndroid Build Coastguard Worker<info>
3*6236dae4SAndroid Build Coastguard Worker<keywords>
4*6236dae4SAndroid Build Coastguard WorkerHTTP
5*6236dae4SAndroid Build Coastguard WorkerHTTP GET
6*6236dae4SAndroid Build Coastguard WorkerHTTP Digest auth
7*6236dae4SAndroid Build Coastguard Workerfollowlocation
8*6236dae4SAndroid Build Coastguard Worker</keywords>
9*6236dae4SAndroid Build Coastguard Worker</info>
10*6236dae4SAndroid Build Coastguard Worker
11*6236dae4SAndroid Build Coastguard Worker# Server-side
12*6236dae4SAndroid Build Coastguard Worker<reply>
13*6236dae4SAndroid Build Coastguard Worker<data>
14*6236dae4SAndroid Build Coastguard WorkerHTTP/1.1 401 authentication please swsbounce
15*6236dae4SAndroid Build Coastguard WorkerServer: Microsoft-IIS/6.0
16*6236dae4SAndroid Build Coastguard WorkerWWW-Authenticate: Digest realm="testrealm", nonce="1053604144", qop="auth"
17*6236dae4SAndroid Build Coastguard WorkerContent-Type: text/html; charset=iso-8859-1
18*6236dae4SAndroid Build Coastguard WorkerContent-Length: 0
19*6236dae4SAndroid Build Coastguard Worker
20*6236dae4SAndroid Build Coastguard Worker</data>
21*6236dae4SAndroid Build Coastguard Worker<data1000>
22*6236dae4SAndroid Build Coastguard WorkerHTTP/1.1 302 Thanks for this, but we want to redir you!
23*6236dae4SAndroid Build Coastguard WorkerServer: Microsoft-IIS/5.0
24*6236dae4SAndroid Build Coastguard WorkerContent-Type: text/html; charset=iso-8859-1
25*6236dae4SAndroid Build Coastguard WorkerLocation: /%TESTNUMBER0001
26*6236dae4SAndroid Build Coastguard WorkerContent-Length: 0
27*6236dae4SAndroid Build Coastguard Worker
28*6236dae4SAndroid Build Coastguard Worker</data1000>
29*6236dae4SAndroid Build Coastguard Worker<data1001>
30*6236dae4SAndroid Build Coastguard WorkerHTTP/1.1 404 Not Found
31*6236dae4SAndroid Build Coastguard WorkerServer: Microsoft-IIS/5.0
32*6236dae4SAndroid Build Coastguard WorkerContent-Type: text/html; charset=iso-8859-1
33*6236dae4SAndroid Build Coastguard WorkerContent-Length: 0
34*6236dae4SAndroid Build Coastguard Worker
35*6236dae4SAndroid Build Coastguard Worker</data1001>
36*6236dae4SAndroid Build Coastguard Worker
37*6236dae4SAndroid Build Coastguard Worker<datacheck>
38*6236dae4SAndroid Build Coastguard WorkerHTTP/1.1 401 authentication please swsbounce
39*6236dae4SAndroid Build Coastguard WorkerServer: Microsoft-IIS/6.0
40*6236dae4SAndroid Build Coastguard WorkerWWW-Authenticate: Digest realm="testrealm", nonce="1053604144", qop="auth"
41*6236dae4SAndroid Build Coastguard WorkerContent-Type: text/html; charset=iso-8859-1
42*6236dae4SAndroid Build Coastguard WorkerContent-Length: 0
43*6236dae4SAndroid Build Coastguard Worker
44*6236dae4SAndroid Build Coastguard WorkerHTTP/1.1 302 Thanks for this, but we want to redir you!
45*6236dae4SAndroid Build Coastguard WorkerServer: Microsoft-IIS/5.0
46*6236dae4SAndroid Build Coastguard WorkerContent-Type: text/html; charset=iso-8859-1
47*6236dae4SAndroid Build Coastguard WorkerLocation: /%TESTNUMBER0001
48*6236dae4SAndroid Build Coastguard WorkerContent-Length: 0
49*6236dae4SAndroid Build Coastguard Worker
50*6236dae4SAndroid Build Coastguard WorkerHTTP/1.1 404 Not Found
51*6236dae4SAndroid Build Coastguard WorkerServer: Microsoft-IIS/5.0
52*6236dae4SAndroid Build Coastguard WorkerContent-Type: text/html; charset=iso-8859-1
53*6236dae4SAndroid Build Coastguard WorkerContent-Length: 0
54*6236dae4SAndroid Build Coastguard Worker
55*6236dae4SAndroid Build Coastguard Worker</datacheck>
56*6236dae4SAndroid Build Coastguard Worker
57*6236dae4SAndroid Build Coastguard Worker</reply>
58*6236dae4SAndroid Build Coastguard Worker
59*6236dae4SAndroid Build Coastguard Worker# Client-side
60*6236dae4SAndroid Build Coastguard Worker<client>
61*6236dae4SAndroid Build Coastguard Worker#
62*6236dae4SAndroid Build Coastguard Worker<server>
63*6236dae4SAndroid Build Coastguard Workerhttp
64*6236dae4SAndroid Build Coastguard Worker</server>
65*6236dae4SAndroid Build Coastguard Worker<features>
66*6236dae4SAndroid Build Coastguard Workercrypto
67*6236dae4SAndroid Build Coastguard Worker</features>
68*6236dae4SAndroid Build Coastguard Worker<name>
69*6236dae4SAndroid Build Coastguard WorkerHTTP GET --digest increasing nonce-count
70*6236dae4SAndroid Build Coastguard Worker</name>
71*6236dae4SAndroid Build Coastguard Worker# This test is to ensure the nonce-count (nc) increases
72*6236dae4SAndroid Build Coastguard Worker# https://github.com/curl/curl/pull/1251
73*6236dae4SAndroid Build Coastguard Worker<command>
74*6236dae4SAndroid Build Coastguard Worker-u auser:apasswd --location --digest http://%HOSTIP:%HTTPPORT/%TESTNUMBER
75*6236dae4SAndroid Build Coastguard Worker</command>
76*6236dae4SAndroid Build Coastguard Worker</client>
77*6236dae4SAndroid Build Coastguard Worker
78*6236dae4SAndroid Build Coastguard Worker# Verify data after the test has been "shot"
79*6236dae4SAndroid Build Coastguard Worker<verify>
80*6236dae4SAndroid Build Coastguard Worker
81*6236dae4SAndroid Build Coastguard Worker# Reorder the fields in 'Authorization: Digest' header.
82*6236dae4SAndroid Build Coastguard Worker# Since regular and SSPI digest auth header fields may not have the same order
83*6236dae4SAndroid Build Coastguard Worker# or whitespace we homogenize so that both may be tested. Also:
84*6236dae4SAndroid Build Coastguard Worker# - Remove the unique value from cnonce if in RFC format
85*6236dae4SAndroid Build Coastguard Worker# - Remove the unique value from response if in RFC format
86*6236dae4SAndroid Build Coastguard Worker# - Remove quotes from qop="auth" used by SSPI
87*6236dae4SAndroid Build Coastguard Worker# The if statement is one line because runtests evaluates one line at a time.
88*6236dae4SAndroid Build Coastguard Worker<strippart>
89*6236dae4SAndroid Build Coastguard Workerif(s/^(Authorization: Digest )([^\r\n]+)(\r?\n)$//) { $_ = $1 . join(', ', map { s/^(cnonce=)"[a-zA-Z0-9+\/=]+"$/$1REMOVED/; s/^(response=)"[a-f0-9]{32}"$/$1REMOVED/; s/^qop="auth"$/qop=auth/; $_ } sort split(/, */, $2)) . $3; }
90*6236dae4SAndroid Build Coastguard Worker</strippart>
91*6236dae4SAndroid Build Coastguard Worker<protocol>
92*6236dae4SAndroid Build Coastguard WorkerGET /%TESTNUMBER HTTP/1.1
93*6236dae4SAndroid Build Coastguard WorkerHost: %HOSTIP:%HTTPPORT
94*6236dae4SAndroid Build Coastguard WorkerUser-Agent: curl/%VERSION
95*6236dae4SAndroid Build Coastguard WorkerAccept: */*
96*6236dae4SAndroid Build Coastguard Worker
97*6236dae4SAndroid Build Coastguard WorkerGET /%TESTNUMBER HTTP/1.1
98*6236dae4SAndroid Build Coastguard WorkerHost: %HOSTIP:%HTTPPORT
99*6236dae4SAndroid Build Coastguard WorkerAuthorization: Digest cnonce=REMOVED, nc=00000001, nonce="1053604144", qop=auth, realm="testrealm", response=REMOVED, uri="/%TESTNUMBER", username="auser"
100*6236dae4SAndroid Build Coastguard WorkerUser-Agent: curl/%VERSION
101*6236dae4SAndroid Build Coastguard WorkerAccept: */*
102*6236dae4SAndroid Build Coastguard Worker
103*6236dae4SAndroid Build Coastguard WorkerGET /%TESTNUMBER0001 HTTP/1.1
104*6236dae4SAndroid Build Coastguard WorkerHost: %HOSTIP:%HTTPPORT
105*6236dae4SAndroid Build Coastguard WorkerAuthorization: Digest cnonce=REMOVED, nc=00000002, nonce="1053604144", qop=auth, realm="testrealm", response=REMOVED, uri="/%TESTNUMBER0001", username="auser"
106*6236dae4SAndroid Build Coastguard WorkerUser-Agent: curl/%VERSION
107*6236dae4SAndroid Build Coastguard WorkerAccept: */*
108*6236dae4SAndroid Build Coastguard Worker
109*6236dae4SAndroid Build Coastguard Worker</protocol>
110*6236dae4SAndroid Build Coastguard Worker</verify>
111*6236dae4SAndroid Build Coastguard Worker</testcase>
112