2007-01-23 10:25:56 +08:00
|
|
|
<testcase>
|
2005-04-17 07:15:19 +08:00
|
|
|
<info>
|
|
|
|
<keywords>
|
|
|
|
HTTP
|
|
|
|
HTTP GET
|
|
|
|
cookies
|
|
|
|
cookiejar
|
|
|
|
</keywords>
|
|
|
|
</info>
|
2002-02-26 21:09:46 +08:00
|
|
|
# Server-side
|
2020-12-14 21:10:33 +08:00
|
|
|
#
|
|
|
|
# The cookies set come in two versions. This is because when curl is built
|
|
|
|
# with Hyper, the API provides the headers already "sanitized" so we cannot
|
|
|
|
# compapare with the exact server contents unlesss it too sends the data
|
|
|
|
# "clean".
|
|
|
|
|
2002-02-26 21:09:46 +08:00
|
|
|
<reply>
|
|
|
|
<data>
|
|
|
|
HTTP/1.1 200 OK
|
2020-02-28 22:00:03 +08:00
|
|
|
Date: Tue, 09 Nov 2010 14:49:00 GMT
|
2002-02-26 21:09:46 +08:00
|
|
|
Server: test-server/fake
|
2003-07-20 07:57:08 +08:00
|
|
|
Content-Length: 4
|
2002-02-26 21:09:46 +08:00
|
|
|
Content-Type: text/html
|
|
|
|
Funny-head: yesyes
|
2020-12-14 21:10:33 +08:00
|
|
|
%if !hyper
|
2003-05-01 01:16:25 +08:00
|
|
|
Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
|
2002-07-30 06:21:37 +08:00
|
|
|
Set-Cookie:ismatch=this ; domain=127.0.0.1; path=/silly/
|
2013-06-12 17:19:56 +08:00
|
|
|
Set-Cookie: overwrite=this ; domain=127.0.0.1; path=/overwrite/
|
|
|
|
Set-Cookie: overwrite=this2 ; domain=127.0.0.1; path=/overwrite
|
2011-08-09 20:02:05 +08:00
|
|
|
Set-Cookie: sec1value=secure1 ; domain=127.0.0.1; path=/secure1/ ; secure
|
|
|
|
Set-Cookie: sec2value=secure2 ; domain=127.0.0.1; path=/secure2/ ; secure=
|
|
|
|
Set-Cookie: sec3value=secure3 ; domain=127.0.0.1; path=/secure3/ ; secure=
|
2012-11-16 20:54:59 +08:00
|
|
|
Set-Cookie: sec4value=secure4 ; secure=; domain=127.0.0.1; path=/secure4/ ;
|
|
|
|
Set-Cookie: sec5value=secure5 ; secure; domain=127.0.0.1; path=/secure5/ ;
|
|
|
|
Set-Cookie: sec6value=secure6 ; secure ; domain=127.0.0.1; path=/secure6/ ;
|
|
|
|
Set-Cookie: sec7value=secure7 ; secure ; domain=127.0.0.1; path=/secure7/ ;
|
|
|
|
Set-Cookie: sec8value=secure8 ; secure= ; domain=127.0.0.1; path=/secure8/ ;
|
|
|
|
Set-Cookie: secure=very1 ; secure=; domain=127.0.0.1; path=/secure9/;
|
|
|
|
Set-Cookie: httpo1=value1 ; domain=127.0.0.1; path=/p1/; httponly
|
|
|
|
Set-Cookie: httpo2=value2 ; domain=127.0.0.1; path=/p2/; httponly=
|
|
|
|
Set-Cookie: httpo3=value3 ; httponly; domain=127.0.0.1; path=/p3/;
|
|
|
|
Set-Cookie: httpo4=value4 ; httponly=; domain=127.0.0.1; path=/p4/;
|
|
|
|
Set-Cookie: httponly=myvalue1 ; domain=127.0.0.1; path=/p4/; httponly
|
|
|
|
Set-Cookie: httpandsec=myvalue2 ; domain=127.0.0.1; path=/p4/; httponly; secure
|
|
|
|
Set-Cookie: httpandsec2=myvalue3; domain=127.0.0.1; path=/p4/; httponly=; secure
|
|
|
|
Set-Cookie: httpandsec3=myvalue4 ; domain=127.0.0.1; path=/p4/; httponly; secure=
|
|
|
|
Set-Cookie: httpandsec4=myvalue5 ; domain=127.0.0.1; path=/p4/; httponly=; secure=
|
|
|
|
Set-Cookie: httpandsec5=myvalue6 ; domain=127.0.0.1; path=/p4/; secure; httponly=
|
|
|
|
Set-Cookie: httpandsec6=myvalue7 ; domain=127.0.0.1; path=/p4/; secure=; httponly=
|
|
|
|
Set-Cookie: httpandsec7=myvalue8 ; domain=127.0.0.1; path=/p4/; secure; httponly
|
2011-08-09 20:02:05 +08:00
|
|
|
Set-Cookie: httpandsec8=myvalue9; domain=127.0.0.1; path=/p4/; secure=; httponly
|
2002-02-26 21:09:46 +08:00
|
|
|
Set-Cookie: partmatch=present; domain=127.0.0.1 ; path=/;
|
2002-07-30 06:21:37 +08:00
|
|
|
Set-Cookie:eat=this; domain=moo.foo.moo;
|
2002-02-26 21:18:39 +08:00
|
|
|
Set-Cookie: eat=this-too; domain=.foo.moo;
|
2002-02-26 21:09:46 +08:00
|
|
|
Set-Cookie: nodomainnovalue
|
2019-01-07 23:23:04 +08:00
|
|
|
Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
|
2003-05-01 01:16:25 +08:00
|
|
|
Set-Cookie: novalue; domain=reallysilly
|
2007-02-05 10:38:25 +08:00
|
|
|
Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
|
|
|
|
Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
|
2008-01-31 20:21:57 +08:00
|
|
|
Set-Cookie: magic=yessir; path=/silly/; HttpOnly
|
2014-08-20 03:01:28 +08:00
|
|
|
Set-Cookie: blexp=yesyes; domain=127.0.0.1; domain=127.0.0.1; expiry=totally bad;
|
|
|
|
Set-Cookie: partialip=nono; domain=.0.0.1;
|
2015-04-02 05:25:29 +08:00
|
|
|
Set-Cookie: withspaces= yes within and around ;
|
|
|
|
Set-Cookie: withspaces2 =before equals;
|
|
|
|
Set-Cookie: prespace= yes before;
|
|
|
|
Set-Cookie: securewithspace=after ; secure =
|
2020-12-14 21:10:33 +08:00
|
|
|
%else
|
|
|
|
Set-Cookie: foobar=name; domain=anything.com; path=/ ; secure
|
|
|
|
Set-Cookie: ismatch=this ; domain=127.0.0.1; path=/silly/
|
|
|
|
Set-Cookie: overwrite=this ; domain=127.0.0.1; path=/overwrite/
|
|
|
|
Set-Cookie: overwrite=this2 ; domain=127.0.0.1; path=/overwrite
|
|
|
|
Set-Cookie: sec1value=secure1 ; domain=127.0.0.1; path=/secure1/ ; secure
|
|
|
|
Set-Cookie: sec2value=secure2 ; domain=127.0.0.1; path=/secure2/ ; secure=
|
|
|
|
Set-Cookie: sec3value=secure3 ; domain=127.0.0.1; path=/secure3/ ; secure=
|
|
|
|
Set-Cookie: sec4value=secure4 ; secure=; domain=127.0.0.1; path=/secure4/ ;
|
|
|
|
Set-Cookie: sec5value=secure5 ; secure; domain=127.0.0.1; path=/secure5/ ;
|
|
|
|
Set-Cookie: sec6value=secure6 ; secure ; domain=127.0.0.1; path=/secure6/ ;
|
|
|
|
Set-Cookie: sec7value=secure7 ; secure ; domain=127.0.0.1; path=/secure7/ ;
|
|
|
|
Set-Cookie: sec8value=secure8 ; secure= ; domain=127.0.0.1; path=/secure8/ ;
|
|
|
|
Set-Cookie: secure=very1 ; secure=; domain=127.0.0.1; path=/secure9/;
|
|
|
|
Set-Cookie: httpo1=value1 ; domain=127.0.0.1; path=/p1/; httponly
|
|
|
|
Set-Cookie: httpo2=value2 ; domain=127.0.0.1; path=/p2/; httponly=
|
|
|
|
Set-Cookie: httpo3=value3 ; httponly; domain=127.0.0.1; path=/p3/;
|
|
|
|
Set-Cookie: httpo4=value4 ; httponly=; domain=127.0.0.1; path=/p4/;
|
|
|
|
Set-Cookie: httponly=myvalue1 ; domain=127.0.0.1; path=/p4/; httponly
|
|
|
|
Set-Cookie: httpandsec=myvalue2 ; domain=127.0.0.1; path=/p4/; httponly; secure
|
|
|
|
Set-Cookie: httpandsec2=myvalue3; domain=127.0.0.1; path=/p4/; httponly=; secure
|
|
|
|
Set-Cookie: httpandsec3=myvalue4 ; domain=127.0.0.1; path=/p4/; httponly; secure=
|
|
|
|
Set-Cookie: httpandsec4=myvalue5 ; domain=127.0.0.1; path=/p4/; httponly=; secure=
|
|
|
|
Set-Cookie: httpandsec5=myvalue6 ; domain=127.0.0.1; path=/p4/; secure; httponly=
|
|
|
|
Set-Cookie: httpandsec6=myvalue7 ; domain=127.0.0.1; path=/p4/; secure=; httponly=
|
|
|
|
Set-Cookie: httpandsec7=myvalue8 ; domain=127.0.0.1; path=/p4/; secure; httponly
|
|
|
|
Set-Cookie: httpandsec8=myvalue9; domain=127.0.0.1; path=/p4/; secure=; httponly
|
|
|
|
Set-Cookie: partmatch=present; domain=127.0.0.1 ; path=/;
|
|
|
|
Set-Cookie: eat=this; domain=moo.foo.moo;
|
|
|
|
Set-Cookie: eat=this-too; domain=.foo.moo;
|
|
|
|
Set-Cookie: nodomainnovalue
|
|
|
|
Set-Cookie: nodomain=value; expires=Fri Feb 13 11:56:27 GMT 2037
|
|
|
|
Set-Cookie: novalue; domain=reallysilly
|
|
|
|
Set-Cookie: test=yes; domain=foo.com; expires=Sat Feb 2 11:56:27 GMT 2030
|
|
|
|
Set-Cookie: test2=yes; domain=se; expires=Sat Feb 2 11:56:27 GMT 2030
|
|
|
|
Set-Cookie: magic=yessir; path=/silly/; HttpOnly
|
|
|
|
Set-Cookie: blexp=yesyes; domain=127.0.0.1; domain=127.0.0.1; expiry=totally bad;
|
|
|
|
Set-Cookie: partialip=nono; domain=.0.0.1;
|
|
|
|
Set-Cookie: withspaces= yes within and around ;
|
|
|
|
Set-Cookie: withspaces2 =before equals;
|
|
|
|
Set-Cookie: prespace= yes before;
|
|
|
|
Set-Cookie: securewithspace=after ; secure =
|
|
|
|
%endif
|
2002-02-26 21:09:46 +08:00
|
|
|
|
|
|
|
boo
|
|
|
|
</data>
|
|
|
|
</reply>
|
|
|
|
|
|
|
|
# Client-side
|
|
|
|
<client>
|
2003-05-01 04:25:39 +08:00
|
|
|
<server>
|
|
|
|
http
|
|
|
|
</server>
|
2002-02-26 21:09:46 +08:00
|
|
|
<name>
|
|
|
|
HTTP with weirdly formatted cookies and cookiejar storage
|
|
|
|
</name>
|
2007-07-11 06:27:16 +08:00
|
|
|
# Explicitly set the time zone to a known good one, in case the user is
|
|
|
|
# using one of the 'right' zones that take into account leap seconds
|
|
|
|
# which causes the cookie expiry times to be different.
|
|
|
|
<setenv>
|
|
|
|
TZ=GMT
|
|
|
|
</setenv>
|
2002-02-26 21:09:46 +08:00
|
|
|
<command>
|
2021-03-13 00:38:26 +08:00
|
|
|
http://%HOSTIP:%HTTPPORT/we/want/%TESTNUMBER -b none -c log/jar%TESTNUMBER.txt
|
2002-02-26 21:09:46 +08:00
|
|
|
</command>
|
2012-11-18 21:55:29 +08:00
|
|
|
<precheck>
|
2017-05-14 01:04:10 +08:00
|
|
|
perl -e "print 'Test requires default test server host' if ( '%HOSTIP' ne '127.0.0.1' );"
|
2012-11-18 21:55:29 +08:00
|
|
|
</precheck>
|
2005-01-26 05:45:03 +08:00
|
|
|
</client>
|
2002-02-26 21:09:46 +08:00
|
|
|
|
|
|
|
# Verify data after the test has been "shot"
|
|
|
|
<verify>
|
|
|
|
<protocol>
|
2021-03-13 00:38:26 +08:00
|
|
|
GET /we/want/%TESTNUMBER HTTP/1.1
|
2007-09-15 03:32:31 +08:00
|
|
|
Host: %HOSTIP:%HTTPPORT
|
2020-10-02 19:45:24 +08:00
|
|
|
User-Agent: curl/%VERSION
|
2004-02-09 20:46:41 +08:00
|
|
|
Accept: */*
|
2002-02-26 21:09:46 +08:00
|
|
|
|
|
|
|
</protocol>
|
2021-03-13 00:38:26 +08:00
|
|
|
<file name="log/jar%TESTNUMBER.txt" mode="text">
|
2002-02-26 21:09:46 +08:00
|
|
|
# Netscape HTTP Cookie File
|
2020-11-04 21:02:01 +08:00
|
|
|
# https://curl.se/docs/http-cookies.html
|
2002-02-26 21:09:46 +08:00
|
|
|
# This file was generated by libcurl! Edit at your own risk.
|
|
|
|
|
2018-08-28 17:28:50 +08:00
|
|
|
127.0.0.1 FALSE /we/want/ FALSE 0 prespace yes before
|
|
|
|
127.0.0.1 FALSE /we/want/ FALSE 0 withspaces2 before equals
|
|
|
|
127.0.0.1 FALSE /we/want/ FALSE 0 withspaces yes within and around
|
|
|
|
127.0.0.1 FALSE /we/want/ FALSE 0 blexp yesyes
|
|
|
|
#HttpOnly_127.0.0.1 FALSE /silly/ FALSE 0 magic yessir
|
2019-01-07 23:23:04 +08:00
|
|
|
127.0.0.1 FALSE /we/want/ FALSE 2118138987 nodomain value
|
2018-08-28 17:28:50 +08:00
|
|
|
127.0.0.1 FALSE / FALSE 0 partmatch present
|
|
|
|
#HttpOnly_127.0.0.1 FALSE /p4/ FALSE 0 httponly myvalue1
|
|
|
|
#HttpOnly_127.0.0.1 FALSE /p4/ FALSE 0 httpo4 value4
|
|
|
|
#HttpOnly_127.0.0.1 FALSE /p3/ FALSE 0 httpo3 value3
|
|
|
|
#HttpOnly_127.0.0.1 FALSE /p2/ FALSE 0 httpo2 value2
|
|
|
|
#HttpOnly_127.0.0.1 FALSE /p1/ FALSE 0 httpo1 value1
|
|
|
|
127.0.0.1 FALSE /overwrite FALSE 0 overwrite this2
|
|
|
|
127.0.0.1 FALSE /silly/ FALSE 0 ismatch this
|
2002-02-26 21:09:46 +08:00
|
|
|
</file>
|
|
|
|
</verify>
|
2007-01-23 10:25:56 +08:00
|
|
|
</testcase>
|