test650 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP POST
  6. FORM
  7. </keywords>
  8. </info>
  9. #
  10. # Server-side
  11. <reply>
  12. <data nocheck="yes">
  13. HTTP/1.1 301 OK
  14. Date: Tue, 09 Nov 2010 14:49:00 GMT
  15. Server: test-server/fake swsclose
  16. Connection: close
  17. Content-Type: text/html
  18. Location: /%TESTNUMBER0002
  19. hello
  20. </data>
  21. <data2 crlf="yes">
  22. HTTP/1.1 200 OK
  23. Date: Tue, 09 Nov 2010 14:49:00 GMT
  24. Server: test-server/fake
  25. Content-Length: 6
  26. Connection: close
  27. Content-Type: text/html
  28. -foo-
  29. </data2>
  30. </reply>
  31. # Client-side
  32. <client>
  33. <features>
  34. form-api
  35. </features>
  36. <server>
  37. http
  38. </server>
  39. # tool is what to use instead of 'curl'
  40. <tool>
  41. lib%TESTNUMBER
  42. </tool>
  43. <name>
  44. HTTP formpost using form API - with redirect and re-POST
  45. </name>
  46. <stdin>
  47. Some data from stdin
  48. </stdin>
  49. <command>
  50. http://%HOSTIP:%HTTPPORT/%TESTNUMBER %LOGDIR/test%TESTNUMBER.filedata
  51. </command>
  52. <file name="%LOGDIR/test%TESTNUMBER.filedata">
  53. This is data from a file.
  54. </file>
  55. </client>
  56. #
  57. # Verify data bbter the test has been "shot"
  58. <verify>
  59. <strippart>
  60. s/^--------------------------[A-Za-z0-9]*/------------------------------/
  61. s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
  62. </strippart>
  63. # Note that the stripping above removes 12 bytes from every occurrence of the
  64. # boundary string and since 5 of them are in the body contents, we see
  65. # (5*12) == 60 bytes less
  66. <protocol>
  67. POST /%TESTNUMBER HTTP/1.1
  68. Host: %HOSTIP:%HTTPPORT
  69. Accept: */*
  70. Transfer-Encoding: chunked
  71. Content-Type: multipart/form-data; boundary=----------------------------
  72. Expect: 100-continue
  73. 385
  74. ------------------------------
  75. Content-Disposition: form-data; name="fieldname"
  76. Content-Type: text/plain
  77. X-customheader-1: Header 1 data
  78. X-customheader-2: Header 2 data
  79. this is what we post to the silly web server
  80. ------------------------------
  81. Content-Disposition: form-data; name="fieldnam"
  82. uhis is what we post to the silly web serve
  83. ------------------------------
  84. Content-Disposition: form-data; name="multifile"
  85. Content-Type: multipart/mixed; boundary=----------------------------
  86. ------------------------------
  87. Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
  88. Content-Type: application/octet-stream
  89. This is data from a file.
  90. ------------------------------
  91. Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
  92. Content-Type: text/whatever
  93. %if hyper
  94. AB
  95. %else
  96. ab
  97. %endif
  98. This is data from a file.
  99. ------------------------------
  100. Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
  101. Content-Type: text/whatever
  102. %if hyper
  103. BB
  104. %else
  105. bb
  106. %endif
  107. This is data from a file.
  108. --------------------------------
  109. ------------------------------
  110. Content-Disposition: form-data; name="filecontents"
  111. %if hyper
  112. 11B
  113. %else
  114. 11b
  115. %endif
  116. This is data from a file.
  117. ------------------------------
  118. Content-Disposition: form-data; name="formlength"
  119. 1433
  120. ------------------------------
  121. Content-Disposition: form-data; name="standardinput"
  122. Content-Type: application/octet-stream
  123. 16
  124. Some data from stdin
  125. 36
  126. --------------------------------
  127. 0
  128. POST /%TESTNUMBER0002 HTTP/1.1
  129. Host: %HOSTIP:%HTTPPORT
  130. Accept: */*
  131. Transfer-Encoding: chunked
  132. Content-Type: multipart/form-data; boundary=----------------------------
  133. Expect: 100-continue
  134. 385
  135. ------------------------------
  136. Content-Disposition: form-data; name="fieldname"
  137. Content-Type: text/plain
  138. X-customheader-1: Header 1 data
  139. X-customheader-2: Header 2 data
  140. this is what we post to the silly web server
  141. ------------------------------
  142. Content-Disposition: form-data; name="fieldnam"
  143. uhis is what we post to the silly web serve
  144. ------------------------------
  145. Content-Disposition: form-data; name="multifile"
  146. Content-Type: multipart/mixed; boundary=----------------------------
  147. ------------------------------
  148. Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
  149. Content-Type: application/octet-stream
  150. This is data from a file.
  151. ------------------------------
  152. Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
  153. Content-Type: text/whatever
  154. %if hyper
  155. AB
  156. %else
  157. ab
  158. %endif
  159. This is data from a file.
  160. ------------------------------
  161. Content-Disposition: attachment; filename="test%TESTNUMBER.filedata"
  162. Content-Type: text/whatever
  163. %if hyper
  164. BB
  165. %else
  166. bb
  167. %endif
  168. This is data from a file.
  169. --------------------------------
  170. ------------------------------
  171. Content-Disposition: form-data; name="filecontents"
  172. %if hyper
  173. 11B
  174. %else
  175. 11b
  176. %endif
  177. This is data from a file.
  178. ------------------------------
  179. Content-Disposition: form-data; name="formlength"
  180. 1433
  181. ------------------------------
  182. Content-Disposition: form-data; name="standardinput"
  183. Content-Type: application/octet-stream
  184. 16
  185. Some data from stdin
  186. 36
  187. --------------------------------
  188. 0
  189. </protocol>
  190. </verify>
  191. </testcase>