9c155a2ef4c6603e6cf38e82a77c17aa6b1e765c
[platform/upstream/curl.git] / tests / data / test2024
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 Basic auth, wrong password -->
17 <data100>
18 HTTP/1.1 401 Sorry wrong password\r
19 Server: Microsoft-IIS/5.0\r
20 Content-Type: text/html; charset=iso-8859-1\r
21 Content-Length: 29\r
22 WWW-Authenticate: Digest realm="testrealm", nonce="1"\r
23 WWW-Authenticate: Basic realm="testrealm"\r
24 \r
25 This is a bad password page!
26 </data100>
27
28 <!-- Second request has Digest auth, right password -->
29 <data1200>
30 HTTP/1.1 200 Things are fine in server land\r
31 Server: Microsoft-IIS/5.0\r
32 Content-Type: text/html; charset=iso-8859-1\r
33 Content-Length: 32\r
34 \r
35 Finally, this is the real page!
36 </data1200>
37
38 <!-- Third request has Basic auth, wrong password -->
39 <data300>
40 HTTP/1.1 401 Sorry wrong password (2)\r
41 Server: Microsoft-IIS/5.0\r
42 Content-Type: text/html; charset=iso-8859-1\r
43 Content-Length: 29\r
44 WWW-Authenticate: Digest realm="testrealm", nonce="2"\r
45 WWW-Authenticate: Basic realm="testrealm"\r
46 \r
47 This is a bad password page!
48 </data300>
49
50 <!-- Fourth request has Digest auth, wrong password -->
51 <data1400>
52 HTTP/1.1 401 Sorry wrong password (3)\r
53 Server: Microsoft-IIS/5.0\r
54 Content-Type: text/html; charset=iso-8859-1\r
55 Content-Length: 29\r
56 WWW-Authenticate: Digest realm="testrealm", nonce="3"\r
57 WWW-Authenticate: Basic realm="testrealm"\r
58 \r
59 This is a bad password page!
60 </data1400>
61
62 <!-- Fifth request has Digest auth, right password -->
63 <data1500>
64 HTTP/1.1 200 Things are fine in server land (2)\r
65 Server: Microsoft-IIS/5.0\r
66 Content-Type: text/html; charset=iso-8859-1\r
67 Content-Length: 32\r
68 \r
69 Finally, this is the real page!
70 </data1500>
71
72 <datacheck>
73 HTTP/1.1 401 Sorry wrong password\r
74 Server: Microsoft-IIS/5.0\r
75 Content-Type: text/html; charset=iso-8859-1\r
76 Content-Length: 29\r
77 WWW-Authenticate: Digest realm="testrealm", nonce="1"\r
78 WWW-Authenticate: Basic realm="testrealm"\r
79 \r
80 This is a bad password page!
81 HTTP/1.1 200 Things are fine in server land\r
82 Server: Microsoft-IIS/5.0\r
83 Content-Type: text/html; charset=iso-8859-1\r
84 Content-Length: 32\r
85 \r
86 Finally, this is the real page!
87 HTTP/1.1 401 Sorry wrong password (2)\r
88 Server: Microsoft-IIS/5.0\r
89 Content-Type: text/html; charset=iso-8859-1\r
90 Content-Length: 29\r
91 WWW-Authenticate: Digest realm="testrealm", nonce="2"\r
92 WWW-Authenticate: Basic realm="testrealm"\r
93 \r
94 This is a bad password page!
95 HTTP/1.1 401 Sorry wrong password (3)\r
96 Server: Microsoft-IIS/5.0\r
97 Content-Type: text/html; charset=iso-8859-1\r
98 Content-Length: 29\r
99 WWW-Authenticate: Digest realm="testrealm", nonce="3"\r
100 WWW-Authenticate: Basic realm="testrealm"\r
101 \r
102 This is a bad password page!
103 HTTP/1.1 200 Things are fine in server land (2)\r
104 Server: Microsoft-IIS/5.0\r
105 Content-Type: text/html; charset=iso-8859-1\r
106 Content-Length: 32\r
107 \r
108 Finally, this is the real page!
109 </datacheck>
110
111 </reply>
112
113 # Client-side
114 <client>
115 <server>
116 http
117 </server>
118 <features>
119 !SSPI
120 crypto
121 </features>
122 <tool>
123 libauthretry
124 </tool>
125
126  <name>
127 HTTP authorization retry (Basic switching to Digest)
128  </name>
129  <setenv>
130 # we force our own host name, in order to make the test machine independent
131 CURL_GETHOSTNAME=curlhost
132 # we try to use the LD_PRELOAD hack, if not a debug build
133 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
134  </setenv>
135  <command>
136 http://%HOSTIP:%HTTPPORT/2024 basic digest
137 </command>
138 <precheck>
139 chkhostname curlhost
140 </precheck>
141 </client>
142
143 # Verify data after the test has been "shot"
144 <verify>
145 <strip>
146 ^User-Agent:.*
147 </strip>
148 <protocol>
149 GET /20240100 HTTP/1.1\r
150 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz\r
151 Host: %HOSTIP:%HTTPPORT\r
152 Accept: */*\r
153 \r
154 GET /20240200 HTTP/1.1\r
155 Authorization: Digest username="testuser", realm="testrealm", nonce="1", uri="/20240200", response="ed646c565f79e2dd9fa37cb5a621213c"\r
156 Host: %HOSTIP:%HTTPPORT\r
157 Accept: */*\r
158 \r
159 GET /20240300 HTTP/1.1\r
160 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz\r
161 Host: %HOSTIP:%HTTPPORT\r
162 Accept: */*\r
163 \r
164 GET /20240400 HTTP/1.1\r
165 Authorization: Digest username="testuser", realm="testrealm", nonce="2", uri="/20240400", response="9741ced8caacc6124770187b36f007c5"\r
166 Host: %HOSTIP:%HTTPPORT\r
167 Accept: */*\r
168 \r
169 GET /20240500 HTTP/1.1\r
170 Authorization: Digest username="testuser", realm="testrealm", nonce="3", uri="/20240500", response="5bc77ec8c2d443b27a1b55f1fd8fbb13"\r
171 Host: %HOSTIP:%HTTPPORT\r
172 Accept: */*\r
173 \r
174 </protocol>
175 </verify>
176 </testcase>