test2023 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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, wrong password -->
  12. <data100>
  13. HTTP/1.1 401 Sorry wrong password
  14. Server: Microsoft-IIS/5.0
  15. Content-Type: text/html; charset=iso-8859-1
  16. Content-Length: 29
  17. WWW-Authenticate: Basic realm="testrealm"
  18. This is a bad password page!
  19. </data100>
  20. <!-- Second request has Basic auth, right password -->
  21. <data200>
  22. HTTP/1.1 200 Things are fine in server land
  23. Server: Microsoft-IIS/5.0
  24. Content-Type: text/html; charset=iso-8859-1
  25. Content-Length: 32
  26. Finally, this is the real page!
  27. </data200>
  28. <!-- Third request has Basic auth, wrong password -->
  29. <data300>
  30. HTTP/1.1 401 Sorry wrong password (2)
  31. Server: Microsoft-IIS/5.0
  32. Content-Type: text/html; charset=iso-8859-1
  33. Content-Length: 29
  34. WWW-Authenticate: Basic realm="testrealm"
  35. This is a bad password page!
  36. </data300>
  37. <!-- Fourth request has Basic auth, wrong password -->
  38. <data400>
  39. HTTP/1.1 401 Sorry wrong password (3)
  40. Server: Microsoft-IIS/5.0
  41. Content-Type: text/html; charset=iso-8859-1
  42. Content-Length: 29
  43. WWW-Authenticate: Basic realm="testrealm"
  44. This is a bad password page!
  45. </data400>
  46. <!-- Fifth request has Basic auth, right password -->
  47. <data500>
  48. HTTP/1.1 200 Things are fine in server land (2)
  49. Server: Microsoft-IIS/5.0
  50. Content-Type: text/html; charset=iso-8859-1
  51. Content-Length: 32
  52. Finally, this is the real page!
  53. </data500>
  54. <datacheck>
  55. HTTP/1.1 401 Sorry wrong password
  56. Server: Microsoft-IIS/5.0
  57. Content-Type: text/html; charset=iso-8859-1
  58. Content-Length: 29
  59. WWW-Authenticate: Basic realm="testrealm"
  60. This is a bad password page!
  61. HTTP/1.1 200 Things are fine in server land
  62. Server: Microsoft-IIS/5.0
  63. Content-Type: text/html; charset=iso-8859-1
  64. Content-Length: 32
  65. Finally, this is the real page!
  66. HTTP/1.1 401 Sorry wrong password (2)
  67. Server: Microsoft-IIS/5.0
  68. Content-Type: text/html; charset=iso-8859-1
  69. Content-Length: 29
  70. WWW-Authenticate: Basic realm="testrealm"
  71. This is a bad password page!
  72. HTTP/1.1 401 Sorry wrong password (3)
  73. Server: Microsoft-IIS/5.0
  74. Content-Type: text/html; charset=iso-8859-1
  75. Content-Length: 29
  76. WWW-Authenticate: Basic realm="testrealm"
  77. This is a bad password page!
  78. HTTP/1.1 200 Things are fine in server land (2)
  79. Server: Microsoft-IIS/5.0
  80. Content-Type: text/html; charset=iso-8859-1
  81. Content-Length: 32
  82. Finally, this is the real page!
  83. </datacheck>
  84. </reply>
  85. # Client-side
  86. <client>
  87. <server>
  88. http
  89. </server>
  90. <tool>
  91. libauthretry
  92. </tool>
  93. <name>
  94. HTTP authorization retry (Basic)
  95. </name>
  96. <setenv>
  97. # we force our own host name, in order to make the test machine independent
  98. CURL_GETHOSTNAME=curlhost
  99. # we try to use the LD_PRELOAD hack, if not a debug build
  100. LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
  101. </setenv>
  102. <command>
  103. http://%HOSTIP:%HTTPPORT/2023 basic basic
  104. </command>
  105. <precheck>
  106. chkhostname curlhost
  107. </precheck>
  108. </client>
  109. # Verify data after the test has been "shot"
  110. <verify>
  111. <strip>
  112. ^User-Agent:.*
  113. </strip>
  114. <protocol>
  115. GET /20230100 HTTP/1.1
  116. Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz
  117. Host: %HOSTIP:%HTTPPORT
  118. Accept: */*
  119. GET /20230200 HTTP/1.1
  120. Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
  121. Host: %HOSTIP:%HTTPPORT
  122. Accept: */*
  123. GET /20230300 HTTP/1.1
  124. Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz
  125. Host: %HOSTIP:%HTTPPORT
  126. Accept: */*
  127. GET /20230400 HTTP/1.1
  128. Authorization: Basic dGVzdHVzZXI6d3JvbmdwYXNz
  129. Host: %HOSTIP:%HTTPPORT
  130. Accept: */*
  131. GET /20230500 HTTP/1.1
  132. Authorization: Basic dGVzdHVzZXI6dGVzdHBhc3M=
  133. Host: %HOSTIP:%HTTPPORT
  134. Accept: */*
  135. </protocol>
  136. </verify>
  137. </testcase>