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