xf.li | 6c8fc1e | 2023-08-12 00:11:09 -0700 | [diff] [blame^] | 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 swsbounce
|
| 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 swsbounce
|
| 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 | </features> |
| 68 | <name> |
| 69 | HTTP GET --digest increasing nonce-count |
| 70 | </name> |
| 71 | # This test is to ensure the nonce-count (nc) increases |
| 72 | # https://github.com/curl/curl/pull/1251 |
| 73 | <command> |
| 74 | -u auser:apasswd --location --digest http://%HOSTIP:%HTTPPORT/%TESTNUMBER |
| 75 | </command> |
| 76 | </client> |
| 77 | |
| 78 | # Verify data after the test has been "shot" |
| 79 | <verify> |
| 80 | |
| 81 | # Reorder the fields in 'Authorization: Digest' header. |
| 82 | # Since regular and SSPI digest auth header fields may not have the same order |
| 83 | # or whitespace we homogenize so that both may be tested. Also: |
| 84 | # - Remove the unique value from cnonce if in RFC format |
| 85 | # - Remove the unique value from response if in RFC format |
| 86 | # - Remove quotes from qop="auth" used by SSPI |
| 87 | # The if statement is one line because runtests evaluates one line at a time. |
| 88 | <strippart> |
| 89 | 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; } |
| 90 | </strippart> |
| 91 | <protocol> |
| 92 | GET /%TESTNUMBER HTTP/1.1
|
| 93 | Host: %HOSTIP:%HTTPPORT
|
| 94 | User-Agent: curl/%VERSION
|
| 95 | Accept: */*
|
| 96 |
|
| 97 | GET /%TESTNUMBER HTTP/1.1
|
| 98 | Host: %HOSTIP:%HTTPPORT
|
| 99 | Authorization: Digest cnonce=REMOVED, nc=00000001, nonce="1053604144", qop=auth, realm="testrealm", response=REMOVED, uri="/%TESTNUMBER", username="auser"
|
| 100 | User-Agent: curl/%VERSION
|
| 101 | Accept: */*
|
| 102 |
|
| 103 | GET /%TESTNUMBER0001 HTTP/1.1
|
| 104 | Host: %HOSTIP:%HTTPPORT
|
| 105 | Authorization: Digest cnonce=REMOVED, nc=00000002, nonce="1053604144", qop=auth, realm="testrealm", response=REMOVED, uri="/%TESTNUMBER0001", username="auser"
|
| 106 | User-Agent: curl/%VERSION
|
| 107 | Accept: */*
|
| 108 |
|
| 109 | </protocol> |
| 110 | </verify> |
| 111 | </testcase> |