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