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