summaryrefslogtreecommitdiffstats
path: root/tdeioslave/http/kcookiejar/tests/cookie_rfc.test
blob: e1d8a40def42e3355a04ecb2f4ee90a799a82bc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
## Check setting of cookies
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value="value1"; Version=1; Path="/"; Max-Age=3600
# Although the examples in RFC2965 uses $Version="1" the syntax description suggests that
# such quotes are not allowed, KDE BR59990 reports that the Sun Java server fails to handle
# cookies that use $Version="1"
CHECK http://w.y.z/ Cookie: $Version=1; some_value="value1"; $Path="/"
COOKIE ASK http://a.b.c/ Set-Cookie2: some_value="value2"; Version=1; Path="/"
CHECK http://a.b.c/ Cookie: $Version=1; some_value="value2"; $Path="/"
## Check if clearing cookie jar works
CLEAR COOKIES
CHECK http://w.y.z/
CHECK http://a.b.c/
## Check cookie syntax
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value="value with spaces"; Version=1
CHECK http://w.y.z/ Cookie: $Version=1; some_value="value with spaces"
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value ="extra space 1"; Version=1
CHECK http://w.y.z/ Cookie: $Version=1; some_value="extra space 1"
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value= "extra space 2"; Version=1
CHECK http://w.y.z/ Cookie: $Version=1; some_value="extra space 2"
COOKIE ASK http://a.b.c/ Set-Cookie2: some_value=unquoted; Version=1
CHECK http://a.b.c/ Cookie: $Version=1; some_value=unquoted
# Note that we parse this different for Netscape-style cookies!
COOKIE ASK http://a.b.c/ Set-Cookie2: some_value="quoted value; and such"; Version=1;
CHECK http://a.b.c/ Cookie: $Version=1; some_value="quoted value; and such"
CLEAR COOKIES
## Check if deleting cookies works #1
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value="value1"; Version=1; Path="/"; Max-Age=3600
CHECK http://w.y.z/ Cookie: $Version=1; some_value="value1"; $Path="/"
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value1; Version=1; Path="/"; Max-Age=0
CHECK http://w.y.z/
## Check if updating cookies works
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value2; Version=1; Path="/"; Max-Age=3600
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value3; Version=1; Path="/"; Max-Age=3600
CHECK http://w.y.z/ Cookie: $Version=1; some_value=value3; $Path="/"
## Check if multiple cookies work
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value2=foobar; Version=1; Path="/"; Max-Age=3600
CHECK http://w.y.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"; some_value=value3; $Path="/"
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=; Version=1; Path="/"; Max-Age=0
CHECK http://w.y.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"
CLEAR COOKIES
## Check if we prepend domain with a dot
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value2; Version=1; Path="/"; Domain=.y.z; Max-Age=3600
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value3; Version=1; Path="/"; Domain=y.z.; Max-Age=3600
CHECK http://w.y.z/ Cookie: $Version=1; some_value=value3; $Path="/"; $Domain=".y.z"
CLEAR COOKIES
## Check if multiple cookies on a single line work
## FIXME
#COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value3; Version=1; Path="/"; Max-Age=3600, some_value2=foobar; Version=1; Path="/"; Max-Age=3600
# CHECK http://w.y.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"; some_value=value3; $Path="/"
# COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=; Version=1; Path="/"; Max-Age=0
# CHECK http://w.y.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"
CLEAR COOKIES
## Check if path restrictions work
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value1; Version=1; Path="/Foo"; Max-Age=3600
CHECK http://w.y.z/
CHECK http://w.y.z/Foo Cookie: $Version=1; some_value=value1; $Path="/Foo"
CHECK http://w.y.z/Foo/ Cookie: $Version=1; some_value=value1; $Path="/Foo"
CHECK http://w.y.z/Foo/bar Cookie: $Version=1; some_value=value1; $Path="/Foo"
CLEAR COOKIES
## Check if default path works
# RFC2965 says that we should default to the URL path
COOKIE ASK http://w.y.z/Foo/ Set-Cookie2: some_value=value1; Version=1; Max-Age=3600
CHECK http://w.y.z/
CHECK http://w.y.z/Foo Cookie: $Version=1; some_value=value1
CHECK http://w.y.z/FooBar
CHECK http://w.y.z/Foo/ Cookie: $Version=1; some_value=value1
CHECK http://w.y.z/Foo/bar Cookie: $Version=1; some_value=value1
CLEAR COOKIES
## Check if cookies are correctly ordered based on path
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value1; Version=1; Path="/Foo"; Max-Age=3600
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value2=value2; Version=1; Path="/Foo/Bar"; Max-Age=3600
CHECK http://w.y.z/Foo/Bar Cookie: $Version=1; some_value2=value2; $Path="/Foo/Bar"; some_value=value1; $Path="/Foo"
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value3=value3; Version=1; Path="/"; Max-Age=3600
CHECK http://w.y.z/Foo/Bar Cookie: $Version=1; some_value2=value2; $Path="/Foo/Bar"; some_value=value1; $Path="/Foo"; some_value3=value3; $Path="/"
CLEAR COOKIES
## Check cookies with same name but different paths
COOKIE ASK http://w.y.z/Foo/ Set-Cookie2: some_value=value1; Version=1; Max-Age=3600
COOKIE ASK http://w.y.z/Bar/ Set-Cookie2: some_value=value2; Version=1; Max-Age=3600
CHECK http://w.y.z/Foo/Bar Cookie: $Version=1; some_value=value1
CHECK http://w.y.z/Bar/Foo Cookie: $Version=1; some_value=value2
COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value3; Version=1; Max-Age=3600
CHECK http://w.y.z/Foo/Bar Cookie: $Version=1; some_value=value1; some_value=value3
## Check secure cookie handling
COOKIE ASK https://secure.y.z/ Set-Cookie2: some_value2=value2; Version=1; Path="/"; Max-Age=3600; Secure
CHECK https://secure.y.z/Foo/bar Cookie: $Version=1; some_value2=value2; $Path="/"
CHECK http://secure.y.z/Foo/bar
CLEAR COOKIES
COOKIE ASK http://secure.y.z/ Set-Cookie2: some_value3=value3; Version=1; Path="/"; Max-Age=3600; Secure
CHECK https://secure.y.z/Foo/bar Cookie: $Version=1; some_value3=value3; $Path="/"
CHECK http://secure.y.z/Foo/bar
CLEAR COOKIES
## Check domain restrictions #1
COOKIE ASK http://www.acme.com/ Set-Cookie2: some_value=value1; Version=1; Domain=".acme.com"; Max-Age=3600
CHECK http://www.acme.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme.com"
CHECK http://www.abc.com/
CHECK http://frop.acme.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme.com"
CLEAR COOKIES
## Check domain restrictions #2
COOKIE ASK http://novell.com/ Set-Cookie2: some_value=value1; Version=1; Domain=".novell.com"; Max-Age=3600
CHECK http://novell.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell.com"
CHECK http://www.novell.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell.com"
CLEAR COOKIES
## Check domain restrictions #3
COOKIE ASK http://novell.com/ Set-Cookie2: some_value=value1; Version=1; Max-Age=3600
CHECK http://novell.com/ Cookie: $Version=1; some_value=value1
CHECK http://www.novell.com/
CLEAR COOKIES
## Check domain restrictions #4
COOKIE ASK http://novell.com/ Set-Cookie2: some_value=value1; Version=1; Domain=".com"; Max-Age=3600
# If the specified domain is too broad, we ignore the Domain
# FIXME: RFC2965 says we should ignore the cookie completely
CHECK http://novell.com/ Cookie: $Version=1; some_value=value1
CHECK http://www.novell.com/
CHECK http://com/
CHECK http://sun.com/
## Check domain restrictions #5
CLEAR COOKIES
COOKIE ASK http://novell.co.uk/ Set-Cookie2: some_value=value1; Version=1; Domain=".co.uk"; Max-Age=3600
# If the specified domain is too broad, we default to host only
# FIXME: RFC2965 says we should ignore the cookie completely
CHECK http://novell.co.uk/ Cookie: $Version=1; some_value=value1
CHECK http://www.novell.co.uk/
CHECK http://co.uk/
CHECK http://sun.co.uk/
COOKIE ASK http://x.y.z.foobar.com/ Set-Cookie2: set_by=x.y.z.foobar.com; Version=1; Domain=".foobar.com"; Max-Age=3600
CHECK http://x.y.z.foobar.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar.com"
CHECK http://y.z.foobar.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar.com"
CHECK http://z.foobar.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar.com"
CHECK http://www.foobar.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar.com"
CHECK http://foobar.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar.com"
CLEAR COOKIES
## Check domain restrictions #6
COOKIE ASK http://x.y.z.frop.com/ Set-Cookie2: set_by=x.y.z.frop.com; Version=1; Domain=".foobar.com"; Max-Age=3600
COOKIE ASK http://x.y.z.frop.com/ Set-Cookie2: set_by2=x.y.z.frop.com; Version=1; Domain=".com"; Max-Age=3600
CHECK http://x.y.z.foobar.com/
CHECK http://y.z.foobar.com/
CHECK http://z.foobar.com/
CHECK http://www.foobar.com/
CHECK http://foobar.com/
CLEAR COOKIES
## Check domain restrictions #7
COOKIE ASK http://frop.com/ Set-Cookie2: set_by=x.y.z.frop.com; Version=1; Domain=".foobar.com"; Max-Age=3600
COOKIE ASK http://frop.com/ Set-Cookie2: set_by2=x.y.z.frop.com; Version=1; Domain=".com"; Max-Age=3600
CHECK http://x.y.z.foobar.com/
CHECK http://y.z.foobar.com/
CHECK http://z.foobar.com/
CHECK http://www.foobar.com/
CHECK http://foobar.com/