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