test1286 (2957B)
1 <testcase> 2 <info> 3 <keywords> 4 HTTP 5 HTTP GET 6 HTTP Digest auth 7 followlocation 8 </keywords> 9 </info> 10 11 # Server-side 12 <reply> 13 <data> 14 HTTP/1.1 401 authentication please 15 Server: Microsoft-IIS/6.0 16 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", qop="auth" 17 Content-Type: text/html; charset=iso-8859-1 18 Content-Length: 0 19 20 </data> 21 <data1000> 22 HTTP/1.1 302 Thanks for this, but we want to redir you! 23 Server: Microsoft-IIS/5.0 24 Content-Type: text/html; charset=iso-8859-1 25 Location: /%TESTNUMBER0001 26 Content-Length: 0 27 28 </data1000> 29 <data1001> 30 HTTP/1.1 404 Not Found 31 Server: Microsoft-IIS/5.0 32 Content-Type: text/html; charset=iso-8859-1 33 Content-Length: 0 34 35 </data1001> 36 37 <datacheck> 38 HTTP/1.1 401 authentication please 39 Server: Microsoft-IIS/6.0 40 WWW-Authenticate: Digest realm="testrealm", nonce="1053604144", qop="auth" 41 Content-Type: text/html; charset=iso-8859-1 42 Content-Length: 0 43 44 HTTP/1.1 302 Thanks for this, but we want to redir you! 45 Server: Microsoft-IIS/5.0 46 Content-Type: text/html; charset=iso-8859-1 47 Location: /%TESTNUMBER0001 48 Content-Length: 0 49 50 HTTP/1.1 404 Not Found 51 Server: Microsoft-IIS/5.0 52 Content-Type: text/html; charset=iso-8859-1 53 Content-Length: 0 54 55 </datacheck> 56 57 </reply> 58 59 # Client-side 60 <client> 61 # 62 <server> 63 http 64 </server> 65 <features> 66 crypto 67 digest 68 </features> 69 <name> 70 HTTP GET --digest increasing nonce-count 71 </name> 72 # This test is to ensure the nonce-count (nc) increases 73 # https://github.com/curl/curl/pull/1251 74 <command> 75 -u auser:apasswd --location --digest http://%HOSTIP:%HTTPPORT/%TESTNUMBER 76 </command> 77 </client> 78 79 # Verify data after the test has been "shot" 80 <verify> 81 82 # Reorder the fields in 'Authorization: Digest' header. 83 # Since regular and SSPI digest auth header fields may not have the same order 84 # or whitespace we homogenize so that both may be tested. Also: 85 # - Remove the unique value from cnonce if in RFC format 86 # - Remove the unique value from response if in RFC format 87 # - Remove quotes from qop="auth" used by SSPI 88 # The if statement is one line because runtests evaluates one line at a time. 89 <strippart> 90 if(s/^(Authorization: Digest )([^\r\n]+)(\r?\n)$//) { $_ = $1 . join(', ', map { s/^(cnonce=)"[a-zA-Z0-9+\/=]+"$/$1REMOVED/; s/^(response=)"[a-f0-9]{32}"$/$1REMOVED/; s/^qop="auth"$/qop=auth/; $_ } sort split(/, */, $2)) . $3; } 91 </strippart> 92 <protocol> 93 GET /%TESTNUMBER HTTP/1.1 94 Host: %HOSTIP:%HTTPPORT 95 User-Agent: curl/%VERSION 96 Accept: */* 97 98 GET /%TESTNUMBER HTTP/1.1 99 Host: %HOSTIP:%HTTPPORT 100 Authorization: Digest cnonce=REMOVED, nc=00000001, nonce="1053604144", qop=auth, realm="testrealm", response=REMOVED, uri="/%TESTNUMBER", username="auser" 101 User-Agent: curl/%VERSION 102 Accept: */* 103 104 GET /%TESTNUMBER0001 HTTP/1.1 105 Host: %HOSTIP:%HTTPPORT 106 Authorization: Digest cnonce=REMOVED, nc=00000002, nonce="1053604144", qop=auth, realm="testrealm", response=REMOVED, uri="/%TESTNUMBER0001", username="auser" 107 User-Agent: curl/%VERSION 108 Accept: */* 109 110 </protocol> 111 </verify> 112 </testcase>