test1053 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <testcase>
  2. # Based on test 9
  3. <info>
  4. <keywords>
  5. HTTP
  6. HTTP FORMPOST
  7. HTTP file upload
  8. followlocation
  9. </keywords>
  10. </info>
  11. # Server-side
  12. <reply>
  13. <data>
  14. HTTP/1.1 307 Redirect swsclose
  15. Date: Thu, 29 Jul 2008 14:49:00 GMT
  16. Server: test-server/fake
  17. Location: data/10530002.txt?coolsite=yes
  18. Content-Length: 0
  19. Connection: close
  20. </data>
  21. <data2>
  22. HTTP/1.1 200 OK swsclose
  23. Date: Thu, 09 Nov 2010 14:49:00 GMT
  24. Server: test-server/fake
  25. Content-Length: 11
  26. Connection: close
  27. blablabla
  28. </data2>
  29. <datacheck>
  30. HTTP/1.1 307 Redirect swsclose
  31. Date: Thu, 29 Jul 2008 14:49:00 GMT
  32. Server: test-server/fake
  33. Location: data/10530002.txt?coolsite=yes
  34. Content-Length: 0
  35. Connection: close
  36. HTTP/1.1 200 OK swsclose
  37. Date: Thu, 09 Nov 2010 14:49:00 GMT
  38. Server: test-server/fake
  39. Content-Length: 11
  40. Connection: close
  41. blablabla
  42. </datacheck>
  43. </reply>
  44. # Client-side
  45. <client>
  46. <server>
  47. http
  48. </server>
  49. <name>
  50. HTTP RFC1867-type formposting from file with Location: following
  51. </name>
  52. <command>
  53. http://%HOSTIP:%HTTPPORT/we/want/1053 -L -F name=daniel -F tool=curl -F file=@log/test1053.txt
  54. </command>
  55. # We create this file before the command is invoked!
  56. <file name="log/test1053.txt">
  57. foo-
  58. This is a moo-
  59. bar
  60. </file>
  61. </client>
  62. # Verify data after the test has been "shot"
  63. <verify>
  64. <strip>
  65. ^(User-Agent:|Content-Type: multipart/form-data;|------------).*
  66. </strip>
  67. <protocol>
  68. POST /we/want/1053 HTTP/1.1
  69. User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
  70. Host: %HOSTIP:%HTTPPORT
  71. Accept: */*
  72. Content-Length: 410
  73. Expect: 100-continue
  74. Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
  75. ------------------------------9ef8d6205763
  76. Content-Disposition: form-data; name="name"
  77. daniel
  78. ------------------------------9ef8d6205763
  79. Content-Disposition: form-data; name="tool"
  80. curl
  81. ------------------------------9ef8d6205763
  82. Content-Disposition: form-data; name="file"; filename="test1053.txt"
  83. Content-Type: text/plain
  84. foo-
  85. This is a moo-
  86. bar
  87. ------------------------------9ef8d6205763--
  88. POST /we/want/data/10530002.txt?coolsite=yes HTTP/1.1
  89. User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.7a ipv6 zlib/1.1.4
  90. Host: %HOSTIP:%HTTPPORT
  91. Accept: */*
  92. Content-Length: 410
  93. Expect: 100-continue
  94. Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
  95. ------------------------------9ef8d6205763
  96. Content-Disposition: form-data; name="name"
  97. daniel
  98. ------------------------------9ef8d6205763
  99. Content-Disposition: form-data; name="tool"
  100. curl
  101. ------------------------------9ef8d6205763
  102. Content-Disposition: form-data; name="file"; filename="test1053.txt"
  103. Content-Type: text/plain
  104. foo-
  105. This is a moo-
  106. bar
  107. ------------------------------9ef8d6205763--
  108. </protocol>
  109. </verify>
  110. </testcase>