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