test39 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP FORMPOST
  6. </keywords>
  7. </info>
  8. # Server-side
  9. <reply>
  10. <data>
  11. HTTP/1.1 200 OK
  12. Date: Tue, 09 Nov 2010 14:49:00 GMT
  13. Server: test-server/fake
  14. Content-Length: 10
  15. blablabla
  16. </data>
  17. </reply>
  18. # Client-side
  19. <client>
  20. <server>
  21. http
  22. </server>
  23. <name>
  24. HTTP RFC1867-type formposting with filename= and type=
  25. </name>
  26. <command>
  27. http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F name=daniel -F tool=curl --form-string "str1=@literal" --form-string "str2=<verbatim;type=xxx/yyy" -F "file=@log/test%TESTNUMBER.txt;type=moo/foobar;filename=fakerfile" -F file2=@log/test%TESTNUMBER.txt -F "file3=@\"log/test%TESTNUMBER.txt\";type=mo/foo;filename=\"f\\\\\\\\ak\\\\\\er,\\\\an\\d;.t\\\"xt\"" -F 'file4=@"log/test%TESTNUMBER.txt"; filename="A\\AA\"\"\\\"ZZZ"'
  28. </command>
  29. # We create this file before the command is invoked!
  30. <file name="log/test%TESTNUMBER.txt">
  31. foo bar
  32. This is a bar foo
  33. bar
  34. foo
  35. </file>
  36. </client>
  37. # Verify data after the test has been "shot"
  38. <verify>
  39. <strip>
  40. ^(Content-Type: multipart/form-data;|-------).*
  41. </strip>
  42. <protocol>
  43. POST /we/want/%TESTNUMBER HTTP/1.1
  44. Host: %HOSTIP:%HTTPPORT
  45. User-Agent: curl/%VERSION
  46. Accept: */*
  47. Content-Length: 1184
  48. Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32
  49. ------------------------------24e78000bd32
  50. Content-Disposition: form-data; name="name"
  51. daniel
  52. ------------------------------24e78000bd32
  53. Content-Disposition: form-data; name="tool"
  54. curl
  55. ------------------------------24e78000bd32
  56. Content-Disposition: form-data; name="str1"
  57. @literal
  58. ------------------------------24e78000bd32
  59. Content-Disposition: form-data; name="str2"
  60. <verbatim;type=xxx/yyy
  61. ------------------------------24e78000bd32
  62. Content-Disposition: form-data; name="file"; filename="fakerfile"
  63. Content-Type: moo/foobar
  64. foo bar
  65. This is a bar foo
  66. bar
  67. foo
  68. ------------------------------24e78000bd32
  69. Content-Disposition: form-data; name="file2"; filename="test%TESTNUMBER.txt"
  70. Content-Type: text/plain
  71. foo bar
  72. This is a bar foo
  73. bar
  74. foo
  75. ------------------------------24e78000bd32
  76. Content-Disposition: form-data; name="file3"; filename="f\\\\ak\\\\er,\\an\\d;.t\"xt"
  77. Content-Type: mo/foo
  78. foo bar
  79. This is a bar foo
  80. bar
  81. foo
  82. ------------------------------24e78000bd32
  83. Content-Disposition: form-data; name="file4"; filename="A\\AA\"\"\\\"ZZZ"
  84. Content-Type: text/plain
  85. foo bar
  86. This is a bar foo
  87. bar
  88. foo
  89. ------------------------------24e78000bd32--
  90. </protocol>
  91. </verify>
  92. </testcase>