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