2
0

test1133 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/data contains ',', ';', '"'
  25. </name>
  26. <command>
  27. http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -F "file=@\"log/test%TESTNUMBER,and;.txt\";type=mo/foo;filename=\"faker,and;.txt\"" -F 'file2=@"log/test%TESTNUMBER,and;.txt"' -F 'file3=@"log/test%TESTNUMBER,and;.txt";type=m/f,"log/test%TESTNUMBER,and;.txt"' -F a="{\"field1\":\"value1\",\"field2\":\"value2\"}" -F 'b=" \\value1;type=\"whatever\" "; type=text/foo; charset=utf-8 ; filename=param_b'
  28. </command>
  29. # We create this file before the command is invoked!
  30. <file name="log/test%TESTNUMBER,and;.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;|Content-Type: multipart/mixed; boundary=|-------).*
  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: 1264
  48. Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32
  49. ------------------------------24e78000bd32
  50. Content-Disposition: form-data; name="file"; filename="faker,and;.txt"
  51. Content-Type: mo/foo
  52. foo bar
  53. This is a bar foo
  54. bar
  55. foo
  56. ------------------------------24e78000bd32
  57. Content-Disposition: form-data; name="file2"; filename="test%TESTNUMBER,and;.txt"
  58. Content-Type: text/plain
  59. foo bar
  60. This is a bar foo
  61. bar
  62. foo
  63. ------------------------------24e78000bd32
  64. Content-Disposition: form-data; name="file3"
  65. Content-Type: multipart/mixed; boundary=----------------------------7f0e85a48b0b
  66. Content-Disposition: attachment; filename="test%TESTNUMBER,and;.txt"
  67. Content-Type: m/f
  68. foo bar
  69. This is a bar foo
  70. bar
  71. foo
  72. Content-Disposition: attachment; filename="test%TESTNUMBER,and;.txt"
  73. Content-Type: text/plain
  74. foo bar
  75. This is a bar foo
  76. bar
  77. foo
  78. Content-Disposition: form-data; name="a"
  79. {"field1":"value1","field2":"value2"}
  80. Content-Disposition: form-data; name="b"; filename="param_b"
  81. Content-Type: text/foo; charset=utf-8
  82. \value1;type="whatever"
  83. ------------------------------24e78000bd32--
  84. </protocol>
  85. </verify>
  86. </testcase>