test650 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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>
  13. HTTP/1.1 200 OK
  14. Date: Thu, 09 Nov 2010 14:49:00 GMT
  15. Server: test-server/fake swsclose
  16. Connection: close
  17. Content-Type: text/html
  18. hello
  19. </data>
  20. </reply>
  21. # Client-side
  22. <client>
  23. <server>
  24. http
  25. </server>
  26. # tool is what to use instead of 'curl'
  27. <tool>
  28. lib650
  29. </tool>
  30. <name>
  31. HTTP formpost using form API
  32. </name>
  33. <stdin>
  34. Some data from stdin
  35. </stdin>
  36. <command>
  37. http://%HOSTIP:%HTTPPORT/650 log/test650.filedata
  38. </command>
  39. <file name="log/test650.filedata">
  40. This is data from a file.
  41. </file>
  42. </client>
  43. #
  44. # Verify data after the test has been "shot"
  45. <verify>
  46. <strippart>
  47. s/^--------------------------[a-z0-9]*/------------------------------/
  48. s/boundary=------------------------[a-z0-9]*/boundary=----------------------------/
  49. </strippart>
  50. # Note that the stripping above removes 12 bytes from every occurrence of the
  51. # boundary string and since 5 of them are in the body contents, we see
  52. # (5*12) == 60 bytes less
  53. <protocol>
  54. POST /650 HTTP/1.1
  55. Host: %HOSTIP:%HTTPPORT
  56. Accept: */*
  57. Transfer-Encoding: chunked
  58. Content-Type: multipart/form-data; boundary=----------------------------
  59. Expect: 100-continue
  60. 60a
  61. ------------------------------
  62. Content-Disposition: form-data; name="fieldname"
  63. Content-Type: text/plain
  64. X-customheader-1: Header 1 data
  65. X-customheader-2: Header 2 data
  66. this is what we post to the silly web server
  67. ------------------------------
  68. Content-Disposition: form-data; name="fieldnam"
  69. uhis is what we post to the silly web serve
  70. ------------------------------
  71. Content-Disposition: form-data; name="multifile"
  72. Content-Type: multipart/mixed; boundary=----------------------------
  73. ------------------------------
  74. Content-Disposition: attachment; filename="test650.filedata"
  75. Content-Type: application/octet-stream
  76. This is data from a file.
  77. ------------------------------
  78. Content-Disposition: attachment; filename="test650.filedata"
  79. Content-Type: text/whatever
  80. This is data from a file.
  81. ------------------------------
  82. Content-Disposition: attachment; filename="test650.filedata"
  83. Content-Type: text/whatever
  84. This is data from a file.
  85. --------------------------------
  86. ------------------------------
  87. Content-Disposition: form-data; name="filecontents"
  88. This is data from a file.
  89. ------------------------------
  90. Content-Disposition: form-data; name="formlength"
  91. 1367
  92. ------------------------------
  93. Content-Disposition: form-data; name="standardinput"
  94. Content-Type: application/octet-stream
  95. Some data from stdin
  96. --------------------------------
  97. 0
  98. </protocol>
  99. </verify>
  100. </testcase>