test554 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP POST
  6. </keywords>
  7. </info>
  8. #
  9. # Server-side
  10. <reply>
  11. <data>
  12. HTTP/1.1 200 OK
  13. Date: Thu, 09 Nov 2010 14:49:00 GMT
  14. Server: test-server/fake swsclose
  15. Connection: close
  16. Content-Type: text/html
  17. hello
  18. </data>
  19. <datacheck>
  20. HTTP/1.1 200 OK
  21. Date: Thu, 09 Nov 2010 14:49:00 GMT
  22. Server: test-server/fake swsclose
  23. Connection: close
  24. Content-Type: text/html
  25. hello
  26. HTTP/1.1 200 OK
  27. Date: Thu, 09 Nov 2010 14:49:00 GMT
  28. Server: test-server/fake swsclose
  29. Connection: close
  30. Content-Type: text/html
  31. hello
  32. </datacheck>
  33. </reply>
  34. # Client-side
  35. <client>
  36. <server>
  37. http
  38. </server>
  39. # tool is what to use instead of 'curl'
  40. <tool>
  41. lib554
  42. </tool>
  43. <name>
  44. HTTP multi-part formpost using read callback for the file part
  45. </name>
  46. <command>
  47. http://%HOSTIP:%HTTPPORT/554
  48. </command>
  49. </client>
  50. #
  51. # Verify data after the test has been "shot"
  52. <verify>
  53. <strippart>
  54. s/^--------------------------[a-z0-9]*/------------------------------/
  55. s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
  56. </strippart>
  57. # Note that the stripping above removes 12 bytes from every occurrence of the
  58. # boundary string and since 5 of them are in the body contents, we see
  59. # (5*12) == 60 bytes less
  60. <protocol>
  61. POST /554 HTTP/1.1
  62. Host: %HOSTIP:%HTTPPORT
  63. Accept: */*
  64. Content-Length: 744
  65. Content-Type: multipart/form-data; boundary=----------------------------
  66. ------------------------------
  67. Content-Disposition: form-data; name="sendfile"; filename="postit2.c"
  68. this is what we post to the silly web server
  69. ------------------------------
  70. Content-Disposition: form-data; name="callbackdata"
  71. this is what we post to the silly web server
  72. ------------------------------
  73. Content-Disposition: form-data; name="filename"
  74. postit2.c
  75. ------------------------------
  76. Content-Disposition: form-data; name="submit"
  77. Content-Type: text/plain
  78. send
  79. ------------------------------
  80. Content-Disposition: form-data; name="somename"; filename="somefile.txt"
  81. Content-Type: text/plain
  82. blah blah
  83. --------------------------------
  84. POST /554 HTTP/1.1
  85. Host: %HOSTIP:%HTTPPORT
  86. Accept: */*
  87. Content-Length: 758
  88. Content-Type: multipart/form-data; boundary=----------------------------
  89. ------------------------------
  90. Content-Disposition: form-data; name="sendfile alternative"; filename="file name 2"
  91. this is what we post to the silly web server
  92. ------------------------------
  93. Content-Disposition: form-data; name="callbackdata"
  94. this is what we post to the silly web server
  95. ------------------------------
  96. Content-Disposition: form-data; name="filename"
  97. postit2.c
  98. ------------------------------
  99. Content-Disposition: form-data; name="submit"
  100. Content-Type: text/plain
  101. send
  102. ------------------------------
  103. Content-Disposition: form-data; name="somename"; filename="somefile.txt"
  104. Content-Type: text/plain
  105. blah blah
  106. --------------------------------
  107. </protocol>
  108. </verify>
  109. </testcase>