test1053 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. <features>
  47. Mime
  48. </features>
  49. <server>
  50. http
  51. </server>
  52. <name>
  53. HTTP RFC1867-type formposting from file with Location: following
  54. </name>
  55. <command>
  56. http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -L -F name=daniel -F tool=curl -F file=@%LOGDIR/test%TESTNUMBER.txt
  57. </command>
  58. # We create this file before the command is invoked!
  59. <file name="%LOGDIR/test%TESTNUMBER.txt">
  60. foo-
  61. This is a moo-
  62. bar
  63. </file>
  64. </client>
  65. # Verify data after the test has been "shot"
  66. <verify>
  67. <strip>
  68. ^(Content-Type: multipart/form-data;|------------).*
  69. </strip>
  70. <protocol>
  71. POST /we/want/%TESTNUMBER HTTP/1.1
  72. Host: %HOSTIP:%HTTPPORT
  73. User-Agent: curl/%VERSION
  74. Accept: */*
  75. Content-Length: 434
  76. Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
  77. ------------------------------9ef8d6205763
  78. Content-Disposition: form-data; name="name"
  79. daniel
  80. ------------------------------9ef8d6205763
  81. Content-Disposition: form-data; name="tool"
  82. curl
  83. ------------------------------9ef8d6205763
  84. Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"
  85. Content-Type: text/plain
  86. foo-
  87. This is a moo-
  88. bar
  89. ------------------------------9ef8d6205763--
  90. POST /we/want/data/%TESTNUMBER0002.txt?coolsite=yes HTTP/1.1
  91. Host: %HOSTIP:%HTTPPORT
  92. User-Agent: curl/%VERSION
  93. Accept: */*
  94. Content-Length: 434
  95. Content-Type: multipart/form-data; boundary=----------------------------9ef8d6205763
  96. ------------------------------9ef8d6205763
  97. Content-Disposition: form-data; name="name"
  98. daniel
  99. ------------------------------9ef8d6205763
  100. Content-Disposition: form-data; name="tool"
  101. curl
  102. ------------------------------9ef8d6205763
  103. Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER.txt"
  104. Content-Type: text/plain
  105. foo-
  106. This is a moo-
  107. bar
  108. ------------------------------9ef8d6205763--
  109. </protocol>
  110. </verify>
  111. </testcase>