test1186 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 filename containing '"'
  28. </name>
  29. <command>
  30. http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER --form-escape -F "file=@\"%LOGDIR/test%TESTNUMBER\\\".txt\";type=mo/foo;filename=\"test%TESTNUMBER\\\".txt\"" -F 'file2=@"%LOGDIR/test%TESTNUMBER\".txt"' -F 'file3=@"%LOGDIR/test%TESTNUMBER\".txt";type=m/f,"%LOGDIR/test%TESTNUMBER\".txt"'
  31. </command>
  32. <precheck>
  33. perl -e "print 'Test requires a system supporting double quotes in file names' if ($^O eq 'msys');"
  34. </precheck>
  35. # We create this file before the command is invoked!
  36. <file name=%LOGDIR/test%TESTNUMBER".txt>
  37. foo bar
  38. This is a bar foo
  39. bar
  40. foo
  41. </file>
  42. </client>
  43. # Verify data after the test has been "shot"
  44. <verify>
  45. <strip>
  46. ^(Content-Type: multipart/form-data;|Content-Type: multipart/mixed; boundary=|-------).*
  47. </strip>
  48. <protocol>
  49. POST /we/want/%TESTNUMBER HTTP/1.1
  50. Host: %HOSTIP:%HTTPPORT
  51. User-Agent: curl/%VERSION
  52. Accept: */*
  53. Content-Length: 1002
  54. Content-Type: multipart/form-data; boundary=----------------------------24e78000bd32
  55. ------------------------------24e78000bd32
  56. Content-Disposition: form-data; name="file"; filename="test%TESTNUMBER\".txt"
  57. Content-Type: mo/foo
  58. foo bar
  59. This is a bar foo
  60. bar
  61. foo
  62. ------------------------------24e78000bd32
  63. Content-Disposition: form-data; name="file2"; filename="test%TESTNUMBER\".txt"
  64. Content-Type: text/plain
  65. foo bar
  66. This is a bar foo
  67. bar
  68. foo
  69. ------------------------------24e78000bd32
  70. Content-Disposition: form-data; name="file3"
  71. Content-Type: multipart/mixed; boundary=----------------------------7f0e85a48b0b
  72. Content-Disposition: attachment; filename="test%TESTNUMBER\".txt"
  73. Content-Type: m/f
  74. foo bar
  75. This is a bar foo
  76. bar
  77. foo
  78. Content-Disposition: attachment; filename="test%TESTNUMBER\".txt"
  79. Content-Type: text/plain
  80. foo bar
  81. This is a bar foo
  82. bar
  83. foo
  84. ------------------------------24e78000bd32--
  85. </protocol>
  86. </verify>
  87. </testcase>