test2024 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP GET
  6. HTTP Basic auth
  7. HTTP Digest auth
  8. </keywords>
  9. </info>
  10. # Server-side
  11. <reply>
  12. <!-- Alternate the order that Basic and Digest headers appear in responses to
  13. ensure that the order doesn't matter. -->
  14. <!-- First request has Basic auth, wrong password -->
  15. <data100>
  16. HTTP/1.1 401 Sorry wrong password
  17. Server: Microsoft-IIS/5.0
  18. Content-Type: text/html; charset=iso-8859-1
  19. Content-Length: 29
  20. WWW-Authenticate: Digest realm="testrealm", nonce="1"
  21. WWW-Authenticate: Basic realm="testrealm"
  22. This is a bad password page!
  23. </data100>
  24. <!-- Second request has Digest auth, right password -->
  25. <data1200>
  26. HTTP/1.1 200 Things are fine in server land
  27. Server: Microsoft-IIS/5.0
  28. Content-Type: text/html; charset=iso-8859-1
  29. Content-Length: 32
  30. Finally, this is the real page!
  31. </data1200>
  32. <!-- Third request has Basic auth, wrong password -->
  33. <data300>
  34. HTTP/1.1 401 Sorry wrong password (2)
  35. Server: Microsoft-IIS/5.0
  36. Content-Type: text/html; charset=iso-8859-1
  37. Content-Length: 29
  38. WWW-Authenticate: Digest realm="testrealm", nonce="2"
  39. WWW-Authenticate: Basic realm="testrealm"
  40. This is a bad password page!
  41. </data300>
  42. <!-- Fourth request has Digest auth, wrong password -->
  43. <data1400>
  44. HTTP/1.1 401 Sorry wrong password (3)
  45. Server: Microsoft-IIS/5.0
  46. Content-Type: text/html; charset=iso-8859-1
  47. Content-Length: 29
  48. WWW-Authenticate: Digest realm="testrealm", nonce="3"
  49. WWW-Authenticate: Basic realm="testrealm"
  50. This is a bad password page!
  51. </data1400>
  52. <!-- Fifth request has Digest auth, right password -->
  53. <data1500>
  54. HTTP/1.1 200 Things are fine in server land (2)
  55. Server: Microsoft-IIS/5.0
  56. Content-Type: text/html; charset=iso-8859-1
  57. Content-Length: 32
  58. Finally, this is the real page!
  59. </data1500>
  60. <datacheck>
  61. HTTP/1.1 401 Sorry wrong password
  62. Server: Microsoft-IIS/5.0
  63. Content-Type: text/html; charset=iso-8859-1
  64. Content-Length: 29
  65. WWW-Authenticate: Digest realm="testrealm", nonce="1"
  66. WWW-Authenticate: Basic realm="testrealm"
  67. This is a bad password page!
  68. HTTP/1.1 200 Things are fine in server land
  69. Server: Microsoft-IIS/5.0
  70. Content-Type: text/html; charset=iso-8859-1
  71. Content-Length: 32
  72. Finally, this is the real page!
  73. HTTP/1.1 401 Sorry wrong password (2)
  74. Server: Microsoft-IIS/5.0
  75. Content-Type: text/html; charset=iso-8859-1
  76. Content-Length: 29
  77. WWW-Authenticate: Digest realm="testrealm", nonce="2"
  78. WWW-Authenticate: Basic realm="testrealm"
  79. This is a bad password page!
  80. HTTP/1.1 401 Sorry wrong password (3)
  81. Server: Microsoft-IIS/5.0
  82. Content-Type: text/html; charset=iso-8859-1
  83. Content-Length: 29
  84. WWW-Authenticate: Digest realm="testrealm", nonce="3"
  85. WWW-Authenticate: Basic realm="testrealm"
  86. This is a bad password page!
  87. HTTP/1.1 200 Things are fine in server land (2)
  88. Server: Microsoft-IIS/5.0
  89. Content-Type: text/html; charset=iso-8859-1
  90. Content-Length: 32
  91. Finally, this is the real page!
  92. </datacheck>
  93. </reply>
  94. # Client-side
  95. <client>
  96. <server>
  97. http
  98. </server>
  99. <features>
  100. !SSPI
  101. crypto
  102. </features>
  103. <tool>
  104. libauthretry
  105. </tool>
  106. <name>
  107. HTTP authorization retry (Basic switching to Digest)
  108. </name>
  109. <setenv>
  110. # we force our own host name, in order to make the test machine independent
  111. CURL_GETHOSTNAME=curlhost
  112. # we try to use the LD_PRELOAD hack, if not a debug build
  113. LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  114. </setenv>
  115. <command>
  116. http://%HOSTIP:%HTTPPORT/%TESTNUMBER basic digest
  117. </command>
  118. <precheck>
  119. chkhostname curlhost
  120. </precheck>
  121. </client>
  122. # Verify data after the test has been "shot"
  123. <verify>
  124. <protocol>
  125. GET /%TESTNUMBER0100 HTTP/1.1
  126. Host: %HOSTIP:%HTTPPORT
  127. Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz
  128. Accept: */*
  129. GET /%TESTNUMBER0200 HTTP/1.1
  130. Host: %HOSTIP:%HTTPPORT
  131. Authorization: Digest username="testuser", realm="testrealm", nonce="1", uri="/%TESTNUMBER0200", response="ed646c565f79e2dd9fa37cb5a621213c"
  132. Accept: */*
  133. GET /%TESTNUMBER0300 HTTP/1.1
  134. Host: %HOSTIP:%HTTPPORT
  135. Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz
  136. Accept: */*
  137. GET /%TESTNUMBER0400 HTTP/1.1
  138. Host: %HOSTIP:%HTTPPORT
  139. Authorization: Digest username="testuser", realm="testrealm", nonce="2", uri="/%TESTNUMBER0400", response="9741ced8caacc6124770187b36f007c5"
  140. Accept: */*
  141. GET /%TESTNUMBER0500 HTTP/1.1
  142. Host: %HOSTIP:%HTTPPORT
  143. Authorization: Digest username="testuser", realm="testrealm", nonce="3", uri="/%TESTNUMBER0500", response="5bc77ec8c2d443b27a1b55f1fd8fbb13"
  144. Accept: */*
  145. </protocol>
  146. </verify>
  147. </testcase>