test1053 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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/%TESTNUMBER0002.txt?coolsite=yes
  18. Content-Length: 0
  19. Connection: close
  20. </data>
  21. <data2>
  22. HTTP/1.1 200 OK swsclose
  23. Date: Tue, 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/%TESTNUMBER0002.txt?coolsite=yes
  34. Content-Length: 0
  35. Connection: close
  36. HTTP/1.1 200 OK swsclose
  37. Date: Tue, 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/%TESTNUMBER -L -F name=daniel -F tool=curl -F file=@log/test%TESTNUMBER.txt
  54. </command>
  55. # We create this file before the command is invoked!
  56. <file name="log/test%TESTNUMBER.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. ^(Content-Type: multipart/form-data;|------------).*
  66. </strip>
  67. <protocol>
  68. POST /we/want/%TESTNUMBER HTTP/1.1
  69. Host: %HOSTIP:%HTTPPORT
  70. User-Agent: curl/%VERSION
  71. Accept: */*
  72. Content-Length: 410
  73. Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
  74. ------------------------------9ef8d6205763
  75. Content-Disposition: form-data; name="name"
  76. daniel
  77. ------------------------------9ef8d6205763
  78. Content-Disposition: form-data; name="tool"
  79. curl
  80. ------------------------------9ef8d6205763
  81. Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"
  82. Content-Type: text/plain
  83. foo-
  84. This is a moo-
  85. bar
  86. ------------------------------9ef8d6205763--
  87. POST /we/want/data/%TESTNUMBER0002.txt?coolsite=yes HTTP/1.1
  88. Host: %HOSTIP:%HTTPPORT
  89. User-Agent: curl/%VERSION
  90. Accept: */*
  91. Content-Length: 410
  92. Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
  93. ------------------------------9ef8d6205763
  94. Content-Disposition: form-data; name="name"
  95. daniel
  96. ------------------------------9ef8d6205763
  97. Content-Disposition: form-data; name="tool"
  98. curl
  99. ------------------------------9ef8d6205763
  100. Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"
  101. Content-Type: text/plain
  102. foo-
  103. This is a moo-
  104. bar
  105. ------------------------------9ef8d6205763--
  106. </protocol>
  107. </verify>
  108. </testcase>