Imported Upstream version 7.44.0
[platform/upstream/curl.git] / tests / data / test2023
1 <testcase>
2 <info>
3 <keywords>
4 HTTP
5 HTTP GET
6 HTTP Basic auth
7 </keywords>
8 </info>
9 # Server-side
10 <reply>
11
12 <!-- First request has Basic auth, wrong password -->
13 <data100>
14 HTTP/1.1 401 Sorry wrong password\r
15 Server: Microsoft-IIS/5.0\r
16 Content-Type: text/html; charset=iso-8859-1\r
17 Content-Length: 29\r
18 WWW-Authenticate: Basic realm="testrealm"\r
19 \r
20 This is a bad password page!
21 </data100>
22
23 <!-- Second request has Basic auth, right password -->
24 <data200>
25 HTTP/1.1 200 Things are fine in server land\r
26 Server: Microsoft-IIS/5.0\r
27 Content-Type: text/html; charset=iso-8859-1\r
28 Content-Length: 32\r
29 \r
30 Finally, this is the real page!
31 </data200>
32
33 <!-- Third request has Basic auth, wrong password -->
34 <data300>
35 HTTP/1.1 401 Sorry wrong password (2)\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: Basic realm="testrealm"\r
40 \r
41 This is a bad password page!
42 </data300>
43
44 <!-- Fourth request has Basic auth, wrong password -->
45 <data400>
46 HTTP/1.1 401 Sorry wrong password (3)\r
47 Server: Microsoft-IIS/5.0\r
48 Content-Type: text/html; charset=iso-8859-1\r
49 Content-Length: 29\r
50 WWW-Authenticate: Basic realm="testrealm"\r
51 \r
52 This is a bad password page!
53 </data400>
54
55 <!-- Fifth request has Basic auth, right password -->
56 <data500>
57 HTTP/1.1 200 Things are fine in server land (2)\r
58 Server: Microsoft-IIS/5.0\r
59 Content-Type: text/html; charset=iso-8859-1\r
60 Content-Length: 32\r
61 \r
62 Finally, this is the real page!
63 </data500>
64
65 <datacheck>
66 HTTP/1.1 401 Sorry wrong password\r
67 Server: Microsoft-IIS/5.0\r
68 Content-Type: text/html; charset=iso-8859-1\r
69 Content-Length: 29\r
70 WWW-Authenticate: Basic realm="testrealm"\r
71 \r
72 This is a bad password page!
73 HTTP/1.1 200 Things are fine in server land\r
74 Server: Microsoft-IIS/5.0\r
75 Content-Type: text/html; charset=iso-8859-1\r
76 Content-Length: 32\r
77 \r
78 Finally, this is the real page!
79 HTTP/1.1 401 Sorry wrong password (2)\r
80 Server: Microsoft-IIS/5.0\r
81 Content-Type: text/html; charset=iso-8859-1\r
82 Content-Length: 29\r
83 WWW-Authenticate: Basic realm="testrealm"\r
84 \r
85 This is a bad password page!
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: Basic realm="testrealm"\r
91 \r
92 This is a bad password page!
93 HTTP/1.1 200 Things are fine in server land (2)\r
94 Server: Microsoft-IIS/5.0\r
95 Content-Type: text/html; charset=iso-8859-1\r
96 Content-Length: 32\r
97 \r
98 Finally, this is the real page!
99 </datacheck>
100
101 </reply>
102
103 # Client-side
104 <client>
105 <server>
106 http
107 </server>
108 <tool>
109 libauthretry
110 </tool>
111
112  <name>
113 HTTP authorization retry (Basic)
114  </name>
115  <setenv>
116 # we force our own host name, in order to make the test machine independent
117 CURL_GETHOSTNAME=curlhost
118 # we try to use the LD_PRELOAD hack, if not a debug build
119 LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
120  </setenv>
121  <command>
122 http://%HOSTIP:%HTTPPORT/2023 basic basic
123 </command>
124 <precheck>
125 chkhostname curlhost
126 </precheck>
127 </client>
128
129 # Verify data after the test has been "shot"
130 <verify>
131 <strip>
132 ^User-Agent:.*
133 </strip>
134 <protocol>
135 GET /20230100 HTTP/1.1\r
136 Host: %HOSTIP:%HTTPPORT\r
137 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz\r
138 Accept: */*\r
139 \r
140 GET /20230200 HTTP/1.1\r
141 Host: %HOSTIP:%HTTPPORT\r
142 Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=\r
143 Accept: */*\r
144 \r
145 GET /20230300 HTTP/1.1\r
146 Host: %HOSTIP:%HTTPPORT\r
147 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz\r
148 Accept: */*\r
149 \r
150 GET /20230400 HTTP/1.1\r
151 Host: %HOSTIP:%HTTPPORT\r
152 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz\r
153 Accept: */*\r
154 \r
155 GET /20230500 HTTP/1.1\r
156 Host: %HOSTIP:%HTTPPORT\r
157 Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=\r
158 Accept: */*\r
159 \r
160 </protocol>
161 </verify>
162 </testcase>