test1189 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. <features>
  21. Mime
  22. </features>
  23. <server>
  24. http
  25. </server>
  26. <name>
  27. Multipart formposting with backslash-escaping of name= and filename=
  28. </name>
  29. <command>
  30. http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --form-escape -F name=daniel -F tool=curl --form-string "str1=@literal" --form-string "str2=<verbatim;type=xxx/yyy" -F "file=@%LOGDIR/test%TESTNUMBER.txt;type=moo/foobar;filename=fakerfile" -F file2=@%LOGDIR/test%TESTNUMBER.txt -F "file3=@\"%LOGDIR/test%TESTNUMBER.txt\";type=mo/foo;filename=\"f\\\\\\\\ak\\\\\\er,\\\\an\\d;.t\\\"xt\"" -F 'file4=@"%LOGDIR/test%TESTNUMBER.txt"; filename="A\\AA\"\"\\\"ZZZ"'
  31. </command>
  32. # We create this file before the command is invoked!
  33. <file name="%LOGDIR/test%TESTNUMBER.txt">
  34. foo bar
  35. This is a bar foo
  36. bar
  37. foo
  38. </file>
  39. </client>
  40. # Verify data after the test has been "shot"
  41. <verify>
  42. <strip>
  43. ^(Content-Type: multipart/form-data;|-------).*
  44. </strip>
  45. <protocol>
  46. POST /we/want/%TESTNUMBER HTTP/1.1
  47. Host: %HOSTIP:%HTTPPORT
  48. User-Agent: curl/%VERSION
  49. Accept: */*
  50. Content-Length: 1240
  51. Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32
  52. ------------------------------24e78000bd32
  53. Content-Disposition: form-data; name="name"
  54. daniel
  55. ------------------------------24e78000bd32
  56. Content-Disposition: form-data; name="tool"
  57. curl
  58. ------------------------------24e78000bd32
  59. Content-Disposition: form-data; name="str1"
  60. @literal
  61. ------------------------------24e78000bd32
  62. Content-Disposition: form-data; name="str2"
  63. <verbatim;type=xxx/yyy
  64. ------------------------------24e78000bd32
  65. Content-Disposition: form-data; name="file"; filename="fakerfile"
  66. Content-Type: moo/foobar
  67. foo bar
  68. This is a bar foo
  69. bar
  70. foo
  71. ------------------------------24e78000bd32
  72. Content-Disposition: form-data; name="file2"; filename="test%TESTNUMBER.txt"
  73. Content-Type: text/plain
  74. foo bar
  75. This is a bar foo
  76. bar
  77. foo
  78. ------------------------------24e78000bd32
  79. Content-Disposition: form-data; name="file3"; filename="f\\\\ak\\\\er,\\an\\d;.t\"xt"
  80. Content-Type: mo/foo
  81. foo bar
  82. This is a bar foo
  83. bar
  84. foo
  85. ------------------------------24e78000bd32
  86. Content-Disposition: form-data; name="file4"; filename="A\\AA\"\"\\\"ZZZ"
  87. Content-Type: text/plain
  88. foo bar
  89. This is a bar foo
  90. bar
  91. foo
  92. ------------------------------24e78000bd32--
  93. </protocol>
  94. </verify>
  95. </testcase>