test8 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 log/heads%TESTNUMBER.txt
  27. </command>
  28. # We create this file before the command is invoked!
  29. <file name="log/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. </file>
  47. <precheck>
  48. perl -e 'if ("%HOSTIP" !~ /\.0\.0\.1$/) {print "Test only works for HOSTIPs ending with .0.0.1"; exit(1)}'
  49. </precheck>
  50. </client>
  51. # Verify data after the test has been "shot"
  52. <verify>
  53. <protocol>
  54. GET /we/want/%TESTNUMBER HTTP/1.1
  55. Host: %HOSTIP:%HTTPPORT
  56. User-Agent: curl/%VERSION
  57. Accept: */*
  58. Cookie: name with space=is weird but; trailingspace=removed; cookie=perhaps; cookie=yes; foobar=name; blexp=yesyes
  59. </protocol>
  60. </verify>
  61. </testcase>