test8 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP GET
  6. cookies
  7. </keywords>
  8. </info>
  9. # Server-side
  10. <reply>
  11. <data>
  12. HTTP/1.1 200 OK swsclose
  13. Date: Tue, 09 Nov 2010 14:49:00 GMT
  14. Server: test-server/fake
  15. </data>
  16. </reply>
  17. # Client-side
  18. <client>
  19. <server>
  20. http
  21. </server>
  22. <name>
  23. HTTP with cookie parsing from header file
  24. </name>
  25. <command>
  26. http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -b %LOGDIR/heads%TESTNUMBER.txt
  27. </command>
  28. # We create this file before the command is invoked!
  29. <file name="%LOGDIR/heads%TESTNUMBER.txt">
  30. HTTP/1.1 200 OK
  31. Date: Tue, 09 Nov 2010 14:49:00 GMT
  32. Server: test-server/fake
  33. Content-Type: text/html
  34. Funny-head: yesyes
  35. Set-Cookie: foobar=name; domain=%HOSTIP; path=/;
  36. Set-Cookie: mismatch=this; domain=%HOSTIP; path="/silly/";
  37. Set-Cookie: partmatch=present; domain=.0.0.1; path=/w;
  38. Set-Cookie: duplicate=test; domain=.0.0.1; domain=.0.0.1; path=/donkey;
  39. Set-Cookie: cookie=yes; path=/we;
  40. Set-Cookie: cookie=perhaps; path=/we/want;
  41. Set-Cookie: name with space=is weird but; path=/we/want;
  42. Set-Cookie: trailingspace = removed; path=/we/want;
  43. Set-Cookie: nocookie=yes; path=/WE;
  44. Set-Cookie: blexp=yesyes; domain=%HOSTIP; domain=%HOSTIP; expiry=totally bad;
  45. Set-Cookie: partialip=nono; domain=.0.0.1;
  46. Set-Cookie: cookie1=%hex[%01-junk]hex%
  47. Set-Cookie: cookie2=%hex[%02-junk]hex%
  48. Set-Cookie: cookie3=%hex[%03-junk]hex%
  49. Set-Cookie: cookie4=%hex[%04-junk]hex%
  50. Set-Cookie: cookie5=%hex[%05-junk]hex%
  51. Set-Cookie: cookie6=%hex[%06-junk]hex%
  52. Set-Cookie: cookie7=%hex[%07-junk]hex%
  53. Set-Cookie: cookie8=%hex[%08-junk]hex%
  54. Set-Cookie: cookie9=%hex[junk--%09]hex%
  55. Set-Cookie: cookie11=%hex[%0b-junk]hex%
  56. Set-Cookie: cookie12=%hex[%0c-junk]hex%
  57. Set-Cookie: cookie14=%hex[%0e-junk]hex%
  58. Set-Cookie: cookie15=%hex[%0f-junk]hex%
  59. Set-Cookie: cookie16=%hex[%10-junk]hex%
  60. Set-Cookie: cookie17=%hex[%11-junk]hex%
  61. Set-Cookie: cookie18=%hex[%12-junk]hex%
  62. Set-Cookie: cookie19=%hex[%13-junk]hex%
  63. Set-Cookie: cookie20=%hex[%14-junk]hex%
  64. Set-Cookie: cookie21=%hex[%15-junk]hex%
  65. Set-Cookie: cookie22=%hex[%16-junk]hex%
  66. Set-Cookie: cookie23=%hex[%17-junk]hex%
  67. Set-Cookie: cookie24=%hex[%18-junk]hex%
  68. Set-Cookie: cookie25=%hex[%19-junk]hex%
  69. Set-Cookie: cookie26=%hex[%1a-junk]hex%
  70. Set-Cookie: cookie27=%hex[%1b-junk]hex%
  71. Set-Cookie: cookie28=%hex[%1c-junk]hex%
  72. Set-Cookie: cookie29=%hex[%1d-junk]hex%
  73. Set-Cookie: cookie30=%hex[%1e-junk]hex%
  74. Set-Cookie: cookie31=%hex[%1f-junk]hex%
  75. Set-Cookie: cookie31=%hex[%7f-junk]hex%
  76. </file>
  77. <precheck>
  78. perl -e 'if ("%HOSTIP" !~ /\.0\.0\.1$/) {print "Test only works for HOSTIPs ending with .0.0.1"; exit(1)}'
  79. </precheck>
  80. <features>
  81. cookies
  82. </features>
  83. </client>
  84. # Verify data after the test has been "shot"
  85. <verify>
  86. <protocol>
  87. GET /we/want/%TESTNUMBER HTTP/1.1
  88. Host: %HOSTIP:%HTTPPORT
  89. User-Agent: curl/%VERSION
  90. Accept: */*
  91. Cookie: name with space=is weird but; trailingspace=removed; cookie=perhaps; cookie=yes; foobar=name; blexp=yesyes; cookie9=junk--
  92. </protocol>
  93. </verify>
  94. </testcase>