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 15 Server: Microsoft-IIS/5.0 16 Content-Type: text/html; charset=iso-8859-1 17 Content-Length: 29 18 WWW-Authenticate: Basic realm="testrealm" 19 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 26 Server: Microsoft-IIS/5.0 27 Content-Type: text/html; charset=iso-8859-1 28 Content-Length: 32 29 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) 36 Server: Microsoft-IIS/5.0 37 Content-Type: text/html; charset=iso-8859-1 38 Content-Length: 29 39 WWW-Authenticate: Basic realm="testrealm" 40 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) 47 Server: Microsoft-IIS/5.0 48 Content-Type: text/html; charset=iso-8859-1 49 Content-Length: 29 50 WWW-Authenticate: Basic realm="testrealm" 51 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) 58 Server: Microsoft-IIS/5.0 59 Content-Type: text/html; charset=iso-8859-1 60 Content-Length: 32 61 62 Finally, this is the real page! 63 </data500> 64 65 <datacheck> 66 HTTP/1.1 401 Sorry wrong password 67 Server: Microsoft-IIS/5.0 68 Content-Type: text/html; charset=iso-8859-1 69 Content-Length: 29 70 WWW-Authenticate: Basic realm="testrealm" 71 72 This is a bad password page! 73 HTTP/1.1 200 Things are fine in server land 74 Server: Microsoft-IIS/5.0 75 Content-Type: text/html; charset=iso-8859-1 76 Content-Length: 32 77 78 Finally, this is the real page! 79 HTTP/1.1 401 Sorry wrong password (2) 80 Server: Microsoft-IIS/5.0 81 Content-Type: text/html; charset=iso-8859-1 82 Content-Length: 29 83 WWW-Authenticate: Basic realm="testrealm" 84 85 This is a bad password page! 86 HTTP/1.1 401 Sorry wrong password (3) 87 Server: Microsoft-IIS/5.0 88 Content-Type: text/html; charset=iso-8859-1 89 Content-Length: 29 90 WWW-Authenticate: Basic realm="testrealm" 91 92 This is a bad password page! 93 HTTP/1.1 200 Things are fine in server land (2) 94 Server: Microsoft-IIS/5.0 95 Content-Type: text/html; charset=iso-8859-1 96 Content-Length: 32 97 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 136 Host: %HOSTIP:%HTTPPORT 137 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz 138 Accept: */* 139 140 GET /20230200 HTTP/1.1 141 Host: %HOSTIP:%HTTPPORT 142 Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M= 143 Accept: */* 144 145 GET /20230300 HTTP/1.1 146 Host: %HOSTIP:%HTTPPORT 147 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz 148 Accept: */* 149 150 GET /20230400 HTTP/1.1 151 Host: %HOSTIP:%HTTPPORT 152 Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz 153 Accept: */* 154 155 GET /20230500 HTTP/1.1 156 Host: %HOSTIP:%HTTPPORT 157 Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M= 158 Accept: */* 159 160 </protocol> 161 </verify> 162 </testcase> 163