test2040 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. <!-- First request has Basic auth, right password -->
  12. <data100>
  13. HTTP/1.1 200 Things are fine in server land
  14. Server: Microsoft-IIS/5.0
  15. Content-Type: text/html; charset=iso-8859-1
  16. Content-Length: 32
  17. Finally, this is the real page!
  18. </data100>
  19. <!-- Second request with Basic auth disabled -->
  20. <data200>
  21. HTTP/1.1 401 Sorry wrong password (2)
  22. Server: Microsoft-IIS/5.0
  23. Content-Type: text/html; charset=iso-8859-1
  24. Content-Length: 29
  25. WWW-Authenticate: Basic realm="testrealm"
  26. This is a bad password page!
  27. </data200>
  28. </reply>
  29. # Client-side
  30. <client>
  31. <server>
  32. http
  33. </server>
  34. <name>
  35. HTTP Basic authorization, then without authorization
  36. </name>
  37. <command option="no-output,no-include">
  38. -u testuser:testpass http://%HOSTIP:%HTTPPORT/20400100 --next --no-basic http://%HOSTIP:%HTTPPORT/20400200
  39. </command>
  40. </client>
  41. # Verify data after the test has been "shot"
  42. <verify>
  43. <strip>
  44. ^User-Agent:.*
  45. </strip>
  46. <protocol>
  47. GET /20400100 HTTP/1.1
  48. Host: %HOSTIP:%HTTPPORT
  49. Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
  50. Accept: */*
  51. GET /20400200 HTTP/1.1
  52. Host: %HOSTIP:%HTTPPORT
  53. Accept: */*
  54. </protocol>
  55. <stdout>
  56. Finally, this is the real page!
  57. This is a bad password page!
  58. </stdout>
  59. </verify>
  60. </testcase>