test31 7.8 KB

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