Add tests of auth retries
[platform/upstream/curl.git] / tests / data / test2027
1 <testcase>
2 <info>
3 <keywords>
4 HTTP
5 HTTP GET
6 HTTP Digest auth
7 </keywords>
8 </info>
9 # Server-side
10 <reply>
11
12 <!-- First request has Digest auth, wrong password -->
13 <data100>
14 HTTP/1.1 401 Need Digest auth\r
15 Server: Microsoft-IIS/5.0\r
16 Content-Type: text/html; charset=iso-8859-1\r
17 Content-Length: 27\r
18 WWW-Authenticate: Digest realm="testrealm", nonce="1"\r
19 \r
20 This is not the real page!
21 </data100>
22
23 <data1100>
24 HTTP/1.1 401 Sorry wrong password\r
25 Server: Microsoft-IIS/5.0\r
26 Content-Type: text/html; charset=iso-8859-1\r
27 Content-Length: 29\r
28 WWW-Authenticate: Digest realm="testrealm", nonce="2"\r
29 \r
30 This is a bad password page!
31 </data1100>
32
33 <!-- Second request has Digest auth, right password -->
34 <data200>
35 HTTP/1.1 401 Need Digest auth (2)\r
36 Server: Microsoft-IIS/5.0\r
37 Content-Type: text/html; charset=iso-8859-1\r
38 Content-Length: 27\r
39 WWW-Authenticate: Digest realm="testrealm", nonce="3"\r
40 \r
41 This is not the real page!
42 </data200>
43
44 <data1200>
45 HTTP/1.1 200 Things are fine in server land\r
46 Server: Microsoft-IIS/5.0\r
47 Content-Type: text/html; charset=iso-8859-1\r
48 Content-Length: 32\r
49 \r
50 Finally, this is the real page!
51 </data1200>
52
53 <!-- Third request has Digest auth, wrong password -->
54 <data300>
55 HTTP/1.1 401 Need Digest auth (3)\r
56 Server: Microsoft-IIS/5.0\r
57 Content-Type: text/html; charset=iso-8859-1\r
58 Content-Length: 27\r
59 WWW-Authenticate: Digest realm="testrealm", nonce="4"\r
60 \r
61 This is not the real page!
62 </data300>
63
64 <data1300>
65 HTTP/1.1 401 Sorry wrong password (2)\r
66 Server: Microsoft-IIS/5.0\r
67 Content-Type: text/html; charset=iso-8859-1\r
68 Content-Length: 29\r
69 WWW-Authenticate: Digest realm="testrealm", nonce="5"\r
70 \r
71 This is a bad password page!
72 </data1300>
73
74 <!-- Fourth request has Digest auth, wrong password -->
75 <data400>
76 HTTP/1.1 401 Need Digest auth (4)\r
77 Server: Microsoft-IIS/5.0\r
78 Content-Type: text/html; charset=iso-8859-1\r
79 Content-Length: 27\r
80 WWW-Authenticate: Digest realm="testrealm", nonce="6"\r
81 \r
82 This is not the real page!
83 </data400>
84
85 <data1400>
86 HTTP/1.1 401 Sorry wrong password (3)\r
87 Server: Microsoft-IIS/5.0\r
88 Content-Type: text/html; charset=iso-8859-1\r
89 Content-Length: 29\r
90 WWW-Authenticate: Digest realm="testrealm", nonce="7"\r
91 \r
92 This is a bad password page!
93 </data1400>
94
95 <!-- Fifth request has Digest auth, right password -->
96 <data500>
97 HTTP/1.1 401 Need Digest auth (5)\r
98 Server: Microsoft-IIS/5.0\r
99 Content-Type: text/html; charset=iso-8859-1\r
100 Content-Length: 27\r
101 WWW-Authenticate: Digest realm="testrealm", nonce="8"\r
102 \r
103 This is not the real page!
104 </data500>
105
106 <data1500>
107 HTTP/1.1 200 Things are fine in server land (2)\r
108 Server: Microsoft-IIS/5.0\r
109 Content-Type: text/html; charset=iso-8859-1\r
110 Content-Length: 32\r
111 \r
112 Finally, this is the real page!
113 </data1500>
114
115 <datacheck>
116 HTTP/1.1 401 Need Digest auth\r
117 Server: Microsoft-IIS/5.0\r
118 Content-Type: text/html; charset=iso-8859-1\r
119 Content-Length: 27\r
120 WWW-Authenticate: Digest realm="testrealm", nonce="1"\r
121 \r
122 HTTP/1.1 401 Sorry wrong password\r
123 Server: Microsoft-IIS/5.0\r
124 Content-Type: text/html; charset=iso-8859-1\r
125 Content-Length: 29\r
126 WWW-Authenticate: Digest realm="testrealm", nonce="2"\r
127 \r
128 This is a bad password page!
129 HTTP/1.1 200 Things are fine in server land\r
130 Server: Microsoft-IIS/5.0\r
131 Content-Type: text/html; charset=iso-8859-1\r
132 Content-Length: 32\r
133 \r
134 Finally, this is the real page!
135 HTTP/1.1 401 Need Digest auth (3)\r
136 Server: Microsoft-IIS/5.0\r
137 Content-Type: text/html; charset=iso-8859-1\r
138 Content-Length: 27\r
139 WWW-Authenticate: Digest realm="testrealm", nonce="4"\r
140 \r
141 HTTP/1.1 401 Sorry wrong password (2)\r
142 Server: Microsoft-IIS/5.0\r
143 Content-Type: text/html; charset=iso-8859-1\r
144 Content-Length: 29\r
145 WWW-Authenticate: Digest realm="testrealm", nonce="5"\r
146 \r
147 This is a bad password page!
148 HTTP/1.1 401 Sorry wrong password (3)\r
149 Server: Microsoft-IIS/5.0\r
150 Content-Type: text/html; charset=iso-8859-1\r
151 Content-Length: 29\r
152 WWW-Authenticate: Digest realm="testrealm", nonce="7"\r
153 \r
154 This is a bad password page!
155 HTTP/1.1 200 Things are fine in server land (2)\r
156 Server: Microsoft-IIS/5.0\r
157 Content-Type: text/html; charset=iso-8859-1\r
158 Content-Length: 32\r
159 \r
160 Finally, this is the real page!
161 </datacheck>
162
163 </reply>
164
165 # Client-side
166 <client>
167 <server>
168 http
169 </server>
170 <tool>
171 libauthretry
172 </tool>
173
174  <name>
175 HTTP authorization retry (Digest)
176  </name>
177  <setenv>
178 # we force our own host name, in order to make the test machine independent
179 CURL_GETHOSTNAME=curlhost
180 # we try to use the LD_PRELOAD hack, if not a debug build
181 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
182  </setenv>
183  <command>
184 http://%HOSTIP:%HTTPPORT/2027 digest digest
185 </command>
186 <precheck>
187 chkhostname curlhost
188 </precheck>
189 </client>
190
191 # Verify data after the test has been "shot"
192 <verify>
193 <strip>
194 ^User-Agent:.*
195 </strip>
196 <protocol>
197 GET /20270100 HTTP/1.1\r
198 Host: %HOSTIP:%HTTPPORT\r
199 Accept: */*\r
200 \r
201 GET /20270100 HTTP/1.1\r
202 Authorization: Digest username="testuser", realm="testrealm", nonce="1", uri="/20270100", response="f7fd60eefaff5225971bf9b3d80d6ba6"\r
203 Host: %HOSTIP:%HTTPPORT\r
204 Accept: */*\r
205 \r
206 GET /20270200 HTTP/1.1\r
207 Authorization: Digest username="testuser", realm="testrealm", nonce="2", uri="/20270200", response="785ca3ef511999f7e9c178195f5b388c"\r
208 Host: %HOSTIP:%HTTPPORT\r
209 Accept: */*\r
210 \r
211 GET /20270300 HTTP/1.1\r
212 Host: %HOSTIP:%HTTPPORT\r
213 Accept: */*\r
214 \r
215 GET /20270300 HTTP/1.1\r
216 Authorization: Digest username="testuser", realm="testrealm", nonce="4", uri="/20270300", response="4c735d2360fd6848e7cb32a11ae3612b"\r
217 Host: %HOSTIP:%HTTPPORT\r
218 Accept: */*\r
219 \r
220 GET /20270400 HTTP/1.1\r
221 Authorization: Digest username="testuser", realm="testrealm", nonce="5", uri="/20270400", response="f5906785511fb60a2af8b1cd53008ead"\r
222 Host: %HOSTIP:%HTTPPORT\r
223 Accept: */*\r
224 \r
225 GET /20270500 HTTP/1.1\r
226 Authorization: Digest username="testuser", realm="testrealm", nonce="7", uri="/20270500", response="8ef4d935fd964a46c3965c0863b52cf1"\r
227 Host: %HOSTIP:%HTTPPORT\r
228 Accept: */*\r
229 \r
230 </protocol>
231 </verify>
232 </testcase>