test1286 2.8 KB

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