test31 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. # compare with the exact server contents unless 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. Set-Cookie: blankdomain=sure; domain=; path=/
  25. %if !hyper
  26. Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
  27. Set-Cookie:ismatch=this ; domain=test31.curl; path=/silly/
  28. Set-Cookie: overwrite=this ; domain=test31.curl; path=/overwrite/
  29. Set-Cookie: overwrite=this2 ; domain=test31.curl; path=/overwrite
  30. Set-Cookie: sec1value=secure1 ; domain=test31.curl; path=/secure1/ ; secure
  31. Set-Cookie: sec2value=secure2 ; domain=test31.curl; path=/secure2/ ; secure=
  32. Set-Cookie: sec3value=secure3 ; domain=test31.curl; path=/secure3/ ; secure=
  33. Set-Cookie: sec4value=secure4 ; secure=; domain=test31.curl; path=/secure4/ ;
  34. Set-Cookie: sec5value=secure5 ; secure; domain=test31.curl; path=/secure5/ ;
  35. Set-Cookie: sec6value=secure6 ; secure ; domain=test31.curl; path=/secure6/ ;
  36. Set-Cookie: sec7value=secure7 ; secure ; domain=test31.curl; path=/secure7/ ;
  37. Set-Cookie: sec8value=secure8 ; secure= ; domain=test31.curl; path=/secure8/ ;
  38. Set-Cookie: secure=very1 ; secure=; domain=test31.curl; path=/secure9/;
  39. Set-Cookie: httpo1=value1 ; domain=test31.curl; path=/p1/; httponly
  40. Set-Cookie: httpo2=value2 ; domain=test31.curl; path=/p2/; httponly=
  41. Set-Cookie: httpo3=value3 ; httponly; domain=test31.curl; path=/p3/;
  42. Set-Cookie: httpo4=value4 ; httponly=; domain=test31.curl; path=/p4/;
  43. Set-Cookie: httponly=myvalue1 ; domain=test31.curl; path=/p4/; httponly
  44. Set-Cookie: httpandsec=myvalue2 ; domain=test31.curl; path=/p4/; httponly; secure
  45. Set-Cookie: httpandsec2=myvalue3; domain=test31.curl; path=/p4/; httponly=; secure
  46. Set-Cookie: httpandsec3=myvalue4 ; domain=test31.curl; path=/p4/; httponly; secure=
  47. Set-Cookie: httpandsec4=myvalue5 ; domain=test31.curl; path=/p4/; httponly=; secure=
  48. Set-Cookie: httpandsec5=myvalue6 ; domain=test31.curl; path=/p4/; secure; httponly=
  49. Set-Cookie: httpandsec6=myvalue7 ; domain=test31.curl; path=/p4/; secure=; httponly=
  50. Set-Cookie: httpandsec7=myvalue8 ; domain=test31.curl; path=/p4/; secure; httponly
  51. Set-Cookie: httpandsec8=myvalue9; domain=test31.curl; path=/p4/; secure=; httponly
  52. Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
  53. Set-Cookie:eat=this; domain=moo.foo.moo;
  54. Set-Cookie: eat=this-too; domain=.foo.moo;
  55. Set-Cookie: nodomainnovalue
  56. %if large-time
  57. Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2525
  58. Set-Cookie: novalue; domain=reallysilly
  59. Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2525
  60. Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2525
  61. %else
  62. Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
  63. Set-Cookie: novalue; domain=reallysilly
  64. Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
  65. Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
  66. %endif
  67. Set-Cookie: magic=yessir; path=/silly/; HttpOnly
  68. Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
  69. Set-Cookie: partialip=nono; domain=.0.0.1;
  70. Set-Cookie: withspaces= yes within and around ;
  71. Set-Cookie: withspaces2 =before equals;
  72. Set-Cookie: prespace= yes before;
  73. Set-Cookie: securewithspace=after ; secure =
  74. %else
  75. Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
  76. Set-Cookie: ismatch=this ; domain=test31.curl; path=/silly/
  77. Set-Cookie: overwrite=this ; domain=test31.curl; path=/overwrite/
  78. Set-Cookie: overwrite=this2 ; domain=test31.curl; path=/overwrite
  79. Set-Cookie: sec1value=secure1 ; domain=test31.curl; path=/secure1/ ; secure
  80. Set-Cookie: sec2value=secure2 ; domain=test31.curl; path=/secure2/ ; secure=
  81. Set-Cookie: sec3value=secure3 ; domain=test31.curl; path=/secure3/ ; secure=
  82. Set-Cookie: sec4value=secure4 ; secure=; domain=test31.curl; path=/secure4/ ;
  83. Set-Cookie: sec5value=secure5 ; secure; domain=test31.curl; path=/secure5/ ;
  84. Set-Cookie: sec6value=secure6 ; secure ; domain=test31.curl; path=/secure6/ ;
  85. Set-Cookie: sec7value=secure7 ; secure ; domain=test31.curl; path=/secure7/ ;
  86. Set-Cookie: sec8value=secure8 ; secure= ; domain=test31.curl; path=/secure8/ ;
  87. Set-Cookie: secure=very1 ; secure=; domain=test31.curl; path=/secure9/;
  88. Set-Cookie: httpo1=value1 ; domain=test31.curl; path=/p1/; httponly
  89. Set-Cookie: httpo2=value2 ; domain=test31.curl; path=/p2/; httponly=
  90. Set-Cookie: httpo3=value3 ; httponly; domain=test31.curl; path=/p3/;
  91. Set-Cookie: httpo4=value4 ; httponly=; domain=test31.curl; path=/p4/;
  92. Set-Cookie: httponly=myvalue1 ; domain=test31.curl; path=/p4/; httponly
  93. Set-Cookie: httpandsec=myvalue2 ; domain=test31.curl; path=/p4/; httponly; secure
  94. Set-Cookie: httpandsec2=myvalue3; domain=test31.curl; path=/p4/; httponly=; secure
  95. Set-Cookie: httpandsec3=myvalue4 ; domain=test31.curl; path=/p4/; httponly; secure=
  96. Set-Cookie: httpandsec4=myvalue5 ; domain=test31.curl; path=/p4/; httponly=; secure=
  97. Set-Cookie: httpandsec5=myvalue6 ; domain=test31.curl; path=/p4/; secure; httponly=
  98. Set-Cookie: httpandsec6=myvalue7 ; domain=test31.curl; path=/p4/; secure=; httponly=
  99. Set-Cookie: httpandsec7=myvalue8 ; domain=test31.curl; path=/p4/; secure; httponly
  100. Set-Cookie: httpandsec8=myvalue9; domain=test31.curl; path=/p4/; secure=; httponly
  101. Set-Cookie: partmatch=present; domain=test31.curl ; path=/;
  102. Set-Cookie: eat=this; domain=moo.foo.moo;
  103. Set-Cookie: eat=this-too; domain=.foo.moo;
  104. Set-Cookie: nodomainnovalue
  105. %if large-time
  106. Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2525
  107. Set-Cookie: novalue; domain=reallysilly
  108. Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2525
  109. Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2525
  110. %else
  111. Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
  112. Set-Cookie: novalue; domain=reallysilly
  113. Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
  114. Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
  115. %endif
  116. Set-Cookie: magic=yessir; path=/silly/; HttpOnly
  117. Set-Cookie: blexp=yesyes; domain=test31.curl; domain=test31.curl; expiry=totally bad;
  118. Set-Cookie: partialip=nono; domain=.0.0.1;
  119. Set-Cookie: withspaces= yes within and around ;
  120. Set-Cookie: withspaces2 =before equals;
  121. Set-Cookie: prespace= yes before;
  122. Set-Cookie: securewithspace=after ; secure =
  123. %endif
  124. boo
  125. </data>
  126. </reply>
  127. # Client-side
  128. <client>
  129. <server>
  130. http
  131. </server>
  132. <name>
  133. HTTP with weirdly formatted cookies and cookiejar storage
  134. </name>
  135. # Explicitly set the time zone to a known good one, in case the user is
  136. # using one of the 'right' zones that take into account leap seconds
  137. # which causes the cookie expiry times to be different.
  138. <setenv>
  139. TZ=GMT
  140. </setenv>
  141. <command>
  142. http://test31.curl:%HTTPPORT/we/want/%TESTNUMBER -b none -c %LOGDIR/jar%TESTNUMBER.txt --resolve test31.curl:%HTTPPORT:127.0.0.1
  143. </command>
  144. <precheck>
  145. perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
  146. </precheck>
  147. <features>
  148. cookies
  149. </features>
  150. </client>
  151. # Verify data after the test has been "shot"
  152. <verify>
  153. <protocol>
  154. GET /we/want/%TESTNUMBER HTTP/1.1
  155. Host: test31.curl:%HTTPPORT
  156. User-Agent: curl/%VERSION
  157. Accept: */*
  158. </protocol>
  159. <file name="%LOGDIR/jar%TESTNUMBER.txt" mode="text">
  160. # Netscape HTTP Cookie File
  161. # https://curl.se/docs/http-cookies.html
  162. # This file was generated by libcurl! Edit at your own risk.
  163. test31.curl FALSE /we/want/ FALSE 0 prespace yes before
  164. test31.curl FALSE /we/want/ FALSE 0 withspaces2 before equals
  165. test31.curl FALSE /we/want/ FALSE 0 withspaces yes within and around
  166. .test31.curl TRUE /we/want/ FALSE 0 blexp yesyes
  167. #HttpOnly_test31.curl FALSE /silly/ FALSE 0 magic yessir
  168. %if large-time
  169. test31.curl FALSE /we/want/ FALSE 17517902187 nodomain value
  170. %else
  171. test31.curl FALSE /we/want/ FALSE 2118138987 nodomain value
  172. %endif
  173. .test31.curl TRUE / FALSE 0 partmatch present
  174. #HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httponly myvalue1
  175. #HttpOnly_.test31.curl TRUE /p4/ FALSE 0 httpo4 value4
  176. #HttpOnly_.test31.curl TRUE /p3/ FALSE 0 httpo3 value3
  177. #HttpOnly_.test31.curl TRUE /p2/ FALSE 0 httpo2 value2
  178. #HttpOnly_.test31.curl TRUE /p1/ FALSE 0 httpo1 value1
  179. .test31.curl TRUE /overwrite FALSE 0 overwrite this2
  180. .test31.curl TRUE /silly/ FALSE 0 ismatch this
  181. test31.curl FALSE / FALSE 0 blankdomain sure
  182. </file>
  183. </verify>
  184. </testcase>