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