test31 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <testcase>
  2. <info>
  3. <keywords>
  4. HTTP
  5. HTTP GET
  6. cookies
  7. cookiejar
  8. </keywords>
  9. </info>
  10. # Server-side
  11. #
  12. # The cookies set come in two versions. This is because when curl is built
  13. # with Hyper, the API provides the headers already "sanitized" so we cannot
  14. # compapare with the exact server contents unlesss it too sends the data
  15. # "clean".
  16. <reply>
  17. <data>
  18. HTTP/1.1 200 OK
  19. Date: Tue, 09 Nov 2010 14:49:00 GMT
  20. Server: test-server/fake
  21. Content-Length: 4
  22. Content-Type: text/html
  23. Funny-head: yesyes
  24. %if !hyper
  25. Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
  26. Set-Cookie:ismatch=this ; domain=test31.curl; path=/silly/
  27. Set-Cookie: overwrite=this ; domain=test31.curl; path=/overwrite/
  28. Set-Cookie: overwrite=this2 ; domain=test31.curl; path=/overwrite
  29. Set-Cookie: sec1value=secure1 ; domain=test31.curl; path=/secure1/ ; secure
  30. Set-Cookie: sec2value=secure2 ; domain=test31.curl; path=/secure2/ ; secure=
  31. Set-Cookie: sec3value=secure3 ; domain=test31.curl; path=/secure3/ ; secure=
  32. Set-Cookie: sec4value=secure4 ; secure=; domain=test31.curl; path=/secure4/ ;
  33. Set-Cookie: sec5value=secure5 ; secure; domain=test31.curl; path=/secure5/ ;
  34. Set-Cookie: sec6value=secure6 ; secure ; domain=test31.curl; path=/secure6/ ;
  35. Set-Cookie: sec7value=secure7 ; secure ; domain=test31.curl; path=/secure7/ ;
  36. Set-Cookie: sec8value=secure8 ; secure= ; domain=test31.curl; path=/secure8/ ;
  37. Set-Cookie: secure=very1 ; secure=; domain=test31.curl; path=/secure9/;
  38. Set-Cookie: httpo1=value1 ; domain=test31.curl; path=/p1/; httponly
  39. Set-Cookie: httpo2=value2 ; domain=test31.curl; path=/p2/; httponly=
  40. Set-Cookie: httpo3=value3 ; httponly; domain=test31.curl; path=/p3/;
  41. Set-Cookie: httpo4=value4 ; httponly=; domain=test31.curl; path=/p4/;
  42. Set-Cookie: httponly=myvalue1 ; domain=test31.curl; path=/p4/; httponly
  43. Set-Cookie: httpandsec=myvalue2 ; domain=test31.curl; path=/p4/; httponly; secure
  44. Set-Cookie: httpandsec2=myvalue3; domain=test31.curl; path=/p4/; httponly=; secure
  45. Set-Cookie: httpandsec3=myvalue4 ; domain=test31.curl; path=/p4/; httponly; secure=
  46. Set-Cookie: httpandsec4=myvalue5 ; domain=test31.curl; path=/p4/; httponly=; secure=
  47. Set-Cookie: httpandsec5=myvalue6 ; domain=test31.curl; path=/p4/; secure; httponly=
  48. Set-Cookie: httpandsec6=myvalue7 ; domain=test31.curl; path=/p4/; secure=; httponly=
  49. Set-Cookie: httpandsec7=myvalue8 ; domain=test31.curl; path=/p4/; secure; httponly
  50. Set-Cookie: httpandsec8=myvalue9; domain=test31.curl; path=/p4/; secure=; httponly
  51. Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
  52. Set-Cookie:eat=this; domain=moo.foo.moo;
  53. Set-Cookie: eat=this-too; domain=.foo.moo;
  54. Set-Cookie: nodomainnovalue
  55. Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
  56. Set-Cookie: novalue; domain=reallysilly
  57. Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
  58. Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
  59. Set-Cookie: magic=yessir; path=/silly/; HttpOnly
  60. Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
  61. Set-Cookie: partialip=nono; domain=.0.0.1;
  62. Set-Cookie: withspaces= yes within and around ;
  63. Set-Cookie: withspaces2 =before equals;
  64. Set-Cookie: prespace= yes before;
  65. Set-Cookie: securewithspace=after ; secure =
  66. %else
  67. Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
  68. Set-Cookie: ismatch=this ; domain=test31.curl; path=/silly/
  69. Set-Cookie: overwrite=this ; domain=test31.curl; path=/overwrite/
  70. Set-Cookie: overwrite=this2 ; domain=test31.curl; path=/overwrite
  71. Set-Cookie: sec1value=secure1 ; domain=test31.curl; path=/secure1/ ; secure
  72. Set-Cookie: sec2value=secure2 ; domain=test31.curl; path=/secure2/ ; secure=
  73. Set-Cookie: sec3value=secure3 ; domain=test31.curl; path=/secure3/ ; secure=
  74. Set-Cookie: sec4value=secure4 ; secure=; domain=test31.curl; path=/secure4/ ;
  75. Set-Cookie: sec5value=secure5 ; secure; domain=test31.curl; path=/secure5/ ;
  76. Set-Cookie: sec6value=secure6 ; secure ; domain=test31.curl; path=/secure6/ ;
  77. Set-Cookie: sec7value=secure7 ; secure ; domain=test31.curl; path=/secure7/ ;
  78. Set-Cookie: sec8value=secure8 ; secure= ; domain=test31.curl; path=/secure8/ ;
  79. Set-Cookie: secure=very1 ; secure=; domain=test31.curl; path=/secure9/;
  80. Set-Cookie: httpo1=value1 ; domain=test31.curl; path=/p1/; httponly
  81. Set-Cookie: httpo2=value2 ; domain=test31.curl; path=/p2/; httponly=
  82. Set-Cookie: httpo3=value3 ; httponly; domain=test31.curl; path=/p3/;
  83. Set-Cookie: httpo4=value4 ; httponly=; domain=test31.curl; path=/p4/;
  84. Set-Cookie: httponly=myvalue1 ; domain=test31.curl; path=/p4/; httponly
  85. Set-Cookie: httpandsec=myvalue2 ; domain=test31.curl; path=/p4/; httponly; secure
  86. Set-Cookie: httpandsec2=myvalue3; domain=test31.curl; path=/p4/; httponly=; secure
  87. Set-Cookie: httpandsec3=myvalue4 ; domain=test31.curl; path=/p4/; httponly; secure=
  88. Set-Cookie: httpandsec4=myvalue5 ; domain=test31.curl; path=/p4/; httponly=; secure=
  89. Set-Cookie: httpandsec5=myvalue6 ; domain=test31.curl; path=/p4/; secure; httponly=
  90. Set-Cookie: httpandsec6=myvalue7 ; domain=test31.curl; path=/p4/; secure=; httponly=
  91. Set-Cookie: httpandsec7=myvalue8 ; domain=test31.curl; path=/p4/; secure; httponly
  92. Set-Cookie: httpandsec8=myvalue9; domain=test31.curl; path=/p4/; secure=; httponly
  93. Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
  94. Set-Cookie: eat=this; domain=moo.foo.moo;
  95. Set-Cookie: eat=this-too; domain=.foo.moo;
  96. Set-Cookie: nodomainnovalue
  97. Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
  98. Set-Cookie: novalue; domain=reallysilly
  99. Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
  100. Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
  101. Set-Cookie: magic=yessir; path=/silly/; HttpOnly
  102. Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
  103. Set-Cookie: partialip=nono; domain=.0.0.1;
  104. Set-Cookie: withspaces= yes within and around ;
  105. Set-Cookie: withspaces2 =before equals;
  106. Set-Cookie: prespace= yes before;
  107. Set-Cookie: securewithspace=after ; secure =
  108. %endif
  109. boo
  110. </data>
  111. </reply>
  112. # Client-side
  113. <client>
  114. <server>
  115. http
  116. </server>
  117. <name>
  118. HTTP with weirdly formatted cookies and cookiejar storage
  119. </name>
  120. # Explicitly set the time zone to a known good one, in case the user is
  121. # using one of the 'right' zones that take into account leap seconds
  122. # which causes the cookie expiry times to be different.
  123. <setenv>
  124. TZ=GMT
  125. </setenv>
  126. <command>
  127. http://test31.curl:%HTTPPORT/we/want/%TESTNUMBER -b none -c log/jar%TESTNUMBER.txt --resolve test31.curl:%HTTPPORT:127.0.0.1
  128. </command>
  129. <precheck>
  130. perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
  131. </precheck>
  132. </client>
  133. # Verify data after the test has been "shot"
  134. <verify>
  135. <protocol>
  136. GET /we/want/%TESTNUMBER HTTP/1.1
  137. Host: test31.curl:%HTTPPORT
  138. User-Agent: curl/%VERSION
  139. Accept: */*
  140. </protocol>
  141. <file name="log/jar%TESTNUMBER.txt" mode="text">
  142. # Netscape HTTP Cookie File
  143. # https://curl.se/docs/http-cookies.html
  144. # This file was generated by libcurl! Edit at your own risk.
  145. test31.curl FALSE /we/want/ FALSE 0 prespace yes before
  146. test31.curl FALSE /we/want/ FALSE 0 withspaces2 before equals
  147. test31.curl FALSE /we/want/ FALSE 0 withspaces yes within and around
  148. .test31.curl TRUE /we/want/ FALSE 0 blexp yesyes
  149. #HttpOnly_test31.curl FALSE /silly/ FALSE 0 magic yessir
  150. test31.curl FALSE /we/want/ FALSE 2118138987 nodomain value
  151. .test31.curl TRUE / FALSE 0 partmatch present
  152. #HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httponly myvalue1
  153. #HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httpo4 value4
  154. #HttpOnly_.test31.curl TRUE /p3/ FALSE 0 httpo3 value3
  155. #HttpOnly_.test31.curl TRUE /p2/ FALSE 0 httpo2 value2
  156. #HttpOnly_.test31.curl TRUE /p1/ FALSE 0 httpo1 value1
  157. .test31.curl TRUE /overwrite FALSE 0 overwrite this2
  158. .test31.curl TRUE /silly/ FALSE 0 ismatch this
  159. </file>
  160. </verify>
  161. </testcase>