[frameworks/kio] /: Drop kcookiejar
Nicolas Fella
null at kde.org
Sun Aug 13 22:09:55 BST 2023
Git commit 3fb91688feaa078ba42fcfc8d4db67b20fd6020c by Nicolas Fella.
Committed on 13/08/2023 at 22:56.
Pushed by nicolasfella into branch 'master'.
Drop kcookiejar
There is no automatic persistence of cookies in kio_http any more, so this is not used
M +0 -1 autotests/CMakeLists.txt
D +0 -19 autotests/kcookiejar/CMakeLists.txt
D +0 -188 autotests/kcookiejar/cookie.test
D +0 -172 autotests/kcookiejar/cookie_rfc.test
D +0 -434 autotests/kcookiejar/cookie_saving.test
D +0 -51 autotests/kcookiejar/cookie_session.test
D +0 -112 autotests/kcookiejar/cookie_settings.test
D +0 -292 autotests/kcookiejar/kcookiejartest.cpp
M +0 -1 docs/CMakeLists.txt
D +0 -1 docs/kcookiejar5/CMakeLists.txt
D +0 -149 docs/kcookiejar5/man-kcookiejar5.8.docbook
M +0 -4 src/kioworkers/http/CMakeLists.txt
D +0 -66 src/kioworkers/http/kcookiejar/CMakeLists.txt
D +0 -1 src/kioworkers/http/kcookiejar/config-kcookiejar.h.in
D +0 -2 src/kioworkers/http/kcookiejar/domain_info
D +0 -1559 src/kioworkers/http/kcookiejar/kcookiejar.cpp
D +0 -466 src/kioworkers/http/kcookiejar/kcookiejar.h
D +0 -125 src/kioworkers/http/kcookiejar/kcookiejar.json
D +0 -9 src/kioworkers/http/kcookiejar/kcookiejar_include.h
D +0 -560 src/kioworkers/http/kcookiejar/kcookieserver.cpp
D +0 -95 src/kioworkers/http/kcookiejar/kcookieserver.h
D +0 -376 src/kioworkers/http/kcookiejar/kcookiewin.cpp
D +0 -67 src/kioworkers/http/kcookiejar/kcookiewin.h
D +0 -60 src/kioworkers/http/kcookiejar/main.cpp
D +0 -331 src/kioworkers/http/kcookiejar/netscape_cookie_spec.html
D +0 -3 src/kioworkers/http/kcookiejar/specifications
https://invent.kde.org/frameworks/kio/-/commit/3fb91688feaa078ba42fcfc8d4db67b20fd6020c
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 587e390a68..2dc5bf6ee8 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -6,7 +6,6 @@ include(ECMAddTests)
if(NOT ANDROID)
add_subdirectory(http)
endif()
-add_subdirectory(kcookiejar)
find_package(Qt6Widgets REQUIRED)
diff --git a/autotests/kcookiejar/CMakeLists.txt b/autotests/kcookiejar/CMakeLists.txt
deleted file mode 100644
index 8eb7429d9d..0000000000
--- a/autotests/kcookiejar/CMakeLists.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-find_package(Qt6Test REQUIRED)
-
-include(ECMAddTests)
-
-########### next target ###############
-
-
-# linking to Qt6::Gui is only needed for the include paths
-ecm_add_test(kcookiejartest.cpp
- NAME_PREFIX "kioworker-"
- LINK_LIBRARIES Qt6::Test Qt6::Gui KF6::KIOCore KF6::ConfigCore
-)
-
-########### install files ###############
-
-
-
-
-
diff --git a/autotests/kcookiejar/cookie.test b/autotests/kcookiejar/cookie.test
deleted file mode 100644
index f98ea10a68..0000000000
--- a/autotests/kcookiejar/cookie.test
+++ /dev/null
@@ -1,188 +0,0 @@
-## Check setting of cookies
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value1; Path="/"; expires=%NEXTYEAR%
-CHECK http://w.y.z/ Cookie: some_value=value1
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value2; Path="/"
-CHECK http://a.b.c/ Cookie: some_value=value2
-## 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-Cookie: some_value=value with spaces
-CHECK http://w.y.z/ Cookie: some_value=value with spaces
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value="quoted value"
-CHECK http://a.b.c/ Cookie: some_value="quoted value"
-# Without a = sign, the cookie gets interpreted as the value for a cookie with no name
-# This is what IE and Netscape does
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value
-# Note: order in the expected list does not matter.
-CHECK http://a.b.c/ Cookie: some_value="quoted value"; some_value
-COOKIE ASK http://a.b.c/ Set-Cookie: some_other_value
-CHECK http://a.b.c/ Cookie: some_value="quoted value"; some_other_value
-CLEAR COOKIES
-# This doesn't work with old-style netscape cookies, it should work with RFC2965 cookies
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value="quoted value; and such"
-# IE & Netscape does this:
-CHECK http://a.b.c/ Cookie: some_value="quoted value
-# Mozilla does:
-# CHECK http://a.b.c/ Cookie: some_value="quoted value; and such"
-# COOKIE ASK http://a.b.c/ Set-Cookie: some_value="quoted value;
-# CHECK http://a.b.c/ Cookie: some_value=
-# Note that we parse RFC2965 cookies like Mozilla does
-CLEAR COOKIES
-## Check if deleting cookies works
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value1; Path="/"; expires=%NEXTYEAR%
-CHECK http://w.y.z/ Cookie: some_value=value1
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value1; Path="/"; expires=%LASTYEAR%
-CHECK http://w.y.z/
-## Check if updating cookies works
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value2; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value3; Path="/"; expires=%NEXTYEAR%
-CHECK http://w.y.z/ Cookie: some_value=value3
-## Check if multiple cookies work
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value2=foobar; Path="/"; expires=%NEXTYEAR%
-CHECK http://w.y.z/ Cookie: some_value=value3; some_value2=foobar
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=; Path="/"; expires=%LASTYEAR%
-CHECK http://w.y.z/ Cookie: some_value2=foobar
-CLEAR COOKIES
-## Check if path restrictions work
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value1; Path="/Foo"; expires=%NEXTYEAR%
-CHECK http://w.y.z/
-CHECK http://w.y.z/Foo Cookie: some_value=value1
-CHECK http://w.y.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y.z/Foo/bar Cookie: some_value=value1
-CLEAR COOKIES
-## Check if default path works
-# RFC2965 says that we should default to the URL path, but netscape cookies default to /
-COOKIE ASK http://w.y.z/Foo/ Set-Cookie: some_value=value1; expires=%NEXTYEAR%
-CHECK http://w.y.z/
-CHECK http://w.y.z/Foo Cookie: some_value=value1
-CHECK http://w.y.z/FooBar
-CHECK http://w.y.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y.z/Foo/bar Cookie: some_value=value1
-CLEAR COOKIES
-## Check if cookies are correctly ordered based on path
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value1; Path="/Foo"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value2=value2; Path="/Foo/Bar"; expires=%NEXTYEAR%
-CHECK http://w.y.z/Foo/Bar Cookie: some_value2=value2; some_value=value1
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value3=value3; Path="/"; expires=%NEXTYEAR%
-CHECK http://w.y.z/Foo/Bar Cookie: some_value2=value2; some_value=value1; some_value3=value3
-CLEAR COOKIES
-## Check cookies with same name but different paths
-COOKIE ASK http://w.y.z/Foo/ Set-Cookie: some_value=value1; expires=%NEXTYEAR%
-COOKIE ASK http://w.y.z/Bar/ Set-Cookie: some_value=value2; expires=%NEXTYEAR%
-CHECK http://w.y.z/Foo/Bar Cookie: some_value=value1
-CHECK http://w.y.z/Bar/Foo Cookie: some_value=value2
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value3; expires=%NEXTYEAR%
-CHECK http://w.y.z/Foo/Bar Cookie: some_value=value1; some_value=value3
-## Check secure cookie handling
-COOKIE ASK https://secure.y.z/ Set-Cookie: some_value2=value2; Path="/"; expires=%NEXTYEAR%; secure
-CHECK https://secure.y.z/Foo/bar Cookie: some_value2=value2
-CHECK http://secure.y.z/Foo/bar
-CLEAR COOKIES
-COOKIE ASK http://secure.y.z/ Set-Cookie: some_value3=value3; Path="/"; expires=%NEXTYEAR%; secure
-CHECK https://secure.y.z/Foo/bar Cookie: some_value3=value3
-CHECK http://secure.y.z/Foo/bar
-CLEAR COOKIES
-## Check domain restrictions #1
-COOKIE ASK http://www.acme.com/ Set-Cookie: some_value=value1; Domain=".acme.com"; expires=%NEXTYEAR%
-CHECK http://www.acme.com/ Cookie: some_value=value1
-CHECK http://www.abc.com/
-CHECK http://frop.acme.com/ Cookie: some_value=value1
-CLEAR COOKIES
-## Check domain restrictions #2
-COOKIE ASK http://novell.com/ Set-Cookie: some_value=value1; Domain=".novell.com"; expires=%NEXTYEAR%
-CHECK http://novell.com/ Cookie: some_value=value1
-CHECK http://www.novell.com/ Cookie: some_value=value1
-CLEAR COOKIES
-COOKIE ASK http://novell.com/ Set-Cookie: some_value=value1; Domain="novell.com"; expires=%NEXTYEAR%
-CHECK http://novell.com/ Cookie: some_value=value1
-CHECK http://www.novell.com/ Cookie: some_value=value1
-CLEAR COOKIES
-## Check domain restrictions #3
-COOKIE ASK http://novell.com/ Set-Cookie: some_value=value1; expires=%NEXTYEAR%
-CHECK http://novell.com/ Cookie: some_value=value1
-# FIXME: Allegedly IE sends cookies to sub-domains as well!
-# See e.g. https://bugzilla.mozilla.org/show_bug.cgi?id=223027
-CHECK http://www.novell.com/
-CLEAR COOKIES
-## Check domain restrictions #4
-COOKIE ASK http://novell.com/ Set-Cookie: some_value=value1; Domain=".com"; expires=%NEXTYEAR%
-CHECK http://novell.com/ Cookie: some_value=value1
-# If the specified domain is too broad, we default to host only
-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-Cookie: some_value=value1; Domain=".co.uk"; expires=%NEXTYEAR%
-CHECK http://novell.co.uk/ Cookie: some_value=value1
-# If the specified domain is too broad, we default to host only
-CHECK http://www.novell.co.uk/
-CHECK http://co.uk/
-CHECK http://sun.co.uk/
-COOKIE ASK http://x.y.z.foobar.com/ Set-Cookie: set_by=x.y.z.foobar.com; Domain=".foobar.com"; expires=%NEXTYEAR%
-CHECK http://x.y.z.foobar.com/ Cookie: set_by=x.y.z.foobar.com
-CHECK http://y.z.foobar.com/ Cookie: set_by=x.y.z.foobar.com
-CHECK http://z.foobar.com/ Cookie: set_by=x.y.z.foobar.com
-CHECK http://www.foobar.com/ Cookie: set_by=x.y.z.foobar.com
-CHECK http://foobar.com/ Cookie: set_by=x.y.z.foobar.com
-CLEAR COOKIES
-## Check domain restrictions #6
-COOKIE ASK http://x.y.z.frop.com/ Set-Cookie: set_by=x.y.z.frop.com; Domain=".foobar.com"; expires=%NEXTYEAR%
-COOKIE ASK http://x.y.z.frop.com/ Set-Cookie: set_by2=x.y.z.frop.com; Domain=".com"; expires=%NEXTYEAR%
-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-Cookie: set_by=x.y.z.frop.com; Domain=".foobar.com"; expires=%NEXTYEAR%
-COOKIE ASK http://frop.com/ Set-Cookie: set_by2=x.y.z.frop.com; Domain=".com"; expires=%NEXTYEAR%
-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 #8
-CONFIG AcceptSessionCookies true
-COOKIE ACCEPT http://www.foobar.com Set-Cookie: from=foobar.com; domain=bar.com; Path="/"
-CHECK http://bar.com
-CLEAR CONFIG
-CLEAR COOKIES
-## Check cookies with IP address hostnames
-COOKIE ASK http://192.168.0.1 Set-Cookie: name1=value1; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://192.168.0.1 Set-Cookie: name11=value11; domain="test.local"; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://192.168.0.1:8080 Set-Cookie: name2=value2; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK https://192.168.0.1 Set-Cookie: name3=value3; Path="/"; expires=%NEXTYEAR%; secure
-CHECK http://192.168.0.1 Cookie: name1=value1; name11=value11; name2=value2
-CHECK http://192.168.0.1:8080 Cookie: name1=value1; name11=value11; name2=value2
-CHECK https://192.168.0.1 Cookie: name1=value1; name11=value11; name2=value2; name3=value3
-CHECK http://192.168.0.10
-CHECK http://192.168.0
-CLEAR COOKIES
-## Check expiration dates for the Y2K38 problem
-COOKIE ASK http://foo.bar Set-Cookie: name=value;expires=Tue, 06-Dec-2039 00:30:42 GMT;path="/"
-CHECK http://foo.bar Cookie: name=value
-CLEAR COOKIES
-## Check non-standard expiration dates (BR# 145244)
-COOKIE ASK http://foo.bar Set-Cookie: name=value; expires=Sat Sep 12 07:00:00 2220 GMT; path="/"
-COOKIE ASK http://foo.bar Set-Cookie: name1=value1; expires=Thu, 01 Jan 1970 00:00:00 GMT; path="/"
-COOKIE ASK http://foo.bar Set-Cookie: name2=value2; expires=Sat Sep 12 2220 07:00:00 GMT; path="/"
-CHECK http://foo.bar Cookie: name=value; name2=value2
-CLEAR COOKIES
-## Check path restrictions
-COOKIE ASK http://a.b.c/app1 Set-Cookie: name=value; Path="/app1"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/app2 Set-Cookie: name1=value1; Path="/app2"; expires=%NEXTYEAR%
-CHECK http://a.b.c/app1 Cookie: name=value
-## Check invalid weekday value in expire headers (BR# 298660)
-COOKIE ASK http://foo.bar Set-Cookie: name=value; expires=Thu, 01 Jan 1970 00:00:00 GMT; path="/"
-COOKIE ASK http://foo.bar Set-Cookie: name1=value1; expires=Thu, 30 Dec 2037 00:00:00 GMT; path="/"
-CLEAR SESSIONCOOKIES
-CHECK http://foo.bar Cookie: name1=value1
-CLEAR COOKIES
-## Check JSON formatted cookie values (QTBUG-26002)
-COOKIE ASK http://www.foo.bar Set-Cookie: name={"value":"null","value2":"null","value3":"null"}; domain=.foo.bar; path=/
-CHECK http://www.foo.bar Cookie: name={"value":"null","value2":"null","value3":"null"}
diff --git a/autotests/kcookiejar/cookie_rfc.test b/autotests/kcookiejar/cookie_rfc.test
deleted file mode 100644
index 25ad26827e..0000000000
--- a/autotests/kcookiejar/cookie_rfc.test
+++ /dev/null
@@ -1,172 +0,0 @@
-## 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_value=value3; $Path="/"; some_value2=foobar; $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
-CLEAR COOKIES
-## Check port selection handling (rfc 2965 3.3.4)
-COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value1; Version=1; Domain=.y.z; Port
-CHECK http://foo.y.z/ Cookie: $Version=1; some_value=value1; $Domain=".y.z"; $Port
-CHECK http://foo.y.z:8080
-COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value1; Version=1; Domain=.y.z; Port="80 8080 443"
-CHECK http://foo.y.z/ Cookie: $Version=1; some_value=value1; $Domain=".y.z"; $Port="80 8080 443"
-CHECK http://foo.y.z:8080 Cookie: $Version=1; some_value=value1; $Domain=".y.z"; $Port="80 8080 443"
-CHECK http://foo.y.z:443 Cookie: $Version=1; some_value=value1; $Domain=".y.z"; $Port="80 8080 443"
-CHECK http://w.y.z:3129
-COOKIE ASK http://w.y.z/ Set-Cookie2: some_value=value1; Version=1; Domain=.y.z
-CHECK http://w.y.z:80 Cookie: $Version=1; some_value=value1; $Domain=".y.z"
-CHECK http://w.y.z:443 Cookie: $Version=1; some_value=value1; $Domain=".y.z"
-CHECK http://w.y.z:3129 Cookie: $Version=1; some_value=value1; $Domain=".y.z"
-CHECK http://w.y.z:8080 Cookie: $Version=1; some_value=value1; $Domain=".y.z"
-CLEAR COOKIES
-## 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
-COOKIE ASK https://secure.y.z/ Set-Cookie: some_value=value; Path="/"; Max-Age=3600;
-CHECK https://secure.y.z/Foo/bar Cookie: some_value=value
-CHECK http://secure.y.z/Foo/bar Cookie: some_value=value
-CLEAR COOKIES
-COOKIE ASK http://secure.y.z/ Set-Cookie: some_value=value; Path="/"; Max-Age=3600;
-CHECK https://secure.y.z/Foo/bar Cookie: some_value=value
-CHECK http://secure.y.z/Foo/bar Cookie: some_value=value
-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/
diff --git a/autotests/kcookiejar/cookie_saving.test b/autotests/kcookiejar/cookie_saving.test
deleted file mode 100644
index 28dea3ce4b..0000000000
--- a/autotests/kcookiejar/cookie_saving.test
+++ /dev/null
@@ -1,434 +0,0 @@
-## Check setting of cookies
-COOKIE ASK http://w.y.z/ Set-Cookie: some_value=value1; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value2; Path="/"
-## Check if clearing cookie jar works
-CLEAR COOKIES
-## Check cookie syntax
-COOKIE ASK http://w.y1.z/ Set-Cookie: some_value=value with spaces; expires=%NEXTYEAR%
-COOKIE ASK http://a.b1.c/ Set-Cookie: some_value="quoted value"; expires=%NEXTYEAR%
-# Without a = sign, the cookie gets interpreted as the value for a cookie with no name
-# This is what IE and Netscape does
-COOKIE ASK http://a.b1.c/ Set-Cookie: some_value
-COOKIE ASK http://a.b1.c/ Set-Cookie: some_other_value; expires=%NEXTYEAR%
-# This doesn't work with old-style netscape cookies, it should work with RFC2965 cookies
-COOKIE ASK http://a.b2.c/ Set-Cookie: some_value="quoted value; and such"; expires=%NEXTYEAR%
-# IE & Netscape does this:
-## Check if deleting cookies works
-COOKIE ASK http://w.y3.z/ Set-Cookie: some_value=value1; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y3.z/ Set-Cookie: some_value=value1; Path="/"; expires=%LASTYEAR%
-## Check if updating cookies works
-COOKIE ASK http://w.y3.z/ Set-Cookie: some_value=value2; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y3.z/ Set-Cookie: some_value=value3; Path="/"; expires=%NEXTYEAR%
-## Check if multiple cookies work
-COOKIE ASK http://w.y3.z/ Set-Cookie: some_value2=foobar; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y3.z/ Set-Cookie: some_value=; Path="/"; expires=%LASTYEAR%
-## Check if path restrictions work
-COOKIE ASK http://w.y4.z/ Set-Cookie: some_value=value1; Path="/Foo"; expires=%NEXTYEAR%
-## Check if default path works
-COOKIE ASK http://w.y5.z/Foo/ Set-Cookie: some_value=value1; expires=%NEXTYEAR%
-## Check if cookies are correctly ordered based on path
-COOKIE ASK http://w.y6.z/ Set-Cookie: some_value=value1; Path="/Foo"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y6.z/ Set-Cookie: some_value2=value2; Path="/Foo/Bar"; expires=%NEXTYEAR%
-COOKIE ASK http://w.y6.z/ Set-Cookie: some_value3=value3; Path="/"; expires=%NEXTYEAR%
-## Check cookies with same name but different paths
-COOKIE ASK http://w.y7.z/Foo/ Set-Cookie: some_value=value1; expires=%NEXTYEAR%
-COOKIE ASK http://w.y7.z/Bar/ Set-Cookie: some_value=value2; expires=%NEXTYEAR%
-COOKIE ASK http://w.y7.z/ Set-Cookie: some_value=value3; expires=%NEXTYEAR%
-## Check secure cookie handling
-COOKIE ASK https://secure.y7.z/ Set-Cookie: some_value2=value2; Path="/"; expires=%NEXTYEAR%; secure
-COOKIE ASK http://secure.y8.z/ Set-Cookie: some_value3=value3; Path="/"; expires=%NEXTYEAR%; secure
-## Check domain restrictions #1
-COOKIE ASK http://www.acme9.com/ Set-Cookie: some_value=value1; Domain=".acme9.com"; expires=%NEXTYEAR%
-## Check domain restrictions #2
-COOKIE ASK http://novell10.com/ Set-Cookie: some_value=value1; Domain=".novell10.com"; expires=%NEXTYEAR%
-COOKIE ASK http://novell11.com/ Set-Cookie: some_value=value1; Domain="novell11.com"; expires=%NEXTYEAR%
-## Check domain restrictions #3
-COOKIE ASK http://novell12.com/ Set-Cookie: some_value=value1; expires=%NEXTYEAR%
-## Check domain restrictions #4
-COOKIE ASK http://novell13.com/ Set-Cookie: some_value=value1; Domain=".com"; expires=%NEXTYEAR%
-# If the specified domain is too broad, we default to host only
-## Check domain restrictions #5
-COOKIE ASK http://novell14.co.uk/ Set-Cookie: some_value=value1; Domain=".co.uk"; expires=%NEXTYEAR%
-COOKIE ASK http://x.y.z.foobar14.com/ Set-Cookie: set_by=x.y.z.foobar14.com; Domain=".foobar14.com"; expires=%NEXTYEAR%
-## Check domain restrictions #6
-COOKIE ASK http://x.y.z.frop15.com/ Set-Cookie: set_by=x.y.z.frop15.com; Domain=".foobar15.com"; expires=%NEXTYEAR%
-COOKIE ASK http://x.y.z.frop15.com/ Set-Cookie: set_by2=x.y.z.frop15.com; Domain=".com"; expires=%NEXTYEAR%
-## Check domain restrictions #7
-COOKIE ASK http://frop16.com/ Set-Cookie: set_by=x.y.z.frop16.com; Domain=".foobar16.com"; expires=%NEXTYEAR%
-COOKIE ASK http://frop16.com/ Set-Cookie: set_by2=x.y.z.frop16.com; Domain=".com"; expires=%NEXTYEAR%
-## RFC Cookies
-## Check setting of cookies
-COOKIE ASK http://w.y20.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"
-COOKIE ASK http://a.b20.c/ Set-Cookie2: some_value="value2"; Version=1; Path="/"; Max-Age=3600
-## Check cookie syntax
-COOKIE ASK http://w.y21.z/ Set-Cookie2: some_value="value with spaces"; Version=1; Max-Age=3600
-COOKIE ASK http://w.y21.z/ Set-Cookie2: some_value ="extra space 1"; Version=1; Max-Age=3600
-COOKIE ASK http://w.y21.z/ Set-Cookie2: some_value= "extra space 2"; Version=1; Max-Age=3600
-COOKIE ASK http://a.b21.c/ Set-Cookie2: some_value=unquoted; Version=1; Max-Age=3600
-# Note that we parse this different for Netscape-style cookies!
-COOKIE ASK http://a.b21.c/ Set-Cookie2: some_value="quoted value; and such"; Version=1; Max-Age=3600
-## Check if deleting cookies works #1
-COOKIE ASK http://w.y22.z/ Set-Cookie2: some_value="value1"; Version=1; Path="/"; Max-Age=3600
-COOKIE ASK http://w.y22.z/ Set-Cookie2: some_value=value1; Version=1; Path="/"; Max-Age=0
-## Check if updating cookies works
-COOKIE ASK http://w.y22.z/ Set-Cookie2: some_value=value2; Version=1; Path="/"; Max-Age=3600
-COOKIE ASK http://w.y22.z/ Set-Cookie2: some_value=value3; Version=1; Path="/"; Max-Age=3600
-## Check if multiple cookies work
-COOKIE ASK http://w.y22.z/ Set-Cookie2: some_value2=foobar; Version=1; Path="/"; Max-Age=3600
-COOKIE ASK http://w.y22.z/ Set-Cookie2: some_value=; Version=1; Path="/"; Max-Age=0
-## Check if path restrictions work
-COOKIE ASK http://w.y23.z/ Set-Cookie2: some_value=value1; Version=1; Path="/Foo"; Max-Age=3600
-## Check if default path works
-# RFC2965 says that we should default to the URL path
-COOKIE ASK http://w.y24.z/Foo/ Set-Cookie2: some_value=value1; Version=1; Max-Age=3600
-## Check if cookies are correctly ordered based on path
-COOKIE ASK http://w.y25.z/ Set-Cookie2: some_value=value1; Version=1; Path="/Foo"; Max-Age=3600
-COOKIE ASK http://w.y25.z/ Set-Cookie2: some_value2=value2; Version=1; Path="/Foo/Bar"; Max-Age=3600
-COOKIE ASK http://w.y25.z/ Set-Cookie2: some_value3=value3; Version=1; Path="/"; Max-Age=3600
-## Check cookies with same name but different paths
-COOKIE ASK http://w.y26.z/Foo/ Set-Cookie2: some_value=value1; Version=1; Max-Age=3600
-COOKIE ASK http://w.y26.z/Bar/ Set-Cookie2: some_value=value2; Version=1; Max-Age=3600
-COOKIE ASK http://w.y26.z/ Set-Cookie2: some_value=value3; Version=1; Max-Age=3600
-## Check secure cookie handling
-COOKIE ASK https://secure.y26.z/ Set-Cookie2: some_value2=value2; Version=1; Path="/"; Max-Age=3600; Secure
-COOKIE ASK http://secure.y27.z/ Set-Cookie2: some_value3=value3; Version=1; Path="/"; Max-Age=3600; Secure
-## Check domain restrictions #1
-COOKIE ASK http://www.acme28.com/ Set-Cookie2: some_value=value1; Version=1; Domain=".acme28.com"; Max-Age=3600
-## Check domain restrictions #2
-COOKIE ASK http://novell29.com/ Set-Cookie2: some_value=value1; Version=1; Domain=".novell29.com"; Max-Age=3600
-## Check domain restrictions #3
-COOKIE ASK http://novell30.com/ Set-Cookie2: some_value=value1; Version=1; Max-Age=3600
-## Check domain restrictions #4
-COOKIE ASK http://novell31.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 domain restrictions #5
-COOKIE ASK http://novell32.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
-COOKIE ASK http://x.y.z.foobar33.com/ Set-Cookie2: set_by=x.y.z.foobar.com; Version=1; Domain=".foobar33.com"; Max-Age=3600
-## Check domain restrictions #6
-COOKIE ASK http://x.y.z.frop34.com/ Set-Cookie2: set_by=x.y.z.frop.com; Version=1; Domain=".foobar.com"; Max-Age=3600
-COOKIE ASK http://x.y.z.frop34.com/ Set-Cookie2: set_by2=x.y.z.frop.com; Version=1; Domain=".com"; Max-Age=3600
-## Check domain restrictions #7
-COOKIE ASK http://frop35.com/ Set-Cookie2: set_by=x.y.z.frop.com; Version=1; Domain=".foobar.com"; Max-Age=3600
-COOKIE ASK http://frop35.com/ Set-Cookie2: set_by2=x.y.z.frop.com; Version=1; Domain=".com"; Max-Age=3600
-## Check port restrictions (RFC2965 3.3.4)
-COOKIE ASK http://ports.foo.bar.com Set-Cookie2: name=value1; Version=1; Port="80 8080 443"; Max-Age=3600
-
-## Check results
-CHECK http://w.y.z/
-CHECK http://a.b.c/
-CHECK http://w.y1.z/ Cookie: some_value=value with spaces
-CHECK http://a.b1.c/ Cookie: some_value="quoted value"; some_other_value
-CHECK http://a.b2.c/ Cookie: some_value="quoted value
-CHECK http://w.y3.z/ Cookie: some_value2=foobar
-CHECK http://w.y4.z/
-CHECK http://w.y4.z/Foo Cookie: some_value=value1
-CHECK http://w.y4.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y4.z/Foo/bar Cookie: some_value=value1
-CHECK http://w.y5.z/
-CHECK http://w.y5.z/Foo Cookie: some_value=value1
-CHECK http://w.y5.z/FooBar
-CHECK http://w.y5.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y5.z/Foo/bar Cookie: some_value=value1
-CHECK http://w.y6.z/Foo/Bar Cookie: some_value2=value2; some_value=value1; some_value3=value3
-CHECK http://w.y7.z/Bar/Foo Cookie: some_value=value2; some_value=value3
-CHECK http://w.y7.z/Foo/Bar Cookie: some_value=value1; some_value=value3
-CHECK https://secure.y7.z/Foo/bar Cookie: some_value2=value2
-CHECK http://secure.y7.z/Foo/bar
-CHECK https://secure.y8.z/Foo/bar Cookie: some_value3=value3
-CHECK http://secure.y8.z/Foo/bar
-CHECK http://www.acme9.com/ Cookie: some_value=value1
-CHECK http://www.abc9.com/
-CHECK http://frop.acme9.com/ Cookie: some_value=value1
-CHECK http://novell10.com/ Cookie: some_value=value1
-CHECK http://www.novell10.com/ Cookie: some_value=value1
-CHECK http://novell11.com/ Cookie: some_value=value1
-CHECK http://www.novell11.com/ Cookie: some_value=value1
-CHECK http://novell12.com/ Cookie: some_value=value1
-CHECK http://www.novell12.com/
-CHECK http://novell13.com/ Cookie: some_value=value1
-CHECK http://www.novell13.com/
-CHECK http://com/
-CHECK http://sun13.com/
-CHECK http://novell14.co.uk/ Cookie: some_value=value1
-CHECK http://www.novell14.co.uk/
-CHECK http://co.uk/
-CHECK http://sun14.co.uk/
-CHECK http://x.y.z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://y.z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://www.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://x.y.z.foobar15.com/
-CHECK http://y.z.foobar15.com/
-CHECK http://z.foobar15.com/
-CHECK http://www.foobar15.com/
-CHECK http://foobar15.com/
-CHECK http://x.y.z.foobar16.com/
-CHECK http://y.z.foobar16.com/
-CHECK http://z.foobar16.com/
-CHECK http://www.foobar16.com/
-CHECK http://foobar16.com/
-## Check results for RFC cookies
-CHECK http://w.y20.z/ Cookie: $Version=1; some_value="value1"; $Path="/"
-CHECK http://a.b20.c/ Cookie: $Version=1; some_value="value2"; $Path="/"
-CHECK http://w.y21.z/ Cookie: $Version=1; some_value="extra space 2"
-CHECK http://a.b21.c/ Cookie: $Version=1; some_value="quoted value; and such"
-CHECK http://w.y22.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"
-CHECK http://w.y23.z/
-CHECK http://w.y23.z/Foo Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y23.z/Foo/ Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y23.z/Foo/bar Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y24.z/
-CHECK http://w.y24.z/Foo Cookie: $Version=1; some_value=value1
-CHECK http://w.y24.z/FooBar
-CHECK http://w.y24.z/Foo/ Cookie: $Version=1; some_value=value1
-CHECK http://w.y24.z/Foo/bar Cookie: $Version=1; some_value=value1
-CHECK http://w.y25.z/Foo/Bar Cookie: $Version=1; some_value2=value2; $Path="/Foo/Bar"; some_value=value1; $Path="/Foo"; some_value3=value3; $Path="/"
-CHECK http://w.y26.z/Bar/Foo Cookie: $Version=1; some_value=value2; some_value=value3
-CHECK http://w.y26.z/Foo/Bar Cookie: $Version=1; some_value=value1; some_value=value3
-CHECK https://secure.y26.z/Foo/bar Cookie: $Version=1; some_value2=value2; $Path="/"
-CHECK http://secure.y26.z/Foo/bar
-CHECK https://secure.y27.z/Foo/bar Cookie: $Version=1; some_value3=value3; $Path="/"
-CHECK http://secure.y27.z/Foo/bar
-CHECK http://www.acme28.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme28.com"
-CHECK http://www.abc28.com/
-CHECK http://frop.acme28.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme28.com"
-CHECK http://novell29.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell29.com"
-CHECK http://www.novell29.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell29.com"
-CHECK http://novell30.com/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell30.com/
-CHECK http://novell31.com/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell31.com/
-CHECK http://com/
-CHECK http://sun31.com/
-CHECK http://novell32.co.uk/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell32.co.uk/
-CHECK http://co.uk/
-CHECK http://sun32.co.uk/
-CHECK http://x.y.z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://y.z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://www.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-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/
-CHECK http://ports.foo.bar.com Cookie: $Version=1; name=value1; $Port="80 8080 443"
-
-SAVE
-## Check result after saving
-CHECK http://w.y.z/
-CHECK http://a.b.c/
-CHECK http://w.y1.z/ Cookie: some_value=value with spaces
-CHECK http://a.b1.c/ Cookie: some_value="quoted value"; some_other_value
-CHECK http://a.b2.c/ Cookie: some_value="quoted value
-CHECK http://w.y3.z/ Cookie: some_value2=foobar
-CHECK http://w.y4.z/
-CHECK http://w.y4.z/Foo Cookie: some_value=value1
-CHECK http://w.y4.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y4.z/Foo/bar Cookie: some_value=value1
-CHECK http://w.y5.z/
-CHECK http://w.y5.z/Foo Cookie: some_value=value1
-CHECK http://w.y5.z/FooBar
-CHECK http://w.y5.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y5.z/Foo/bar Cookie: some_value=value1
-CHECK http://w.y6.z/Foo/Bar Cookie: some_value2=value2; some_value=value1; some_value3=value3
-CHECK http://w.y7.z/Bar/Foo Cookie: some_value=value2; some_value=value3
-CHECK http://w.y7.z/Foo/Bar Cookie: some_value=value1; some_value=value3
-CHECK https://secure.y7.z/Foo/bar Cookie: some_value2=value2
-CHECK http://secure.y7.z/Foo/bar
-CHECK https://secure.y8.z/Foo/bar Cookie: some_value3=value3
-CHECK http://secure.y8.z/Foo/bar
-CHECK http://www.acme9.com/ Cookie: some_value=value1
-CHECK http://www.abc9.com/
-CHECK http://frop.acme9.com/ Cookie: some_value=value1
-CHECK http://novell10.com/ Cookie: some_value=value1
-CHECK http://www.novell10.com/ Cookie: some_value=value1
-CHECK http://novell11.com/ Cookie: some_value=value1
-CHECK http://www.novell11.com/ Cookie: some_value=value1
-CHECK http://novell12.com/ Cookie: some_value=value1
-CHECK http://www.novell12.com/
-CHECK http://novell13.com/ Cookie: some_value=value1
-CHECK http://www.novell13.com/
-CHECK http://com/
-CHECK http://sun13.com/
-CHECK http://novell14.co.uk/ Cookie: some_value=value1
-CHECK http://www.novell14.co.uk/
-CHECK http://co.uk/
-CHECK http://sun14.co.uk/
-CHECK http://x.y.z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://y.z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://www.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://x.y.z.foobar15.com/
-CHECK http://y.z.foobar15.com/
-CHECK http://z.foobar15.com/
-CHECK http://www.foobar15.com/
-CHECK http://foobar15.com/
-CHECK http://x.y.z.foobar16.com/
-CHECK http://y.z.foobar16.com/
-CHECK http://z.foobar16.com/
-CHECK http://www.foobar16.com/
-CHECK http://foobar16.com/
-## Check result for RFC cookies after saving
-CHECK http://w.y20.z/ Cookie: $Version=1; some_value="value1"; $Path="/"
-CHECK http://a.b20.c/ Cookie: $Version=1; some_value="value2"; $Path="/"
-CHECK http://w.y21.z/ Cookie: $Version=1; some_value="extra space 2"
-CHECK http://a.b21.c/ Cookie: $Version=1; some_value="quoted value; and such"
-CHECK http://w.y22.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"
-CHECK http://w.y23.z/
-CHECK http://w.y23.z/Foo Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y23.z/Foo/ Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y23.z/Foo/bar Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y24.z/
-CHECK http://w.y24.z/Foo Cookie: $Version=1; some_value=value1
-CHECK http://w.y24.z/FooBar
-CHECK http://w.y24.z/Foo/ Cookie: $Version=1; some_value=value1
-CHECK http://w.y24.z/Foo/bar Cookie: $Version=1; some_value=value1
-CHECK http://w.y25.z/Foo/Bar Cookie: $Version=1; some_value2=value2; $Path="/Foo/Bar"; some_value=value1; $Path="/Foo"; some_value3=value3; $Path="/"
-CHECK http://w.y26.z/Bar/Foo Cookie: $Version=1; some_value=value2; some_value=value3
-CHECK http://w.y26.z/Foo/Bar Cookie: $Version=1; some_value=value1; some_value=value3
-CHECK https://secure.y26.z/Foo/bar Cookie: $Version=1; some_value2=value2; $Path="/"
-CHECK http://secure.y26.z/Foo/bar
-CHECK https://secure.y27.z/Foo/bar Cookie: $Version=1; some_value3=value3; $Path="/"
-CHECK http://secure.y27.z/Foo/bar
-CHECK http://www.acme28.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme28.com"
-CHECK http://www.abc28.com/
-CHECK http://frop.acme28.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme28.com"
-CHECK http://novell29.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell29.com"
-CHECK http://www.novell29.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell29.com"
-CHECK http://novell30.com/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell30.com/
-CHECK http://novell31.com/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell31.com/
-CHECK http://com/
-CHECK http://sun31.com/
-CHECK http://novell32.co.uk/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell32.co.uk/
-CHECK http://co.uk/
-CHECK http://sun32.co.uk/
-CHECK http://x.y.z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://y.z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://www.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-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/
-CHECK http://ports.foo.bar.com Cookie: $Version=1; name=value1; $Port="80 8080 443"
-
-SAVE
-## Check result after saving a second time
-CHECK http://w.y.z/
-CHECK http://a.b.c/
-CHECK http://w.y1.z/ Cookie: some_value=value with spaces
-CHECK http://a.b1.c/ Cookie: some_value="quoted value"; some_other_value
-CHECK http://a.b2.c/ Cookie: some_value="quoted value
-CHECK http://w.y3.z/ Cookie: some_value2=foobar
-CHECK http://w.y4.z/
-CHECK http://w.y4.z/Foo Cookie: some_value=value1
-CHECK http://w.y4.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y4.z/Foo/bar Cookie: some_value=value1
-CHECK http://w.y5.z/
-CHECK http://w.y5.z/Foo Cookie: some_value=value1
-CHECK http://w.y5.z/FooBar
-CHECK http://w.y5.z/Foo/ Cookie: some_value=value1
-CHECK http://w.y5.z/Foo/bar Cookie: some_value=value1
-CHECK http://w.y6.z/Foo/Bar Cookie: some_value2=value2; some_value=value1; some_value3=value3
-CHECK http://w.y7.z/Bar/Foo Cookie: some_value=value2; some_value=value3
-CHECK http://w.y7.z/Foo/Bar Cookie: some_value=value1; some_value=value3
-CHECK https://secure.y7.z/Foo/bar Cookie: some_value2=value2
-CHECK http://secure.y7.z/Foo/bar
-CHECK https://secure.y8.z/Foo/bar Cookie: some_value3=value3
-CHECK http://secure.y8.z/Foo/bar
-CHECK http://www.acme9.com/ Cookie: some_value=value1
-CHECK http://www.abc9.com/
-CHECK http://frop.acme9.com/ Cookie: some_value=value1
-CHECK http://novell10.com/ Cookie: some_value=value1
-CHECK http://www.novell10.com/ Cookie: some_value=value1
-CHECK http://novell11.com/ Cookie: some_value=value1
-CHECK http://www.novell11.com/ Cookie: some_value=value1
-CHECK http://novell12.com/ Cookie: some_value=value1
-CHECK http://www.novell12.com/
-CHECK http://novell13.com/ Cookie: some_value=value1
-CHECK http://www.novell13.com/
-CHECK http://com/
-CHECK http://sun13.com/
-CHECK http://novell14.co.uk/ Cookie: some_value=value1
-CHECK http://www.novell14.co.uk/
-CHECK http://co.uk/
-CHECK http://sun14.co.uk/
-CHECK http://x.y.z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://y.z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://z.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://www.foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://foobar14.com/ Cookie: set_by=x.y.z.foobar14.com
-CHECK http://x.y.z.foobar15.com/
-CHECK http://y.z.foobar15.com/
-CHECK http://z.foobar15.com/
-CHECK http://www.foobar15.com/
-CHECK http://foobar15.com/
-CHECK http://x.y.z.foobar16.com/
-CHECK http://y.z.foobar16.com/
-CHECK http://z.foobar16.com/
-CHECK http://www.foobar16.com/
-CHECK http://foobar16.com/
-## Check result for rfc cookies after saving a second time
-CHECK http://w.y20.z/ Cookie: $Version=1; some_value="value1"; $Path="/"
-CHECK http://a.b20.c/ Cookie: $Version=1; some_value="value2"; $Path="/"
-CHECK http://w.y21.z/ Cookie: $Version=1; some_value="extra space 2"
-CHECK http://a.b21.c/ Cookie: $Version=1; some_value="quoted value; and such"
-CHECK http://w.y22.z/ Cookie: $Version=1; some_value2=foobar; $Path="/"
-CHECK http://w.y23.z/
-CHECK http://w.y23.z/Foo Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y23.z/Foo/ Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y23.z/Foo/bar Cookie: $Version=1; some_value=value1; $Path="/Foo"
-CHECK http://w.y24.z/
-CHECK http://w.y24.z/Foo Cookie: $Version=1; some_value=value1
-CHECK http://w.y24.z/FooBar
-CHECK http://w.y24.z/Foo/ Cookie: $Version=1; some_value=value1
-CHECK http://w.y24.z/Foo/bar Cookie: $Version=1; some_value=value1
-CHECK http://w.y25.z/Foo/Bar Cookie: $Version=1; some_value2=value2; $Path="/Foo/Bar"; some_value=value1; $Path="/Foo"; some_value3=value3; $Path="/"
-CHECK http://w.y26.z/Bar/Foo Cookie: $Version=1; some_value=value2; some_value=value3
-CHECK http://w.y26.z/Foo/Bar Cookie: $Version=1; some_value=value1; some_value=value3
-CHECK https://secure.y26.z/Foo/bar Cookie: $Version=1; some_value2=value2; $Path="/"
-CHECK http://secure.y26.z/Foo/bar
-CHECK https://secure.y27.z/Foo/bar Cookie: $Version=1; some_value3=value3; $Path="/"
-CHECK http://secure.y27.z/Foo/bar
-CHECK http://www.acme28.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme28.com"
-CHECK http://www.abc28.com/
-CHECK http://frop.acme28.com/ Cookie: $Version=1; some_value=value1; $Domain=".acme28.com"
-CHECK http://novell29.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell29.com"
-CHECK http://www.novell29.com/ Cookie: $Version=1; some_value=value1; $Domain=".novell29.com"
-CHECK http://novell30.com/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell30.com/
-CHECK http://novell31.com/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell31.com/
-CHECK http://com/
-CHECK http://sun31.com/
-CHECK http://novell32.co.uk/ Cookie: $Version=1; some_value=value1
-CHECK http://www.novell32.co.uk/
-CHECK http://co.uk/
-CHECK http://sun32.co.uk/
-CHECK http://x.y.z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://y.z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://z.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://www.foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-CHECK http://foobar33.com/ Cookie: $Version=1; set_by=x.y.z.foobar.com; $Domain=".foobar33.com"
-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/
-CHECK http://ports.foo.bar.com Cookie: $Version=1; name=value1; $Port="80 8080 443"
diff --git a/autotests/kcookiejar/cookie_session.test b/autotests/kcookiejar/cookie_session.test
deleted file mode 100644
index 2122660965..0000000000
--- a/autotests/kcookiejar/cookie_session.test
+++ /dev/null
@@ -1,51 +0,0 @@
-## Check that persistent cookies are not deleted at the end of the session
-CLEAR CONFIG
-CONFIG CookieGlobalAdvice Accept
-COOKIE ACCEPT http://a.example1.net/ Set-Cookie: some_value=value1; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://a.example2.net/ Set-Cookie: some_value=value2; Path="/"; max-age="600"
-CHECK http://a.example1.net/ Cookie: some_value=value1
-CHECK http://a.example2.net/ Cookie: some_value=value2
-ENDSESSION
-CHECK http://a.example1.net/ Cookie: some_value=value1
-CHECK http://a.example2.net/ Cookie: some_value=value2
-CONFIG CookieGlobalAdvice Reject
-CONFIG CookieDomainAdvice a.example3.net:Accept,.example4.net:Accept
-COOKIE ACCEPT http://a.example3.net/ Set-Cookie: some_value=value3; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://a.example4.net/ Set-Cookie: some_value=value4; Path="/"; expires=%NEXTYEAR%
-CHECK http://a.example3.net/ Cookie: some_value=value3
-CHECK http://a.example4.net/ Cookie: some_value=value4
-ENDSESSION
-CHECK http://a.example3.net/ Cookie: some_value=value3
-CHECK http://a.example4.net/ Cookie: some_value=value4
-## Check that non persistent cookies are deleted at the end of the session
-CLEAR CONFIG
-CONFIG CookieGlobalAdvice Accept
-COOKIE ACCEPT http://x.example1.net/ Set-Cookie: some_value=value1; Path="/"
-CHECK http://x.example1.net/ Cookie: some_value=value1
-ENDSESSION
-CHECK http://x.example1.net/
-CONFIG CookieGlobalAdvice AcceptForSession
-COOKIE ACCEPTFORSESSION http://x.example2.net/ Set-Cookie: some_value=value2; Path="/"
-COOKIE ACCEPTFORSESSION http://x.example3.net/ Set-Cookie: some_value=value3; Path="/"; expires=%NEXTYEAR%
-CHECK http://x.example2.net/ Cookie: some_value=value2
-CHECK http://x.example3.net/ Cookie: some_value=value3
-ENDSESSION
-CHECK http://x.example2.net/
-CHECK http://x.example3.net/
-CONFIG CookieGlobalAdvice Reject
-CONFIG CookieDomainAdvice x.example4.net:AcceptForSession,.example5.net:AcceptForSession,x.y.example6.net:AcceptForSession,.y.example6.net:Accept
-COOKIE ACCEPTFORSESSION http://x.example4.net/ Set-Cookie: some_value=value4; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPTFORSESSION http://x.example5.net/ Set-Cookie: some_value=value5; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPTFORSESSION http://x.y.example6.net/ Set-Cookie: some_value=value6; Path="/"; expires=%NEXTYEAR%
-CHECK http://x.example4.net/ Cookie: some_value=value4
-CHECK http://x.example5.net/ Cookie: some_value=value5
-CHECK http://x.y.example6.net/ Cookie: some_value=value6
-ENDSESSION
-CHECK http://x.example4.net/
-CHECK http://x.example5.net/
-CHECK http://x.y.example6.net/
-CONFIG AcceptSessionCookies true
-COOKIE ACCEPT http://x.example7.net/ Set-Cookie: some_value=value7; Path="/"
-CHECK http://x.example7.net/ Cookie: some_value=value7
-ENDSESSION
-CHECK http://x.example7.net/
diff --git a/autotests/kcookiejar/cookie_settings.test b/autotests/kcookiejar/cookie_settings.test
deleted file mode 100644
index 8a014cf9ad..0000000000
--- a/autotests/kcookiejar/cookie_settings.test
+++ /dev/null
@@ -1,112 +0,0 @@
-## Check CookieGlobalAdvice setting
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value1; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value2; Path="/"
-CONFIG CookieGlobalAdvice Reject
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value3; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value4; Path="/"
-CONFIG CookieGlobalAdvice Accept
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value5; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value6; Path="/"
-CONFIG CookieGlobalAdvice AcceptForSession
-COOKIE ACCEPTFORSESSION http://a.b.c/ Set-Cookie: some_value=value5; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPTFORSESSION http://a.b.c/ Set-Cookie: some_value=value6; Path="/"
-CONFIG CookieGlobalAdvice Ask
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value7; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value8; Path="/"
-CONFIG AcceptSessionCookies true
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-# FIXME: Shouldn't this be considered a session cookie?
-# COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="0"
-# COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%LASTYEAR%
-# FIXME: The 'Discard' attribute makes the cookie a session cookie
-# COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-## Check host-based domain policies
-CONFIG AcceptSessionCookies false
-CONFIG CookieDomainAdvice a.b.c:Reject
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE ASK http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ASK http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ASK http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check resetting of domain policies
-CONFIG CookieDomainAdvice
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ASK http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE ASK http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ASK http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ASK http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check domain policies
-CONFIG CookieDomainAdvice .b.c:Reject
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE REJECT http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE REJECT http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE REJECT http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check overriding of domain policies #1
-CONFIG CookieDomainAdvice .b.c:Reject,a.b.c:Accept
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE REJECT http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE REJECT http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE REJECT http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check overriding of domain policies #2
-CONFIG CookieDomainAdvice a.b.c:Reject,.b.c:Accept
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE ACCEPT http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ACCEPT http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ACCEPT http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check resetting of domain policies
-CONFIG CookieDomainAdvice
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ASK http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ASK http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE ASK http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ASK http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ASK http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check overriding of domain policies #3
-CONFIG CookieDomainAdvice b.c:Reject,.b.c:Accept
-COOKIE REJECT http://b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE REJECT http://b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE REJECT http://b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-## Check overriding of domain policies #4
-CONFIG CookieDomainAdvice .a.b.c.d:Reject,.b.c.d:Accept,.c.d:Ask
-COOKIE REJECT http://www.a.b.c.d/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ACCEPT http://www.b.c.d/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE ASK http://www.c.d/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-## Check interaction with session policy
-CONFIG AcceptSessionCookies true
-CONFIG CookieDomainAdvice .b.c:Reject
-COOKIE REJECT http://a.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://a.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ACCEPT http://a.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
-COOKIE REJECT http://d.b.c/ Set-Cookie: some_value=value9; Path="/"; expires=%NEXTYEAR%
-COOKIE REJECT http://d.b.c/ Set-Cookie2: some_value=value10; Version=1; Path="/"; max-age="600"
-COOKIE ACCEPT http://d.b.c/ Set-Cookie: some_value=value11; Path="/"
-COOKIE ACCEPT http://d.b.c/ Set-Cookie2: some_value=value12; Version=1; Path="/"
diff --git a/autotests/kcookiejar/kcookiejartest.cpp b/autotests/kcookiejar/kcookiejartest.cpp
deleted file mode 100644
index 9a2fcafc69..0000000000
--- a/autotests/kcookiejar/kcookiejartest.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- This file is part of KDE
-
- SPDX-FileCopyrightText: 2004 Waldo Bastian <bastian at kde.org>
- SPDX-FileCopyrightText: 2008 David Faure <faure at kde.org>
-
- SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only
-*/
-
-#include <QDate>
-#include <QString>
-
-#include <QStandardPaths>
-#include <QTest>
-#include <qplatformdefs.h>
-
-#include "../../src/kioworkers/http/kcookiejar/kcookiejar.cpp"
-
-static KCookieJar *jar;
-static QString *lastYear;
-static QString *nextYear;
-static KConfig *config = nullptr;
-static int windowId = 1234; // random number to be used as windowId for test cookies
-
-static void popArg(QString &command, QString &line)
-{
- int i = line.indexOf(' ');
- if (i != -1) {
- command = line.left(i);
- line = line.mid(i + 1);
- } else {
- command = line;
- line.clear();
- }
-}
-
-static void clearConfig()
-{
- delete config;
- QString file = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "kcookiejar-testconfig";
- QFile::remove(file);
- config = new KConfig(file);
- KConfigGroup cg(config, "Cookie Policy");
- cg.writeEntry("RejectCrossDomainCookies", false);
- cg.writeEntry("AcceptSessionCookies", false);
- cg.writeEntry("CookieGlobalAdvice", "Ask");
- jar->loadConfig(config, false);
-}
-
-static void clearCookies(bool sessionOnly = false)
-{
- if (sessionOnly) {
- jar->eatSessionCookies(windowId);
- } else {
- jar->eatAllCookies();
- }
-}
-
-static void saveCookies()
-{
- QString file = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + "kcookiejar-testcookies";
- QFile::remove(file);
- jar->saveCookies(file);
-
- // Add an empty domain to the cookies file, just for testing robustness
- QFile f(file);
- f.open(QIODevice::Append);
- f.write("[]\n \"\" \"/\" 1584320400 0 h 4 x\n");
- f.close();
-
- delete jar;
- jar = new KCookieJar();
- clearConfig();
- jar->loadCookies(file);
-}
-
-static void endSession()
-{
- jar->eatSessionCookies(windowId);
-}
-
-static void processCookie(QString &line)
-{
- QString policy;
- popArg(policy, line);
- KCookieAdvice expectedAdvice = KCookieJar::strToAdvice(policy);
- if (expectedAdvice == KCookieDunno) {
- QFAIL(qPrintable(QStringLiteral("Unknown accept policy '%1'").arg(policy)));
- }
-
- QString urlStr;
- popArg(urlStr, line);
- QUrl url(urlStr);
- if (!url.isValid()) {
- QFAIL(qPrintable(QStringLiteral("Invalid URL '%1'").arg(urlStr)));
- }
- if (url.isEmpty()) {
- QFAIL(qPrintable(QStringLiteral("Missing URL")));
- }
-
- line.replace(QLatin1String("%LASTYEAR%"), *lastYear);
- line.replace(QLatin1String("%NEXTYEAR%"), *nextYear);
-
- KHttpCookieList list = jar->makeCookies(urlStr, line.toUtf8(), windowId);
-
- if (list.isEmpty()) {
- QFAIL(qPrintable(QStringLiteral("Failed to make cookies from: '%1'").arg(line)));
- }
-
- for (KHttpCookieList::iterator cookieIterator = list.begin(); cookieIterator != list.end(); ++cookieIterator) {
- KHttpCookie &cookie = *cookieIterator;
- const KCookieAdvice cookieAdvice = jar->cookieAdvice(cookie);
- if (cookieAdvice != expectedAdvice) {
- QFAIL(qPrintable(urlStr
- + QStringLiteral("\n'%2'\nGot advice '%3' expected '%4'")
- .arg(line, KCookieJar::adviceToStr(cookieAdvice), KCookieJar::adviceToStr(expectedAdvice))));
- }
- jar->addCookie(cookie);
- }
-}
-
-static void processCheck(QString &line)
-{
- QString urlStr;
- popArg(urlStr, line);
- QUrl url(urlStr);
- if (!url.isValid()) {
- QFAIL(qPrintable(QStringLiteral("Invalid URL '%1'").arg(urlStr)));
- }
- if (url.isEmpty()) {
- QFAIL(qPrintable(QStringLiteral("Missing URL")));
- }
-
- QString expectedCookies = line;
-
- QString cookies = jar->findCookies(urlStr, false, windowId, nullptr).trimmed();
- if (cookies != expectedCookies) {
- QFAIL(qPrintable(urlStr + QStringLiteral("\nGot '%1' expected '%2'").arg(cookies, expectedCookies)));
- }
-}
-
-static void processClear(QString &line)
-{
- if (line == QLatin1String("CONFIG")) {
- clearConfig();
- } else if (line == QLatin1String("COOKIES")) {
- clearCookies();
- } else if (line == QLatin1String("SESSIONCOOKIES")) {
- clearCookies(true);
- } else {
- QFAIL(qPrintable(QStringLiteral("Unknown command 'CLEAR %1'").arg(line)));
- }
-}
-
-static void processConfig(QString &line)
-{
- QString key;
- popArg(key, line);
-
- if (key.isEmpty()) {
- QFAIL(qPrintable(QStringLiteral("Missing Key")));
- }
-
- KConfigGroup cg(config, "Cookie Policy");
- cg.writeEntry(key, line);
- jar->loadConfig(config, false);
-}
-
-static void processLine(QString line)
-{
- if (line.isEmpty()) {
- return;
- }
-
- if (line[0] == '#') {
- if (line[1] == '#') {
- qDebug().noquote() << line;
- }
- return;
- }
-
- QString command;
- popArg(command, line);
- if (command.isEmpty()) {
- return;
- }
-
- if (command == QLatin1String("COOKIE")) {
- processCookie(line);
- } else if (command == QLatin1String("CHECK")) {
- processCheck(line);
- } else if (command == QLatin1String("CLEAR")) {
- processClear(line);
- } else if (command == QLatin1String("CONFIG")) {
- processConfig(line);
- } else if (command == QLatin1String("SAVE")) {
- saveCookies();
- } else if (command == QLatin1String("ENDSESSION")) {
- endSession();
- } else {
- QFAIL(qPrintable(QStringLiteral("Unknown command '%1'").arg(command)));
- }
-}
-
-class KCookieJarTest : public QObject
-{
- Q_OBJECT
-private Q_SLOTS:
- void initTestCase()
- {
- QStandardPaths::setTestModeEnabled(true);
- jar = new KCookieJar;
- QDateTime dt = QDateTime::currentDateTime();
- lastYear = new QString(dt.addYears(-1).toString(Qt::RFC2822Date));
- nextYear = new QString(dt.addYears(1).toString(Qt::RFC2822Date));
- }
- void testCookieFile_data()
- {
- QTest::addColumn<QString>("fileName");
- QTest::newRow("cookie.test") << QFINDTESTDATA("cookie.test");
- QTest::newRow("cookie_rfc.test") << QFINDTESTDATA("cookie_rfc.test");
- QTest::newRow("cookie_saving.test") << QFINDTESTDATA("cookie_saving.test");
- QTest::newRow("cookie_settings.test") << QFINDTESTDATA("cookie_settings.test");
- QTest::newRow("cookie_session.test") << QFINDTESTDATA("cookie_session.test");
- }
- void testCookieFile()
- {
- QFETCH(QString, fileName);
- clearConfig();
-
- QFile file(fileName);
- QVERIFY2(file.open(QIODevice::ReadOnly), qPrintable(fileName));
- while (!file.atEnd()) {
- const QByteArray buf = file.readLine().chopped(1);
- processLine(QString::fromUtf8(buf));
- }
- }
-
- void testParseUrl_data()
- {
- QTest::addColumn<QString>("url");
- QTest::addColumn<bool>("expectedResult");
- QTest::addColumn<QString>("expectedFqdn");
- QTest::addColumn<QString>("expectedPath");
- QTest::newRow("empty") << "" << false << ""
- << "";
- QTest::newRow("url with no path") << "http://bugs.kde.org" << true << "bugs.kde.org"
- << "/";
- QTest::newRow("url with path") << "http://bugs.kde.org/foo" << true << "bugs.kde.org"
- << "/foo";
- QTest::newRow("just a host") << "bugs.kde.org" << false << ""
- << "";
- }
- void testParseUrl()
- {
- QFETCH(QString, url);
- QFETCH(bool, expectedResult);
- QFETCH(QString, expectedFqdn);
- QFETCH(QString, expectedPath);
- QString fqdn;
- QString path;
- bool result = KCookieJar::parseUrl(url, fqdn, path);
- QCOMPARE(result, expectedResult);
- QCOMPARE(fqdn, expectedFqdn);
- QCOMPARE(path, expectedPath);
- }
-
- void testExtractDomains_data()
- {
- QTest::addColumn<QString>("fqdn");
- QTest::addColumn<QStringList>("expectedDomains");
- QTest::newRow("empty") << "" << (QStringList() << QStringLiteral("localhost"));
- QTest::newRow("ipv4") << "1.2.3.4" << (QStringList() << QStringLiteral("1.2.3.4"));
- QTest::newRow("ipv6") << "[fe80::213:d3ff:fef4:8c92]" << (QStringList() << QStringLiteral("[fe80::213:d3ff:fef4:8c92]"));
- QTest::newRow("bugs.kde.org") << "bugs.kde.org"
- << (QStringList() << QStringLiteral("bugs.kde.org") << QStringLiteral(".bugs.kde.org") << QStringLiteral("kde.org")
- << QStringLiteral(".kde.org"));
- }
- void testExtractDomains()
- {
- QFETCH(QString, fqdn);
- QFETCH(QStringList, expectedDomains);
- KCookieJar jar;
- QStringList lst;
- jar.extractDomains(fqdn, lst);
- QCOMPARE(lst, expectedDomains);
- }
-};
-
-QTEST_MAIN(KCookieJarTest)
-
-#include "kcookiejartest.moc"
diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt
index d4e97e07db..692a8accc5 100644
--- a/docs/CMakeLists.txt
+++ b/docs/CMakeLists.txt
@@ -1,2 +1 @@
-add_subdirectory(kcookiejar5)
add_subdirectory(kioworker6)
diff --git a/docs/kcookiejar5/CMakeLists.txt b/docs/kcookiejar5/CMakeLists.txt
deleted file mode 100644
index cd936183b3..0000000000
--- a/docs/kcookiejar5/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-kdoctools_create_manpage(man-kcookiejar5.8.docbook 8 INSTALL_DESTINATION ${KDE_INSTALL_MANDIR})
diff --git a/docs/kcookiejar5/man-kcookiejar5.8.docbook b/docs/kcookiejar5/man-kcookiejar5.8.docbook
deleted file mode 100644
index 2c949cbec8..0000000000
--- a/docs/kcookiejar5/man-kcookiejar5.8.docbook
+++ /dev/null
@@ -1,149 +0,0 @@
-<?xml version="1.0" ?>
-<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
- <!ENTITY % English "INCLUDE"><!-- change language only here -->
-]>
-
-<refentry lang="&language;">
-
-<refentryinfo>
-<title>kcookiejar5 User's Manual</title>
-<author>
-<firstname>Waldo</firstname>
-<surname> Bastian</surname>
-<affiliation>
-<address><email>bastian at kde.org</email></address>
-</affiliation>
-</author>
-
-<author>
-<firstname>Dawit</firstname>
-<surname>Alemayehu</surname>
-<affiliation>
-<address><email>adawit at kde.org</email></address>
-</affiliation>
-</author>
-
-<date>2015-07-31</date>
-<releaseinfo>Frameworks 5.13</releaseinfo>
-
-</refentryinfo>
-
-<refmeta>
-<refentrytitle><command>kcookiejar5</command></refentrytitle>
-<manvolnum>8</manvolnum>
-</refmeta>
-
-<refnamediv>
-<refname><command>kcookiejar5</command></refname>
-<refpurpose>Command line interface to the &kde; &HTTP; cookie daemon</refpurpose>
-</refnamediv>
-
-<refsynopsisdiv>
-<title>Synopsis</title>
-
-<cmdsynopsis>
-<command>kcookiejar5</command>
-
-<arg choice="opt">-h, --help</arg>
-<arg choice="opt">-v, --version</arg>
-<arg choice="opt">--shutdown</arg>
-<arg choice="opt">--remove<replaceable> domain</replaceable></arg>
-<arg choice="opt">--remove-all</arg>
-<arg choice="opt">--reload-config</arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-<refsect1>
-<title>Description</title>
-
-<para><command>kcookiejar5</command> is a command line interface to the &HTTP; cookie store used by &kde;,
-a &DBus; service to store/retrieve/clean cookies.
-</para>
-</refsect1>
-
-<refsect1>
-<title>Options</title>
-
-<variablelist>
-
-<varlistentry>
-<term><option>-h</option><option>--help</option></term>
-<listitem>
-<para>Show help about options.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>-v</option><option>--version</option></term>
-<listitem>
-<para>Show version information.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--shutdown</option></term>
-<listitem>
-<para>Shut down cookie jar and the &DBus; service.
-</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--remove</option> <parameter>domain</parameter></term>
-<listitem>
-<para>
-Removes cookies for <parameter>domain</parameter> from the cookie jar.
-</para>
-</listitem>
-</varlistentry>
-
-
-<varlistentry>
-<term><option>--remove-all</option></term>
-<listitem>
-<para>Removes all the cookies from the cookie jar.</para>
-</listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--reaload-config</option></term>
-<listitem>
-<para>
-Reloads the configuration file.
-</para>
-</listitem>
-</varlistentry>
-
-</variablelist>
-
-</refsect1>
-
-<refsect1>
-<title>Usage</title>
-<para><command>kcookiejar5</command> is a command line tool to access the kded module which manages cookies in &konqueror; and other &kde; applications.</para>
-<para>
-When started without parameters it loads the kded module to provide the &DBus; interface to store cookies.
-</para>
-<para>
-When <command>kcookiejar5</command> is started with some parameters, it does
-additional tasks to the cookies jar it provides, like removing the cookies from one
-<parameter>domain</parameter>.
-</para>
-
-</refsect1>
-
-<refsect1>
-<title>See Also</title>
-<para><replaceable>kf5options</replaceable>(7), <replaceable>qt5options</replaceable>(7)
-</para>
-</refsect1>
-
-<refsect1>
-<title>Bugs</title>
-<para>Please use <ulink url="https://bugs.kde.org">&kde;'s bugtracker</ulink> to report bugs.</para>
-</refsect1>
-
-</refentry>
-
-
-
diff --git a/src/kioworkers/http/CMakeLists.txt b/src/kioworkers/http/CMakeLists.txt
index fae2b0491d..56135c7d3e 100644
--- a/src/kioworkers/http/CMakeLists.txt
+++ b/src/kioworkers/http/CMakeLists.txt
@@ -20,10 +20,6 @@ endif()
configure_file(config-gssapi.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-gssapi.h )
-if (NOT KIOCORE_ONLY)
-add_subdirectory( kcookiejar )
-endif()
-
########### next target ###############
add_executable(kio_http_cache_cleaner)
diff --git a/src/kioworkers/http/kcookiejar/CMakeLists.txt b/src/kioworkers/http/kcookiejar/CMakeLists.txt
deleted file mode 100644
index 91b08c62e0..0000000000
--- a/src/kioworkers/http/kcookiejar/CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-####### kcookiejar: command line tool for talking to the kded kcookiejar module #######
-add_executable( kcookiejar5)
-ecm_mark_nongui_executable(kcookiejar5)
-
-qt_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/kcookieserver.h org.kde.KCookieServer.xml)
-set(kcookieserver_xml ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KCookieServer.xml)
-set_source_files_properties(${kcookieserver_xml} PROPERTIES INCLUDE "kcookiejar_include.h")
-set(kcookiejar_dbus_SRCS)
-qt_add_dbus_interfaces(kcookiejar_dbus_SRCS ${kcookieserver_xml})
-
-configure_file(config-kcookiejar.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-kcookiejar.h )
-
-target_sources(kcookiejar5 PRIVATE
- ${kcookiejar_dbus_SRCS}
- main.cpp
-)
-
-target_link_libraries( kcookiejar5
- Qt6::DBus
- KF6::I18n
- KF6::WidgetsAddons
-)
-
-install(TARGETS kcookiejar5 ${KF_INSTALL_TARGETS_DEFAULT_ARGS} )
-
-########### kded kcookiejar module ###############
-
-kcoreaddons_add_plugin(kded_kcookiejar
- INSTALL_NAMESPACE "kf6/kded"
-)
-set_target_properties(kded_kcookiejar PROPERTIES
- OUTPUT_NAME kcookiejar
-)
-
-set(kded_kcookiejar_dbus_SRCS)
-qt_add_dbus_adaptor(kded_kcookiejar_dbus_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.KCookieServer.xml kcookieserver.h KCookieServer)
-
-target_sources(kded_kcookiejar PRIVATE
- ${kded_kcookiejar_dbus_SRCS}
- kcookiejar.cpp
- kcookieserver.cpp
- kcookiewin.cpp
-)
-
-ecm_qt_export_logging_category(
- IDENTIFIER KIO_COOKIEJAR
- CATEGORY_NAME kf.kio.workers.http.cookiejar
- OLD_CATEGORY_NAMES kf5.kio.cookiejar kf.kio.slaves.http.cookiejar
- DESCRIPTION "kcookiejar (KIO)"
- EXPORT KIO
-)
-
-target_link_libraries(kded_kcookiejar
- KF6::WindowSystem
- KF6::ConfigCore
- KF6::CoreAddons
- KF6::DBusAddons
- KF6::I18n
- KF6::WidgetsAddons
-)
-
-########### install files ###############
-
-install( FILES domain_info DESTINATION ${KDE_INSTALL_DATADIR_KF}/kcookiejar )
-
-kdbusaddons_generate_dbus_service_file(kded6 org.kde.kcookiejar5 ${KDE_INSTALL_FULL_BINDIR})
diff --git a/src/kioworkers/http/kcookiejar/config-kcookiejar.h.in b/src/kioworkers/http/kcookiejar/config-kcookiejar.h.in
deleted file mode 100644
index 89858d17de..0000000000
--- a/src/kioworkers/http/kcookiejar/config-kcookiejar.h.in
+++ /dev/null
@@ -1 +0,0 @@
-#cmakedefine01 HAVE_X11
diff --git a/src/kioworkers/http/kcookiejar/domain_info b/src/kioworkers/http/kcookiejar/domain_info
deleted file mode 100644
index cbe2a3db8d..0000000000
--- a/src/kioworkers/http/kcookiejar/domain_info
+++ /dev/null
@@ -1,2 +0,0 @@
-twoLevelTLD=name,ai,au,bd,bh,ck,eg,et,fk,il,in,kh,kr,mk,mt,na,np,nz,pg,pk,qa,sa,sb,sg,sv,ua,ug,uk,uy,vn,za,zw
-gTLDs=com,edu,gov,int,mil,net,org,biz,info,name,pro,aero,coop,museum,asia,cat,jobs,mobi,tel,travel
diff --git a/src/kioworkers/http/kcookiejar/kcookiejar.cpp b/src/kioworkers/http/kcookiejar/kcookiejar.cpp
deleted file mode 100644
index 79f70c701d..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookiejar.cpp
+++ /dev/null
@@ -1,1559 +0,0 @@
-/*
- This file is part of the KDE File Manager
- SPDX-FileCopyrightText: 1998-2000 Waldo Bastian <bastian at kde.org>
- SPDX-FileCopyrightText: 2000, 2001 Dawit Alemayehu <adawit at kde.org>
-
- SPDX-License-Identifier: MIT
-*/
-
-// KDE File Manager -- HTTP Cookies
-
-//
-// The cookie protocol is a mess. RFC2109 is a joke since nobody seems to
-// use it. Apart from that it is badly written.
-// We try to implement Netscape Cookies and try to behave us according to
-// RFC2109 as much as we can.
-//
-// We assume cookies do not contain any spaces (Netscape spec.)
-// According to RFC2109 this is allowed though.
-//
-
-#include "kcookiejar.h"
-
-#include <KConfig>
-#include <KConfigGroup>
-#include <QDebug>
-#include <QSaveFile>
-
-#include <QFile>
-#include <QLocale>
-#include <QRegularExpression>
-#include <QString>
-#include <QTextStream>
-#include <QUrl>
-
-Q_LOGGING_CATEGORY(KIO_COOKIEJAR, "kf.kio.workers.http.cookiejar")
-
-static constexpr int s_readBufferSize = 8192;
-static constexpr char s_ipAddressExpression[] = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
-
-// Note with respect to QLatin1String( )....
-// Cookies are stored as 8 bit data and passed to kio_http as Latin1
-// regardless of their actual encoding.
-
-static QString removeWeekday(const QString &value)
-{
- const int index = value.indexOf(QLatin1Char(' '));
- if (index > -1) {
- int pos = 0;
- const auto weekday = QStringView(value).left(index);
- const QLocale cLocale = QLocale::c();
- for (int i = 1; i < 8; ++i) {
- // No need to check for long names since the short names are
- // prefixes of the long names
- if (weekday.startsWith(cLocale.dayName(i, QLocale::ShortFormat), Qt::CaseInsensitive)) {
- pos = index + 1;
- break;
- }
- }
- if (pos > 0) {
- return value.mid(pos);
- }
- }
- return value;
-}
-
-static QDateTime parseDate(const QString &_value)
-{
- // Handle sites sending invalid weekday as part of the date. #298660
- QString value(removeWeekday(_value));
-
- // Check if expiration date matches RFC dates as specified under
- // RFC 2616 sec 3.3.1 & RFC 6265 sec 4.1.1
- QDateTime dt = QDateTime::fromString(value, Qt::RFC2822Date);
-
- // Q6DateTime::fromString() will return an invalid datetime if the "GMT"
- // part is included
- if (!dt.isValid()) {
- const QLatin1String tail(" GMT");
- if (value.endsWith(tail)) {
- value.chop(tail.size());
- }
- dt = QDateTime::fromString(value, Qt::RFC2822Date);
- }
-
- if (!dt.isValid()) {
- static const char *const date_formats[] = {// Other formats documented in RFC 2616 sec 3.3.1
- // Note: the RFC says timezone information MUST be "GMT", hence the hardcoded timezone string
- "MMM dd HH:mm:ss yyyy", /* ANSI C's asctime() format (#145244): Jan 01 00:00:00 1970 GMT */
- "dd-MMM-yy HH:mm:ss 'GMT'", /* RFC 850 date: 06-Dec-39 00:30:42 GMT */
- // Non-standard formats
- "MMM dd yyyy HH:mm:ss", /* A variation on ANSI C format seen @ amazon.com: Jan 01 1970 00:00:00 GMT */
- "dd-MMM-yyyy HH:mm:ss 'GMT'", /* cookies.test: Y2K38 problem: 06-Dec-2039 00:30:42 GMT */
- "MMM dd HH:mm:ss yyyy 'GMT'", /* cookies.test: Non-standard expiration dates: Sep 12 07:00:00 2020 GMT */
- "MMM dd yyyy HH:mm:ss 'GMT'", /* cookies.test: Non-standard expiration dates: Sep 12 2020 07:00:00 GMT */
- nullptr};
-
- // Only English month names are allowed, thus use the C locale.
- const QLocale cLocale = QLocale::c();
- for (int i = 0; date_formats[i]; ++i) {
- dt = cLocale.toDateTime(value, QLatin1String(date_formats[i]));
- if (dt.isValid()) {
- dt.setTimeSpec(Qt::UTC);
- break;
- }
- }
- }
-
- return dt.toUTC(); // Per RFC 2616 sec 3.3.1 always convert to UTC.
-}
-
-static qint64 toEpochSecs(const QDateTime &dt)
-{
- return (dt.toMSecsSinceEpoch() / 1000); // convert to seconds...
-}
-
-static qint64 epoch()
-{
- return toEpochSecs(QDateTime::currentDateTimeUtc());
-}
-
-QString KCookieJar::adviceToStr(KCookieAdvice _advice)
-{
- switch (_advice) {
- case KCookieAccept:
- return QStringLiteral("Accept");
- case KCookieAcceptForSession:
- return QStringLiteral("AcceptForSession");
- case KCookieReject:
- return QStringLiteral("Reject");
- case KCookieAsk:
- return QStringLiteral("Ask");
- default:
- return QStringLiteral("Dunno");
- }
-}
-
-KCookieAdvice KCookieJar::strToAdvice(const QString &_str)
-{
- if (_str.isEmpty()) {
- return KCookieDunno;
- }
-
- QString advice = _str.toLower().remove(QLatin1Char(' '));
-
- if (advice == QLatin1String("accept")) {
- return KCookieAccept;
- } else if (advice == QLatin1String("acceptforsession")) {
- return KCookieAcceptForSession;
- } else if (advice == QLatin1String("reject")) {
- return KCookieReject;
- } else if (advice == QLatin1String("ask")) {
- return KCookieAsk;
- }
-
- return KCookieDunno;
-}
-
-// KHttpCookie
-///////////////////////////////////////////////////////////////////////////
-
-//
-// Cookie constructor
-//
-KHttpCookie::KHttpCookie(const QString &_host,
- const QString &_domain,
- const QString &_path,
- const QString &_name,
- const QString &_value,
- qint64 _expireDate,
- int _protocolVersion,
- bool _secure,
- bool _httpOnly,
- bool _explicitPath)
- : mHost(_host)
- , mDomain(_domain)
- , mPath(_path.isEmpty() ? QString() : _path)
- , mName(_name)
- , mValue(_value)
- , mExpireDate(_expireDate)
- , mProtocolVersion(_protocolVersion)
- , mSecure(_secure)
- , mCrossDomain(false)
- , mHttpOnly(_httpOnly)
- , mExplicitPath(_explicitPath)
- , mUserSelectedAdvice(KCookieDunno)
-{
-}
-
-//
-// Checks if a cookie has been expired
-//
-bool KHttpCookie::isExpired(qint64 currentDate) const
-{
- if (currentDate == -1) {
- currentDate = epoch();
- }
-
- return (mExpireDate != 0) && (mExpireDate < currentDate);
-}
-
-//
-// Returns a string for a HTTP-header
-//
-QString KHttpCookie::cookieStr(bool useDOMFormat) const
-{
- QString result;
-
- if (useDOMFormat || (mProtocolVersion == 0)) {
- if (mName.isEmpty()) {
- result = mValue;
- } else {
- result = mName + QLatin1Char('=') + mValue;
- }
- } else {
- result = mName + QLatin1Char('=') + mValue;
- if (mExplicitPath) {
- result += QLatin1String("; $Path=\"") + mPath + QLatin1Char('"');
- }
- if (!mDomain.isEmpty()) {
- result += QLatin1String("; $Domain=\"") + mDomain + QLatin1Char('"');
- }
- if (!mPorts.isEmpty()) {
- if (mPorts.length() == 2 && mPorts.at(0) == -1) {
- result += QLatin1String("; $Port");
- } else {
- QString portNums;
- for (int port : std::as_const(mPorts)) {
- portNums += QString::number(port) + QLatin1Char(' ');
- }
- result += QLatin1String("; $Port=\"") + portNums.trimmed() + QLatin1Char('"');
- }
- }
- }
- return result;
-}
-
-//
-// Returns whether this cookie should be send to this location.
-bool KHttpCookie::match(const QString &fqdn, const QStringList &domains, const QString &path, int port) const
-{
- // Cookie domain match check
- if (mDomain.isEmpty()) {
- if (fqdn != mHost) {
- return false;
- }
- } else if (!domains.contains(mDomain)) {
- if (mDomain[0] == QLatin1Char('.')) {
- return false;
- }
-
- // Maybe the domain needs an extra dot.
- const QString domain = QLatin1Char('.') + mDomain;
- if (!domains.contains(domain)) {
- if (fqdn != mDomain) {
- return false;
- }
- }
- } else if (mProtocolVersion != 0 && port != -1 && !mPorts.isEmpty() && !mPorts.contains(port)) {
- return false;
- }
-
- // Cookie path match check
- if (mPath.isEmpty()) {
- return true;
- }
-
- // According to the netscape spec http://www.acme.com/foobar,
- // http://www.acme.com/foo.bar and http://www.acme.com/foo/bar
- // should all match http://www.acme.com/foo...
- // We only match http://www.acme.com/foo/bar
- if (path.startsWith(mPath)
- && ((path.length() == mPath.length()) || // Paths are exact match
- mPath.endsWith(QLatin1Char('/')) || // mPath ended with a slash
- (path[mPath.length()] == QLatin1Char('/')) // A slash follows
- )) {
- return true; // Path of URL starts with cookie-path
- }
-
- return false;
-}
-
-// KCookieJar
-///////////////////////////////////////////////////////////////////////////
-
-//
-// Constructs a new cookie jar
-//
-// One jar should be enough for all cookies.
-//
-KCookieJar::KCookieJar()
-{
- m_globalAdvice = KCookieDunno;
- m_configChanged = false;
- m_cookiesChanged = false;
-
- KConfig cfg(QStringLiteral("kf6/kcookiejar/domain_info"), KConfig::NoGlobals, QStandardPaths::GenericDataLocation);
- KConfigGroup group(&cfg, QString());
-
- const QStringList tldList = group.readEntry("gTLDs", QStringList());
- const QStringList twoLevelTldList = group.readEntry("twoLevelTLD", QStringList());
- m_gTLDs = QSet<QString>(tldList.begin(), tldList.end());
- m_twoLevelTLD = QSet<QString>(twoLevelTldList.begin(), twoLevelTldList.end());
-}
-
-//
-// Destructs the cookie jar
-//
-// Poor little cookies, they will all be eaten by the cookie monster!
-//
-KCookieJar::~KCookieJar()
-{
- qDeleteAll(m_cookieDomains);
- // Not much to do here
-}
-
-// cookiePtr is modified: the window ids of the existing cookie in the list are added to it
-static void removeDuplicateFromList(KHttpCookieList *list, KHttpCookie &cookiePtr, bool nameMatchOnly = false, bool updateWindowId = false)
-{
- QString domain1 = cookiePtr.domain();
- if (domain1.isEmpty()) {
- domain1 = cookiePtr.host();
- }
-
- QMutableListIterator<KHttpCookie> cookieIterator(*list);
- while (cookieIterator.hasNext()) {
- const KHttpCookie &cookie = cookieIterator.next();
- QString domain2 = cookie.domain();
- if (domain2.isEmpty()) {
- domain2 = cookie.host();
- }
-
- if (cookiePtr.name() == cookie.name() && (nameMatchOnly || (domain1 == domain2 && cookiePtr.path() == cookie.path()))) {
- if (updateWindowId) {
- for (WId windowId : cookie.windowIds()) {
- if (windowId && (!cookiePtr.windowIds().contains(windowId))) {
- cookiePtr.windowIds().append(windowId);
- }
- }
- }
- cookieIterator.remove();
- break;
- }
- }
-}
-
-//
-// Looks for cookies in the cookie jar which are appropriate for _url.
-// Returned is a string containing all appropriate cookies in a format
-// which can be added to a HTTP-header without any additional processing.
-//
-QString KCookieJar::findCookies(const QString &_url, bool useDOMFormat, WId windowId, KHttpCookieList *pendingCookies)
-{
- QString cookieStr;
- QString fqdn;
- QString path;
- QStringList domains;
- int port = -1;
-
- if (!parseUrl(_url, fqdn, path, &port)) {
- return cookieStr;
- }
-
- const bool secureRequest =
- (_url.startsWith(QLatin1String("https://"), Qt::CaseInsensitive) || _url.startsWith(QLatin1String("webdavs://"), Qt::CaseInsensitive));
- if (port == -1) {
- port = (secureRequest ? 443 : 80);
- }
-
- extractDomains(fqdn, domains);
-
- KHttpCookieList allCookies;
- for (QStringList::ConstIterator it = domains.constBegin(), itEnd = domains.constEnd();; ++it) {
- KHttpCookieList *cookieList = nullptr;
- if (it == itEnd) {
- cookieList = pendingCookies; // Add pending cookies
- pendingCookies = nullptr;
- if (!cookieList) {
- break;
- }
- } else {
- if ((*it).isNull()) {
- cookieList = m_cookieDomains.value(QLatin1String(""));
- } else {
- cookieList = m_cookieDomains.value(*it);
- }
-
- if (!cookieList) {
- continue; // No cookies for this domain
- }
- }
-
- QMutableListIterator<KHttpCookie> cookieIt(*cookieList);
- while (cookieIt.hasNext()) {
- KHttpCookie &cookie = cookieIt.next();
- if (cookieAdvice(cookie) == KCookieReject) {
- continue;
- }
-
- if (!cookie.match(fqdn, domains, path, port)) {
- continue;
- }
-
- if (cookie.isSecure() && !secureRequest) {
- continue;
- }
-
- if (cookie.isHttpOnly() && useDOMFormat) {
- continue;
- }
-
- // Do not send expired cookies.
- if (cookie.isExpired()) {
- // NOTE: there is no need to delete the cookie here because the
- // cookieserver will invoke its saveCookieJar function as a result
- // of the state change below. This will then result in the cookie
- // being deleting at that point.
- m_cookiesChanged = true;
- continue;
- }
-
- if (windowId && (cookie.windowIds().indexOf(windowId) == -1)) {
- cookie.windowIds().append(windowId);
- }
-
- if (it == itEnd) { // Only needed when processing pending cookies
- removeDuplicateFromList(&allCookies, cookie);
- }
-
- allCookies.append(cookie);
- }
-
- if (it == itEnd) {
- break; // Finished.
- }
- }
-
- int protVersion = 0;
- for (const KHttpCookie &cookie : std::as_const(allCookies)) {
- if (cookie.protocolVersion() > protVersion) {
- protVersion = cookie.protocolVersion();
- }
- }
-
- if (!allCookies.isEmpty()) {
- if (!useDOMFormat) {
- cookieStr = QStringLiteral("Cookie: ");
- }
-
- if (protVersion > 0) {
- cookieStr = cookieStr + QLatin1String("$Version=") + QString::number(protVersion) + QLatin1String("; ");
- }
-
- for (const KHttpCookie &cookie : std::as_const(allCookies)) {
- cookieStr = cookieStr + cookie.cookieStr(useDOMFormat) + QStringLiteral("; ");
- }
-
- cookieStr.chop(2); // Remove the trailing '; '
- }
-
- return cookieStr;
-}
-
-//
-// This function parses a string like 'my_name="my_value";' and returns
-// 'my_name' in Name and 'my_value' in Value.
-//
-// A pointer to the end of the parsed part is returned.
-// This pointer points either to:
-// '\0' - The end of the string has reached.
-// ';' - Another my_name="my_value" pair follows
-// ',' - Another cookie follows
-// '\n' - Another header follows
-static const char *parseNameValue(const char *header, QString &Name, QString &Value, bool keepQuotes = false, bool rfcQuotes = false)
-{
- const char *s = header;
- // Parse 'my_name' part
- for (; (*s != '='); s++) {
- if ((*s == '\0') || (*s == ';') || (*s == '\n')) {
- // No '=' sign -> use string as the value, name is empty
- // (behavior found in Mozilla and IE)
- Name = QLatin1String("");
- Value = QLatin1String(header);
- Value.truncate(s - header);
- Value = Value.trimmed();
- return s;
- }
- }
-
- Name = QLatin1String(header);
- Name.truncate(s - header);
- Name = Name.trimmed();
-
- // *s == '='
- s++;
-
- // Skip any whitespace
- for (; (*s == ' ') || (*s == '\t'); s++) {
- if ((*s == '\0') || (*s == ';') || (*s == '\n')) {
- // End of Name
- Value = QLatin1String("");
- return s;
- }
- }
-
- if ((rfcQuotes || !keepQuotes) && (*s == '\"')) {
- // Parse '"my_value"' part (quoted value)
- if (keepQuotes) {
- header = s++;
- } else {
- header = ++s; // skip "
- }
- for (; (*s != '\"'); s++) {
- if ((*s == '\0') || (*s == '\n')) {
- // End of Name
- Value = QLatin1String(header);
- Value.truncate(s - header);
- return s;
- }
- }
- Value = QLatin1String(header);
- // *s == '\"';
- if (keepQuotes) {
- Value.truncate(++s - header);
- } else {
- Value.truncate(s++ - header);
- }
-
- // Skip any remaining garbage
- for (;; s++) {
- if ((*s == '\0') || (*s == ';') || (*s == '\n')) {
- break;
- }
- }
- } else {
- // Parse 'my_value' part (unquoted value)
- header = s;
- while ((*s != '\0') && (*s != ';') && (*s != '\n')) {
- s++;
- }
- // End of Name
- Value = QLatin1String(header);
- Value.truncate(s - header);
- Value = Value.trimmed();
- }
- return s;
-}
-
-void KCookieJar::stripDomain(const QString &_fqdn, QString &_domain) const
-{
- QStringList domains;
- extractDomains(_fqdn, domains);
- if (domains.count() > 3) {
- _domain = domains[3];
- } else if (!domains.isEmpty()) {
- _domain = domains[0];
- } else {
- _domain = QLatin1String("");
- }
-}
-
-QString KCookieJar::stripDomain(const KHttpCookie &cookie) const
-{
- QString domain; // We file the cookie under this domain.
- if (cookie.domain().isEmpty()) {
- stripDomain(cookie.host(), domain);
- } else {
- domain = cookie.domain();
- }
- return domain;
-}
-
-bool KCookieJar::parseUrl(const QString &_url, QString &_fqdn, QString &_path, int *port)
-{
- QUrl kurl(_url);
- if (!kurl.isValid() || kurl.scheme().isEmpty()) {
- return false;
- }
-
- _fqdn = kurl.host().toLower();
- // Cookie spoofing protection. Since there is no way a path separator,
- // a space or the escape encoding character is allowed in the hostname
- // according to RFC 2396, reject attempts to include such things there!
- if (_fqdn.contains(QLatin1Char('/')) || _fqdn.contains(QLatin1Char('%'))) {
- return false; // deny everything!!
- }
-
- // Set the port number from the protocol when one is found...
- if (port) {
- *port = kurl.port();
- }
-
- _path = kurl.path();
- if (_path.isEmpty()) {
- _path = QStringLiteral("/");
- }
-
- return true;
-}
-
-// not static because it uses m_twoLevelTLD
-void KCookieJar::extractDomains(const QString &_fqdn, QStringList &_domains) const
-{
- if (_fqdn.isEmpty()) {
- _domains.append(QStringLiteral("localhost"));
- return;
- }
-
- // Return numeric IPv6 addresses as is...
- if (_fqdn[0] == QLatin1Char('[')) {
- _domains.append(_fqdn);
- return;
- }
- // Return numeric IPv4 addresses as is...
- if (_fqdn[0] >= QLatin1Char('0') && _fqdn[0] <= QLatin1Char('9') && _fqdn.indexOf(QRegularExpression(QString::fromLatin1(s_ipAddressExpression))) > -1) {
- _domains.append(_fqdn);
- return;
- }
-
- // Always add the FQDN at the start of the list for
- // hostname == cookie-domainname checks!
- _domains.append(_fqdn);
- _domains.append(QLatin1Char('.') + _fqdn);
-
- QStringList partList = _fqdn.split(QLatin1Char('.'), Qt::SkipEmptyParts);
-
- if (!partList.isEmpty()) {
- partList.erase(partList.begin()); // Remove hostname
- }
-
- while (partList.count()) {
- if (partList.count() == 1) {
- break; // We only have a TLD left.
- }
-
- if ((partList.count() == 2) && m_twoLevelTLD.contains(partList[1].toLower())) {
- // This domain uses two-level TLDs in the form xxxx.yy
- break;
- }
-
- if ((partList.count() == 2) && (partList[1].length() == 2)) {
- // If this is a TLD, we should stop. (e.g. co.uk)
- // We assume this is a TLD if it ends with .xx.yy or .x.yy
- if (partList[0].length() <= 2) {
- break; // This is a TLD.
- }
-
- // Catch some TLDs that we miss with the previous check
- // e.g. com.au, org.uk, mil.co
- if (m_gTLDs.contains(partList[0].toLower())) {
- break;
- }
- }
-
- QString domain = partList.join(QLatin1Char('.'));
- _domains.append(domain);
- _domains.append(QLatin1Char('.') + domain);
- partList.erase(partList.begin()); // Remove part
- }
-}
-
-//
-// This function parses cookie_headers and returns a linked list of
-// KHttpCookie objects for all cookies found in cookie_headers.
-// If no cookies could be found 0 is returned.
-//
-// cookie_headers should be a concatenation of all lines of a HTTP-header
-// which start with "Set-Cookie". The lines should be separated by '\n's.
-//
-KHttpCookieList KCookieJar::makeCookies(const QString &_url, const QByteArray &cookie_headers, WId windowId)
-{
- QString fqdn;
- QString path;
-
- if (!parseUrl(_url, fqdn, path)) {
- return KHttpCookieList(); // Error parsing _url
- }
-
- QString Name;
- QString Value;
- KHttpCookieList cookieList;
- KHttpCookieList cookieList2;
-
- bool isRFC2965 = false;
- bool crossDomain = false;
- const char *cookieStr = cookie_headers.constData();
-
- QString defaultPath;
- const int index = path.lastIndexOf(QLatin1Char('/'));
- if (index > 0) {
- defaultPath = path.left(index);
- }
-
- // Check for cross-domain flag from kio_http
- if (qstrncmp(cookieStr, "Cross-Domain\n", 13) == 0) {
- cookieStr += 13;
- crossDomain = true;
- }
-
- // The hard stuff :)
- for (;;) {
- // check for "Set-Cookie"
- if (qstrnicmp(cookieStr, "Set-Cookie:", 11) == 0) {
- cookieStr = parseNameValue(cookieStr + 11, Name, Value, true);
-
- // Host = FQDN
- // Default domain = ""
- // Default path according to rfc2109
-
- KHttpCookie cookie(fqdn, QLatin1String(""), defaultPath, Name, Value);
- if (windowId) {
- cookie.mWindowIds.append(windowId);
- }
- cookie.mCrossDomain = crossDomain;
-
- // Insert cookie in chain
- cookieList.append(cookie);
- } else if (qstrnicmp(cookieStr, "Set-Cookie2:", 12) == 0) {
- // Attempt to follow rfc2965
- isRFC2965 = true;
- cookieStr = parseNameValue(cookieStr + 12, Name, Value, true, true);
-
- // Host = FQDN
- // Default domain = ""
- // Default path according to rfc2965
-
- KHttpCookie cookie(fqdn, QLatin1String(""), defaultPath, Name, Value);
- if (windowId) {
- cookie.mWindowIds.append(windowId);
- }
- cookie.mCrossDomain = crossDomain;
-
- // Insert cookie in chain
- cookieList2.append(cookie);
- } else {
- // This is not the start of a cookie header, skip till next line.
- while (*cookieStr && *cookieStr != '\n') {
- cookieStr++;
- }
-
- if (*cookieStr == '\n') {
- cookieStr++;
- }
-
- if (!*cookieStr) {
- break; // End of cookie_headers
- } else {
- continue; // end of this header, continue with next.
- }
- }
-
- while ((*cookieStr == ';') || (*cookieStr == ' ')) {
- cookieStr++;
-
- // Name-Value pair follows
- cookieStr = parseNameValue(cookieStr, Name, Value);
- KHttpCookie &lastCookie = (isRFC2965 ? cookieList2.last() : cookieList.last());
-
- if (Name.compare(QLatin1String("domain"), Qt::CaseInsensitive) == 0) {
- QString dom = Value.toLower();
- // RFC2965 3.2.2: If an explicitly specified value does not
- // start with a dot, the user agent supplies a leading dot
- if (dom.length() > 0 && dom[0] != QLatin1Char('.')) {
- dom.prepend(QLatin1Char('.'));
- }
- // remove a trailing dot
- if (dom.length() > 2 && dom[dom.length() - 1] == QLatin1Char('.')) {
- dom.chop(1);
- }
-
- if (dom.count(QLatin1Char('.')) > 1 || dom == QLatin1String(".local")) {
- lastCookie.mDomain = dom;
- }
- } else if (Name.compare(QLatin1String("max-age"), Qt::CaseInsensitive) == 0) {
- int max_age = Value.toInt();
- if (max_age == 0) {
- lastCookie.mExpireDate = 1;
- } else {
- lastCookie.mExpireDate = toEpochSecs(QDateTime::currentDateTimeUtc().addSecs(max_age));
- }
- } else if (Name.compare(QLatin1String("expires"), Qt::CaseInsensitive) == 0) {
- const QDateTime dt = parseDate(Value);
-
- if (dt.isValid()) {
- lastCookie.mExpireDate = toEpochSecs(dt);
- if (lastCookie.mExpireDate == 0) {
- lastCookie.mExpireDate = 1;
- }
- }
- } else if (Name.compare(QLatin1String("path"), Qt::CaseInsensitive) == 0) {
- if (Value.isEmpty()) {
- lastCookie.mPath.clear(); // Catch "" <> QString()
- } else {
- lastCookie.mPath = QUrl::fromPercentEncoding(Value.toLatin1());
- }
- lastCookie.mExplicitPath = true;
- } else if (Name.compare(QLatin1String("version"), Qt::CaseInsensitive) == 0) {
- lastCookie.mProtocolVersion = Value.toInt();
- } else if (Name.compare(QLatin1String("secure"), Qt::CaseInsensitive) == 0
- || (Name.isEmpty() && Value.compare(QLatin1String("secure"), Qt::CaseInsensitive) == 0)) {
- lastCookie.mSecure = true;
- } else if (Name.compare(QLatin1String("httponly"), Qt::CaseInsensitive) == 0
- || (Name.isEmpty() && Value.compare(QLatin1String("httponly"), Qt::CaseInsensitive) == 0)) {
- lastCookie.mHttpOnly = true;
- } else if (isRFC2965
- && (Name.compare(QLatin1String("port"), Qt::CaseInsensitive) == 0
- || (Name.isEmpty() && Value.compare(QLatin1String("port"), Qt::CaseInsensitive) == 0))) {
- // Based on the port selection rule of RFC 2965 section 3.3.4...
- if (Name.isEmpty()) {
- // We intentionally append a -1 first in order to distinguish
- // between only a 'Port' vs a 'Port="80 443"' in the sent cookie.
- lastCookie.mPorts.append(-1);
- const bool secureRequest =
- (_url.startsWith(QLatin1String("https://"), Qt::CaseInsensitive) || _url.startsWith(QLatin1String("webdavs://"), Qt::CaseInsensitive));
- if (secureRequest) {
- lastCookie.mPorts.append(443);
- } else {
- lastCookie.mPorts.append(80);
- }
- } else {
- bool ok;
- const QStringList portNums = Value.split(QLatin1Char(' '), Qt::SkipEmptyParts);
- for (const QString &portNum : portNums) {
- const int port = portNum.toInt(&ok);
- if (ok) {
- lastCookie.mPorts.append(port);
- }
- }
- }
- }
- }
-
- if (*cookieStr == '\0') {
- break; // End of header
- }
-
- // Skip ';' or '\n'
- cookieStr++;
- }
-
- // RFC2965 cookies come last so that they override netscape cookies.
- while (!cookieList2.isEmpty()) {
- KHttpCookie &lastCookie = cookieList2.first();
- removeDuplicateFromList(&cookieList, lastCookie, true);
- cookieList.append(lastCookie);
- cookieList2.removeFirst();
- }
-
- return cookieList;
-}
-
-/**
- * Parses cookie_domstr and returns a linked list of KHttpCookie objects.
- * cookie_domstr should be a semicolon-delimited list of "name=value"
- * pairs. Any whitespace before "name" or around '=' is discarded.
- * If no cookies are found, 0 is returned.
- */
-KHttpCookieList KCookieJar::makeDOMCookies(const QString &_url, const QByteArray &cookie_domstring, WId windowId)
-{
- // A lot copied from above
- KHttpCookieList cookieList;
-
- const char *cookieStr = cookie_domstring.data();
- QString fqdn;
- QString path;
-
- if (!parseUrl(_url, fqdn, path)) {
- // Error parsing _url
- return KHttpCookieList();
- }
-
- QString Name;
- QString Value;
- // This time it's easy
- while (*cookieStr) {
- cookieStr = parseNameValue(cookieStr, Name, Value);
-
- // Host = FQDN
- // Default domain = ""
- // Default path = ""
- KHttpCookie cookie(fqdn, QString(), QString(), Name, Value);
- if (windowId) {
- cookie.mWindowIds.append(windowId);
- }
-
- cookieList.append(cookie);
-
- if (*cookieStr != '\0') {
- cookieStr++; // Skip ';' or '\n'
- }
- }
-
- return cookieList;
-}
-
-// KHttpCookieList sorting
-///////////////////////////////////////////////////////////////////////////
-
-// We want the longest path first
-static bool compareCookies(const KHttpCookie &item1, const KHttpCookie &item2)
-{
- return item1.path().length() > item2.path().length();
-}
-
-//
-// This function hands a KHttpCookie object over to the cookie jar.
-//
-void KCookieJar::addCookie(KHttpCookie &cookie)
-{
- QStringList domains;
- // We always need to do this to make sure that the
- // that cookies of type hostname == cookie-domainname
- // are properly removed and/or updated as necessary!
- extractDomains(cookie.host(), domains);
-
- // If the cookie specifies a domain, check whether it is valid. Otherwise,
- // accept the cookie anyways but removes the domain="" value to prevent
- // cross-site cookie injection.
- if (!cookie.domain().isEmpty()) {
- if (!domains.contains(cookie.domain()) && !cookie.domain().endsWith(QLatin1Char('.') + cookie.host())) {
- cookie.fixDomain(QString());
- }
- }
-
- for (const QString &key : std::as_const(domains)) {
- KHttpCookieList *list;
-
- if (key.isNull()) {
- list = m_cookieDomains.value(QLatin1String(""));
- } else {
- list = m_cookieDomains.value(key);
- }
-
- if (list) {
- removeDuplicateFromList(list, cookie, false, true);
- }
- }
-
- const QString domain = stripDomain(cookie);
- KHttpCookieList *cookieList;
- if (domain.isNull()) {
- cookieList = m_cookieDomains.value(QLatin1String(""));
- } else {
- cookieList = m_cookieDomains.value(domain);
- }
-
- if (!cookieList) {
- // Make a new cookie list
- cookieList = new KHttpCookieList();
-
- // All cookies whose domain is not already
- // known to us should be added with KCookieDunno.
- // KCookieDunno means that we use the global policy.
- cookieList->setAdvice(KCookieDunno);
-
- m_cookieDomains.insert(domain, cookieList);
-
- // Update the list of domains
- m_domainList.append(domain);
- }
-
- // Add the cookie to the cookie list
- // The cookie list is sorted 'longest path first'
- if (!cookie.isExpired()) {
- cookieList->push_back(cookie);
- // Use a stable sort so that unit tests are reliable.
- // In practice it doesn't matter though.
- std::stable_sort(cookieList->begin(), cookieList->end(), compareCookies);
-
- m_cookiesChanged = true;
- }
-}
-
-//
-// This function advises whether a single KHttpCookie object should
-// be added to the cookie jar.
-//
-KCookieAdvice KCookieJar::cookieAdvice(const KHttpCookie &cookie) const
-{
- if (m_rejectCrossDomainCookies && cookie.isCrossDomain()) {
- return KCookieReject;
- }
-
- if (cookie.getUserSelectedAdvice() != KCookieDunno) {
- return cookie.getUserSelectedAdvice();
- }
-
- if (m_autoAcceptSessionCookies && cookie.expireDate() == 0) {
- return KCookieAccept;
- }
-
- QStringList domains;
- extractDomains(cookie.host(), domains);
-
- KCookieAdvice advice = KCookieDunno;
- QStringListIterator it(domains);
- while (advice == KCookieDunno && it.hasNext()) {
- const QString &domain = it.next();
- if (domain.startsWith(QLatin1Char('.')) || cookie.host() == domain) {
- KHttpCookieList *cookieList = m_cookieDomains.value(domain);
- if (cookieList) {
- advice = cookieList->getAdvice();
- }
- }
- }
-
- if (advice == KCookieDunno) {
- advice = m_globalAdvice;
- }
-
- return advice;
-}
-
-//
-// This function tells whether a single KHttpCookie object should
-// be considered persistent. Persistent cookies do not get deleted
-// at the end of the session and are saved on disk.
-//
-bool KCookieJar::cookieIsPersistent(const KHttpCookie &cookie) const
-{
- if (cookie.expireDate() == 0) {
- return false;
- }
-
- KCookieAdvice advice = cookieAdvice(cookie);
-
- if (advice == KCookieReject || advice == KCookieAcceptForSession) {
- return false;
- }
-
- return true;
-}
-
-//
-// This function gets the advice for all cookies originating from
-// _domain.
-//
-KCookieAdvice KCookieJar::getDomainAdvice(const QString &_domain) const
-{
- KHttpCookieList *cookieList = m_cookieDomains.value(_domain);
- KCookieAdvice advice;
-
- if (cookieList) {
- advice = cookieList->getAdvice();
- } else {
- advice = KCookieDunno;
- }
-
- return advice;
-}
-
-//
-// This function sets the advice for all cookies originating from
-// _domain.
-//
-void KCookieJar::setDomainAdvice(const QString &domain, KCookieAdvice _advice)
-{
- KHttpCookieList *cookieList = m_cookieDomains.value(domain);
-
- if (cookieList) {
- if (cookieList->getAdvice() != _advice) {
- m_configChanged = true;
- // domain is already known
- cookieList->setAdvice(_advice);
- }
-
- if ((cookieList->isEmpty()) && (_advice == KCookieDunno)) {
- // This deletes cookieList!
- delete m_cookieDomains.take(domain);
- m_domainList.removeAll(domain);
- }
- } else {
- // domain is not yet known
- if (_advice != KCookieDunno) {
- // We should create a domain entry
- m_configChanged = true;
- // Make a new cookie list
- cookieList = new KHttpCookieList();
- cookieList->setAdvice(_advice);
- m_cookieDomains.insert(domain, cookieList);
- // Update the list of domains
- m_domainList.append(domain);
- }
- }
-}
-
-//
-// This function sets the advice for all cookies originating from
-// the same domain as _cookie
-//
-void KCookieJar::setDomainAdvice(const KHttpCookie &cookie, KCookieAdvice _advice)
-{
- QString domain;
- stripDomain(cookie.host(), domain); // We file the cookie under this domain.
- setDomainAdvice(domain, _advice);
-}
-
-//
-// This function sets the global advice for cookies
-//
-void KCookieJar::setGlobalAdvice(KCookieAdvice _advice)
-{
- if (m_globalAdvice != _advice) {
- m_configChanged = true;
- }
- m_globalAdvice = _advice;
-}
-
-//
-// Get a list of all domains known to the cookie jar.
-//
-const QStringList &KCookieJar::getDomainList()
-{
- return m_domainList;
-}
-
-//
-// Get a list of all cookies in the cookie jar originating from _domain.
-//
-KHttpCookieList *KCookieJar::getCookieList(const QString &_domain, const QString &_fqdn)
-{
- QString domain;
-
- if (_domain.isEmpty()) {
- stripDomain(_fqdn, domain);
- } else {
- domain = _domain;
- }
-
- return m_cookieDomains.value(domain);
-}
-
-//
-// Eat a cookie out of the jar.
-// cookieIterator should be one of the cookies returned by getCookieList()
-//
-void KCookieJar::eatCookie(const KHttpCookieList::iterator &cookieIterator)
-{
- const KHttpCookie &cookie = *cookieIterator;
- const QString domain = stripDomain(cookie); // We file the cookie under this domain.
- KHttpCookieList *cookieList = m_cookieDomains.value(domain);
-
- if (cookieList) {
- // This deletes cookie!
- cookieList->erase(cookieIterator);
-
- if ((cookieList->isEmpty()) && (cookieList->getAdvice() == KCookieDunno)) {
- // This deletes cookieList!
- delete m_cookieDomains.take(domain);
- m_domainList.removeAll(domain);
- }
- }
-}
-
-void KCookieJar::eatCookiesForDomain(const QString &domain)
-{
- KHttpCookieList *cookieList = m_cookieDomains.value(domain);
- if (!cookieList || cookieList->isEmpty()) {
- return;
- }
-
- cookieList->clear();
- if (cookieList->getAdvice() == KCookieDunno) {
- // This deletes cookieList!
- delete m_cookieDomains.take(domain);
- m_domainList.removeAll(domain);
- }
- m_cookiesChanged = true;
-}
-
-void KCookieJar::eatSessionCookies(long windowId)
-{
- if (!windowId) {
- return;
- }
-
- for (const QString &domain : std::as_const(m_domainList)) {
- eatSessionCookies(domain, windowId, false);
- }
-}
-
-void KCookieJar::eatAllCookies()
-{
- // we need a copy as eatCookiesForDomain() might remove domain from m_domainList
- const QStringList list = m_domainList;
- for (const QString &domain : list) {
- eatCookiesForDomain(domain);
- }
-}
-
-void KCookieJar::eatSessionCookies(const QString &fqdn, WId windowId, bool isFQDN)
-{
- KHttpCookieList *cookieList;
- if (!isFQDN) {
- cookieList = m_cookieDomains.value(fqdn);
- } else {
- QString domain;
- stripDomain(fqdn, domain);
- cookieList = m_cookieDomains.value(domain);
- }
-
- if (cookieList) {
- QMutableListIterator<KHttpCookie> cookieIterator(*cookieList);
- while (cookieIterator.hasNext()) {
- KHttpCookie &cookie = cookieIterator.next();
-
- if (cookieIsPersistent(cookie)) {
- continue;
- }
-
- QList<WId> &ids = cookie.windowIds();
-
-#ifndef NDEBUG
- if (ids.contains(windowId)) {
- if (ids.count() > 1) {
- qCDebug(KIO_COOKIEJAR) << "removing window id" << windowId << "from session cookie";
- } else {
- qCDebug(KIO_COOKIEJAR) << "deleting session cookie";
- }
- }
-#endif
- if (!ids.removeAll(windowId) || !ids.isEmpty()) {
- continue;
- }
- cookieIterator.remove();
- }
- }
-}
-
-static QString hostWithPort(const KHttpCookie *cookie)
-{
- const QList<int> &ports = cookie->ports();
-
- if (ports.isEmpty()) {
- return cookie->host();
- }
-
- QStringList portList;
- for (int port : ports) {
- portList << QString::number(port);
- }
-
- return (cookie->host() + QLatin1Char(':') + portList.join(QLatin1Char(',')));
-}
-
-//
-// Saves all cookies to the file '_filename'.
-// On success 'true' is returned.
-// On failure 'false' is returned.
-bool KCookieJar::saveCookies(const QString &_filename)
-{
- QSaveFile cookieFile(_filename);
-
- if (!cookieFile.open(QIODevice::WriteOnly)) {
- return false;
- }
-
- QTextStream ts(&cookieFile);
-
- ts << "# KDE Cookie File v2\n#\n";
-
- const QString str =
- QString::asprintf("%-20s %-20s %-12s %-10s %-4s %-20s %-4s %s\n", "# Host", "Domain", "Path", "Exp.date", "Prot", "Name", "Sec", "Value");
- ts << str;
-
- for (const QString &domainName : std::as_const(m_domainList)) {
- bool domainPrinted = false;
-
- KHttpCookieList *cookieList = m_cookieDomains.value(domainName);
- if (!cookieList) {
- continue;
- }
-
- QMutableListIterator<KHttpCookie> cookieIterator(*cookieList);
- while (cookieIterator.hasNext()) {
- const KHttpCookie &cookie = cookieIterator.next();
-
- if (cookie.isExpired()) {
- // Delete expired cookies
- cookieIterator.remove();
- continue;
- }
- if (cookieIsPersistent(cookie)) {
- // Only save cookies that are not "session-only cookies"
- if (!domainPrinted) {
- domainPrinted = true;
- ts << '[' << domainName.toLocal8Bit().data() << "]\n";
- }
- // Store persistent cookies
- const QString path = QLatin1Char('"') + cookie.path() + QLatin1Char('"');
- const QString domain = QLatin1Char('"') + cookie.domain() + QLatin1Char('"');
- const QString host = hostWithPort(&cookie);
-
- // TODO: replace with direct QTextStream output ?
- const QString fullStr = QString::asprintf(
- "%-20s %-20s %-12s %10lld %3d %-20s %-4i %s\n",
- host.toLatin1().constData(),
- domain.toLatin1().constData(),
- path.toLatin1().constData(),
- cookie.expireDate(),
- cookie.protocolVersion(),
- cookie.name().isEmpty() ? cookie.value().toLatin1().constData() : cookie.name().toLatin1().constData(),
- (cookie.isSecure() ? 1 : 0) + (cookie.isHttpOnly() ? 2 : 0) + (cookie.hasExplicitPath() ? 4 : 0) + (cookie.name().isEmpty() ? 8 : 0),
- cookie.value().toLatin1().constData());
- ts << fullStr.toLatin1();
- }
- }
- }
-
- if (cookieFile.commit()) {
- QFile::setPermissions(_filename, QFile::ReadUser | QFile::WriteUser);
- return true;
- }
- return false;
-}
-
-static const char *parseField(char *&buffer, bool keepQuotes = false)
-{
- char *result;
- if (!keepQuotes && (*buffer == '\"')) {
- // Find terminating "
- buffer++;
- result = buffer;
- while ((*buffer != '\"') && (*buffer)) {
- buffer++;
- }
- } else {
- // Find first white space
- result = buffer;
- while ((*buffer != ' ') && (*buffer != '\t') && (*buffer != '\n') && (*buffer)) {
- buffer++;
- }
- }
-
- if (!*buffer) {
- return result; //
- }
- *buffer++ = '\0';
-
- // Skip white-space
- while ((*buffer == ' ') || (*buffer == '\t') || (*buffer == '\n')) {
- buffer++;
- }
-
- return result;
-}
-
-static QString extractHostAndPorts(const QString &str, QList<int> *ports = nullptr)
-{
- if (str.isEmpty()) {
- return str;
- }
-
- const int index = str.indexOf(QLatin1Char(':'));
- if (index == -1) {
- return str;
- }
-
- const QString host = str.left(index);
- if (ports) {
- bool ok;
- const QStringList list = str.mid(index + 1).split(QLatin1Char(','));
- for (const QString &portStr : list) {
- const int portNum = portStr.toInt(&ok);
- if (ok) {
- ports->append(portNum);
- }
- }
- }
-
- return host;
-}
-
-//
-// Reloads all cookies from the file '_filename'.
-// On success 'true' is returned.
-// On failure 'false' is returned.
-bool KCookieJar::loadCookies(const QString &_filename)
-{
- QFile cookieFile(_filename);
-
- if (!cookieFile.open(QIODevice::ReadOnly)) {
- return false;
- }
-
- int version = 1;
- bool success = false;
- char *buffer = new char[s_readBufferSize];
- qint64 len = cookieFile.readLine(buffer, s_readBufferSize - 1);
-
- if (len != -1) {
- if (qstrcmp(buffer, "# KDE Cookie File\n") == 0) {
- success = true;
- } else if (qstrcmp(buffer, "# KDE Cookie File v") > 0) {
- bool ok = false;
- const int verNum = QByteArray(buffer + 19, len - 19).trimmed().toInt(&ok);
- if (ok) {
- version = verNum;
- success = true;
- }
- }
- }
-
- if (success) {
- const qint64 currentTime = epoch();
- QList<int> ports;
-
- while (cookieFile.readLine(buffer, s_readBufferSize - 1) != -1) {
- char *line = buffer;
- // Skip lines which begin with '#' or '['
- if ((line[0] == '#') || (line[0] == '[')) {
- continue;
- }
-
- const QString host = extractHostAndPorts(QLatin1String(parseField(line)), &ports);
- const QString domain = QLatin1String(parseField(line));
- if (host.isEmpty() && domain.isEmpty()) {
- continue;
- }
- const QString path = QLatin1String(parseField(line));
- const QString expStr = QLatin1String(parseField(line));
- if (expStr.isEmpty()) {
- continue;
- }
- const qint64 expDate = expStr.toLongLong();
- const QString verStr = QLatin1String(parseField(line));
- if (verStr.isEmpty()) {
- continue;
- }
- int protVer = verStr.toInt();
- QString name = QLatin1String(parseField(line));
- bool secure = false;
- bool httpOnly = false;
- bool explicitPath = false;
- const char *value = nullptr;
- if ((version == 2) || (protVer >= 200)) {
- if (protVer >= 200) {
- protVer -= 200;
- }
- int i = atoi(parseField(line));
- secure = i & 1;
- httpOnly = i & 2;
- explicitPath = i & 4;
- if (i & 8) {
- name = QLatin1String("");
- }
- line[strlen(line) - 1] = '\0'; // Strip LF.
- value = line;
- } else {
- bool keepQuotes = false;
- if (protVer >= 100) {
- protVer -= 100;
- keepQuotes = true;
- }
- value = parseField(line, keepQuotes);
- secure = QByteArray(parseField(line)).toShort();
- }
-
- // Expired or parse error
- if (!value || expDate == 0 || expDate < currentTime) {
- continue;
- }
-
- KHttpCookie cookie(host, domain, path, name, QString::fromUtf8(value), expDate, protVer, secure, httpOnly, explicitPath);
- if (!ports.isEmpty()) {
- cookie.mPorts = ports;
- }
- addCookie(cookie);
- }
- }
-
- delete[] buffer;
- m_cookiesChanged = false;
- return success;
-}
-
-//
-// Save the cookie configuration
-//
-
-void KCookieJar::saveConfig(KConfig *_config)
-{
- if (!m_configChanged) {
- return;
- }
-
- KConfigGroup dlgGroup(_config, "Cookie Dialog");
- dlgGroup.writeEntry("PreferredPolicy", static_cast<int>(m_preferredPolicy));
- dlgGroup.writeEntry("ShowCookieDetails", m_showCookieDetails);
- KConfigGroup policyGroup(_config, "Cookie Policy");
- policyGroup.writeEntry("CookieGlobalAdvice", adviceToStr(m_globalAdvice));
-
- QStringList domainSettings;
- for (const QString &domain : std::as_const(m_domainList)) {
- KCookieAdvice advice = getDomainAdvice(domain);
- if (advice != KCookieDunno) {
- const QString value = domain + QLatin1Char(':') + adviceToStr(advice);
- domainSettings.append(value);
- }
- }
- policyGroup.writeEntry("CookieDomainAdvice", domainSettings);
- _config->sync();
- m_configChanged = false;
-}
-
-//
-// Load the cookie configuration
-//
-
-void KCookieJar::loadConfig(KConfig *_config, bool reparse)
-{
- if (reparse) {
- _config->reparseConfiguration();
- }
-
- KConfigGroup dlgGroup(_config, "Cookie Dialog");
- m_showCookieDetails = dlgGroup.readEntry("ShowCookieDetails", false);
- m_preferredPolicy = static_cast<KCookieDefaultPolicy>(dlgGroup.readEntry("PreferredPolicy", 0));
-
- KConfigGroup policyGroup(_config, "Cookie Policy");
- const QStringList domainSettings = policyGroup.readEntry("CookieDomainAdvice", QStringList());
- // Warning: those default values are duplicated in the kcm (kio/kcookiespolicies.cpp)
- m_rejectCrossDomainCookies = policyGroup.readEntry("RejectCrossDomainCookies", true);
- m_autoAcceptSessionCookies = policyGroup.readEntry("AcceptSessionCookies", true);
- m_globalAdvice = strToAdvice(policyGroup.readEntry("CookieGlobalAdvice", QStringLiteral("Accept")));
-
- // Reset current domain settings first.
- // We need a copy as setDomainAdvice() may modify m_domainList
- const QStringList list = m_domainList;
- for (const QString &domain : list) {
- setDomainAdvice(domain, KCookieDunno);
- }
-
- // Now apply the domain settings read from config file...
- for (QStringList::ConstIterator it = domainSettings.constBegin(), itEnd = domainSettings.constEnd(); it != itEnd; ++it) {
- const QString &value = *it;
- const int sepPos = value.lastIndexOf(QLatin1Char(':'));
- if (sepPos <= 0) {
- continue;
- }
-
- const QString domain(value.left(sepPos));
- KCookieAdvice advice = strToAdvice(value.mid(sepPos + 1));
- setDomainAdvice(domain, advice);
- }
-}
-
-QDebug operator<<(QDebug dbg, const KHttpCookie &cookie)
-{
- dbg.nospace() << cookie.cookieStr(false);
- return dbg.space();
-}
-
-QDebug operator<<(QDebug dbg, const KHttpCookieList &list)
-{
- for (const KHttpCookie &cookie : list) {
- dbg << cookie;
- }
- return dbg;
-}
diff --git a/src/kioworkers/http/kcookiejar/kcookiejar.h b/src/kioworkers/http/kcookiejar/kcookiejar.h
deleted file mode 100644
index 86ec5b244c..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookiejar.h
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- This file is part of the KDE File Manager
- SPDX-FileCopyrightText: 1998 Waldo Bastian <bastian at kde.org>
-
- SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only
-*/
-
-// KDE File Manager -- HTTP Cookies
-
-#ifndef KCOOKIEJAR_H
-#define KCOOKIEJAR_H
-
-#include <QHash>
-#include <QSet>
-#include <QString>
-#include <QStringList>
-#include <qwindowdefs.h> //WId
-
-#include <QLoggingCategory>
-Q_DECLARE_LOGGING_CATEGORY(KIO_COOKIEJAR)
-
-class KConfig;
-class KCookieJar;
-class KHttpCookie;
-class KHttpCookieList;
-
-typedef KHttpCookie *KHttpCookiePtr;
-
-enum KCookieAdvice {
- KCookieDunno = 0,
- KCookieAccept,
- KCookieAcceptForSession,
- KCookieReject,
- KCookieAsk,
-};
-
-class KHttpCookie
-{
- friend class KCookieJar;
- friend class KHttpCookieList;
- friend QDebug operator<<(QDebug, const KHttpCookie &); // for cookieStr()
-
-protected:
- QString mHost;
- QString mDomain;
- QString mPath;
- QString mName;
- QString mValue;
- qint64 mExpireDate;
- int mProtocolVersion;
- bool mSecure;
- bool mCrossDomain;
- bool mHttpOnly;
- bool mExplicitPath;
- QList<WId> mWindowIds;
- QList<int> mPorts;
- KCookieAdvice mUserSelectedAdvice;
-
- QString cookieStr(bool useDOMFormat) const;
-
-public:
- explicit KHttpCookie(const QString &_host = QString(),
- const QString &_domain = QString(),
- const QString &_path = QString(),
- const QString &_name = QString(),
- const QString &_value = QString(),
- qint64 _expireDate = 0,
- int _protocolVersion = 0,
- bool _secure = false,
- bool _httpOnly = false,
- bool _explicitPath = false);
-
- QString domain() const
- {
- return mDomain;
- }
- QString host() const
- {
- return mHost;
- }
- QString path() const
- {
- return mPath;
- }
- QString name() const
- {
- return mName;
- }
- QString value() const
- {
- return mValue;
- }
- QList<WId> &windowIds()
- {
- return mWindowIds;
- }
- const QList<WId> &windowIds() const
- {
- return mWindowIds;
- }
- const QList<int> &ports() const
- {
- return mPorts;
- }
- void fixDomain(const QString &domain)
- {
- mDomain = domain;
- }
- qint64 expireDate() const
- {
- return mExpireDate;
- }
- int protocolVersion() const
- {
- return mProtocolVersion;
- }
- bool isSecure() const
- {
- return mSecure;
- }
- /**
- * If currentDate is -1, the default, then the current timestamp in UTC
- * is used for comparison against this cookie's expiration date.
- */
- bool isExpired(qint64 currentDate = -1) const;
- bool isCrossDomain() const
- {
- return mCrossDomain;
- }
- bool isHttpOnly() const
- {
- return mHttpOnly;
- }
- bool hasExplicitPath() const
- {
- return mExplicitPath;
- }
- bool match(const QString &fqdn, const QStringList &domainList, const QString &path, int port = -1) const;
-
- KCookieAdvice getUserSelectedAdvice() const
- {
- return mUserSelectedAdvice;
- }
- void setUserSelectedAdvice(KCookieAdvice advice)
- {
- mUserSelectedAdvice = advice;
- }
-};
-
-QDebug operator<<(QDebug, const KHttpCookie &);
-
-class KHttpCookieList : public QList<KHttpCookie>
-{
-public:
- KHttpCookieList()
- : QList<KHttpCookie>()
- , advice(KCookieDunno)
- {
- }
- virtual ~KHttpCookieList()
- {
- }
-
- KCookieAdvice getAdvice() const
- {
- return advice;
- }
- void setAdvice(KCookieAdvice _advice)
- {
- advice = _advice;
- }
-
-private:
- KCookieAdvice advice;
-};
-
-QDebug operator<<(QDebug, const KHttpCookieList &);
-
-class KCookieJar
-{
-public:
- /**
- * Constructs a new cookie jar
- *
- * One jar should be enough for all cookies.
- */
- KCookieJar();
-
- /**
- * Destructs the cookie jar
- *
- * Poor little cookies, they will all be eaten by the cookie monster!
- */
- ~KCookieJar();
-
- KCookieJar(const KCookieJar &) = delete;
- KCookieJar &operator=(const KCookieJar &) = delete;
-
- /**
- * Returns whether the cookiejar has been changed
- */
- bool changed() const
- {
- return m_cookiesChanged || m_configChanged;
- }
-
- /**
- * Store all the cookies in a safe(?) place
- */
- bool saveCookies(const QString &_filename);
-
- /**
- * Load all the cookies from file and add them to the cookie jar.
- */
- bool loadCookies(const QString &_filename);
-
- /**
- * Save the cookie configuration
- */
- void saveConfig(KConfig *_config);
-
- /**
- * Load the cookie configuration
- */
- void loadConfig(KConfig *_config, bool reparse = false);
-
- /**
- * Looks for cookies in the cookie jar which are appropriate for _url.
- * Returned is a string containing all appropriate cookies in a format
- * which can be added to a HTTP-header without any additional processing.
- *
- * If @p useDOMFormat is true, the string is formatted in a format
- * in compliance with the DOM standard.
- * @p pendingCookies contains a list of cookies that have not been
- * approved yet by the user but that will be included in the result
- * none the less.
- */
- QString findCookies(const QString &_url, bool useDOMFormat, WId windowId, KHttpCookieList *pendingCookies = nullptr);
-
- /**
- * This function parses cookie_headers and returns a linked list of
- * valid KHttpCookie objects for all cookies found in cookie_headers.
- * If no cookies could be found 0 is returned.
- *
- * cookie_headers should be a concatenation of all lines of a HTTP-header
- * which start with "Set-Cookie". The lines should be separated by '\n's.
- */
- KHttpCookieList makeCookies(const QString &_url, const QByteArray &cookie_headers, WId windowId);
-
- /**
- * This function parses cookie_headers and returns a linked list of
- * valid KHttpCookie objects for all cookies found in cookie_headers.
- * If no cookies could be found 0 is returned.
- *
- * cookie_domstr should be a concatenation of "name=value" pairs, separated
- * by a semicolon ';'.
- */
- KHttpCookieList makeDOMCookies(const QString &_url, const QByteArray &cookie_domstr, WId windowId);
-
- /**
- * This function hands a KHttpCookie object over to the cookie jar.
- */
- void addCookie(KHttpCookie &cookie);
-
- /**
- * This function tells whether a single KHttpCookie object should
- * be considered persistent. Persistent cookies do not get deleted
- * at the end of the session and are saved on disk.
- */
- bool cookieIsPersistent(const KHttpCookie &cookie) const;
-
- /**
- * This function advises whether a single KHttpCookie object should
- * be added to the cookie jar.
- *
- * Possible return values are:
- * - KCookieAccept, the cookie should be added
- * - KCookieAcceptForSession, the cookie should be added as session cookie
- * - KCookieReject, the cookie should not be added
- * - KCookieAsk, the user should decide what to do
- *
- * Before sending cookies back to a server this function is consulted,
- * so that cookies having advice KCookieReject are not sent back.
- */
- KCookieAdvice cookieAdvice(const KHttpCookie &cookie) const;
-
- /**
- * This function gets the advice for all cookies originating from
- * _domain.
- *
- * - KCookieDunno, no specific advice for _domain
- * - KCookieAccept, accept all cookies for _domain
- * - KCookieAcceptForSession, accept all cookies for _domain as session cookies
- * - KCookieReject, reject all cookies for _domain
- * - KCookieAsk, the user decides what to do with cookies for _domain
- */
- KCookieAdvice getDomainAdvice(const QString &_domain) const;
-
- /**
- * This function sets the advice for all cookies originating from
- * _domain.
- *
- * _advice can have the following values:
- * - KCookieDunno, no specific advice for _domain
- * - KCookieAccept, accept all cookies for _domain
- * - KCookieAcceptForSession, accept all cookies for _domain as session cookies
- * - KCookieReject, reject all cookies for _domain
- * - KCookieAsk, the user decides what to do with cookies for _domain
- */
- void setDomainAdvice(const QString &domain, KCookieAdvice advice);
-
- /**
- * This function sets the advice for all cookies originating from
- * the same domain as _cookie
- *
- * _advice can have the following values:
- * - KCookieDunno, no specific advice for _domain
- * - KCookieAccept, accept all cookies for _domain
- * - KCookieAcceptForSession, accept all cookies for _domain as session cookies
- * - KCookieReject, reject all cookies for _domain
- * - KCookieAsk, the user decides what to do with cookies for _domain
- */
- void setDomainAdvice(const KHttpCookie &_cookie, KCookieAdvice _advice);
-
- /**
- * Get the global advice for cookies
- *
- * The returned advice can have the following values:
- * - KCookieAccept, accept cookies
- * - KCookieAcceptForSession, accept cookies as session cookies
- * - KCookieReject, reject cookies
- * - KCookieAsk, the user decides what to do with cookies
- *
- * The global advice is used if the domain has no advice set.
- */
- KCookieAdvice getGlobalAdvice() const
- {
- return m_globalAdvice;
- }
-
- /**
- * This function sets the global advice for cookies
- *
- * _advice can have the following values:
- * - KCookieAccept, accept cookies
- * - KCookieAcceptForSession, accept cookies as session cookies
- * - KCookieReject, reject cookies
- * - KCookieAsk, the user decides what to do with cookies
- *
- * The global advice is used if the domain has no advice set.
- */
- void setGlobalAdvice(KCookieAdvice _advice);
-
- /**
- * Get a list of all domains known to the cookie jar.
- * A domain is known to the cookie jar if:
- * - It has a cookie originating from the domain
- * - It has a specific advice set for the domain
- */
- const QStringList &getDomainList();
-
- /**
- * Get a list of all cookies in the cookie jar originating from _domain.
- */
- KHttpCookieList *getCookieList(const QString &_domain, const QString &_fqdn);
-
- /**
- * Remove & delete a cookie from the jar.
- *
- * cookieIterator should be one of the entries in a KHttpCookieList.
- * Update your KHttpCookieList by calling getCookieList after
- * calling this function.
- */
- void eatCookie(const KHttpCookieList::iterator &cookieIterator);
-
- /**
- * Remove & delete all cookies for @p domain.
- */
- void eatCookiesForDomain(const QString &domain);
-
- /**
- * Remove & delete all cookies
- */
- void eatAllCookies();
-
- /**
- * Removes all end of session cookies set by the
- * session @p windId.
- */
- void eatSessionCookies(long windowId);
-
- /**
- * Removes all end of session cookies set by the
- * session @p windId.
- */
- void eatSessionCookies(const QString &fqdn, WId windowId, bool isFQDN = true);
-
- /**
- * Parses _url and returns the FQDN (_fqdn) and path (_path).
- */
- static bool parseUrl(const QString &_url, QString &_fqdn, QString &_path, int *port = nullptr);
-
- /**
- * Returns a list of domains in @p _domainList relevant for this host.
- * The list is sorted with the FQDN listed first and the top-most
- * domain listed last
- */
- void extractDomains(const QString &_fqdn, QStringList &_domainList) const;
-
- static QString adviceToStr(KCookieAdvice _advice);
- static KCookieAdvice strToAdvice(const QString &_str);
-
- enum KCookieDefaultPolicy {
- ApplyToShownCookiesOnly = 0,
- ApplyToCookiesFromDomain = 1,
- ApplyToAllCookies = 2,
- };
- /** Returns the user's choice in the cookie window */
- KCookieDefaultPolicy preferredDefaultPolicy() const
- {
- return m_preferredPolicy;
- }
-
- /** Returns the */
- bool showCookieDetails() const
- {
- return m_showCookieDetails;
- }
-
- /**
- * Sets the user's default preference cookie policy.
- */
- void setPreferredDefaultPolicy(KCookieDefaultPolicy value)
- {
- m_preferredPolicy = value;
- }
-
- /**
- * Sets the user's preference of level of detail displayed
- * by the cookie dialog.
- */
- void setShowCookieDetails(bool value)
- {
- m_showCookieDetails = value;
- }
-
-protected:
- void stripDomain(const QString &_fqdn, QString &_domain) const;
- QString stripDomain(const KHttpCookie &cookie) const;
-
-protected:
- QStringList m_domainList;
- KCookieAdvice m_globalAdvice;
- QHash<QString, KHttpCookieList *> m_cookieDomains;
- QSet<QString> m_twoLevelTLD;
- QSet<QString> m_gTLDs;
-
- bool m_configChanged;
- bool m_cookiesChanged;
- bool m_showCookieDetails;
- bool m_rejectCrossDomainCookies;
- bool m_autoAcceptSessionCookies;
-
- KCookieDefaultPolicy m_preferredPolicy;
-};
-#endif
diff --git a/src/kioworkers/http/kcookiejar/kcookiejar.json b/src/kioworkers/http/kcookiejar/kcookiejar.json
deleted file mode 100644
index 0b1120a5f5..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookiejar.json
+++ /dev/null
@@ -1,125 +0,0 @@
-{
- "KPlugin": {
- "Description": "Stores network cookies",
- "Description[ar]": "يُخزّن كعكات الشبكة",
- "Description[ast]": "Atroxa les cookies de la rede",
- "Description[az]": "Şəbəkə kukilərinin saxlanması",
- "Description[be at latin]": "Zachoŭvaje sietkavyja cookie",
- "Description[be]": "Захоўвае сеткавыя cookie",
- "Description[bg]": "Съхранява бисквитки от мрежата",
- "Description[bs]": "Čuva mrežne kolačiće",
- "Description[ca at valencia]": "Emmagatzema les galetes de la xarxa",
- "Description[ca]": "Emmagatzema les galetes de la xarxa",
- "Description[cs]": "Ukládá síťová cookie",
- "Description[cy]": "Ystorio cogineidiau rhwydwaith",
- "Description[da]": "Gemmer netværks-cookies",
- "Description[de]": "Speichert Netzwerk-Cookies",
- "Description[el]": "Αποθηκεύει δικτυακά cookies",
- "Description[en_GB]": "Stores network cookies",
- "Description[eo]": "Konservas retajn kuketojn",
- "Description[es]": "Guarda las cookies de la red",
- "Description[et]": "Võrguküpsiste salvestamine",
- "Description[eu]": "Sareko cookiak biltegiratzen ditu",
- "Description[fi]": "Säilyttää verkkoevästeitä",
- "Description[fr]": "Stocke les cookies réseau",
- "Description[gd]": "Glèidhidh seo briosgaidean lìonraidh",
- "Description[gl]": "Garda cookies da rede",
- "Description[hu]": "Hálózati sütik tárolása",
- "Description[ia]": "Il immagazina le cookies de rete",
- "Description[id]": "Simpanan cookie jaringan",
- "Description[ie]": "Acumula cookies de rete",
- "Description[is]": "Geymir kökur af netinu",
- "Description[it]": "Memorizza i cookie di rete",
- "Description[ka]": "ვებ-ქუქიების საცავი",
- "Description[ko]": "네트워크 쿠키 저장",
- "Description[lt]": "Saugo tinklo slapukus",
- "Description[ml]": "നെറ്റ്വർക്ക് കുക്കികൾ സംഭരിക്കുന്നു",
- "Description[my]": "ဆ.သ.ရ-ကွန်ရက်ဆိုင်ရာ ကွတ်ကီးများ သိမ်းဆည်းသည်",
- "Description[nl]": "Slaat netwerk-cookies op",
- "Description[nn]": "Lagrar infokapslar frå nettverket",
- "Description[pa]": "ਨੈੱਟਵਰਕ ਕੂਕੀਜ਼ ਸੰਭਾਲਦਾ ਹੈ",
- "Description[pl]": "Przechowuje ciasteczka sieciowe",
- "Description[pt]": "Guarda os 'cookies' de rede",
- "Description[pt_BR]": "Armazena os cookies da rede",
- "Description[ro]": "Stochează cookie-uri de rețea",
- "Description[ru]": "Сохранение сетевых cookie",
- "Description[sk]": "Ukladá sieťové cookies",
- "Description[sl]": "Hrani omrežne piškotke",
- "Description[sr at ijekavian]": "Складишти мрежне колачиће",
- "Description[sr at ijekavianlatin]": "Skladišti mrežne kolačiće",
- "Description[sr at latin]": "Skladišti mrežne kolačiće",
- "Description[sr]": "Складишти мрежне колачиће",
- "Description[sv]": "Lagrar nätverkskakor",
- "Description[ta]": "பிணைய நினைவிகளைச் சேமிக்கும்",
- "Description[tg]": "Кукиҳои шабакаро нигоҳ медорад",
- "Description[tok]": "ilo ni li awen e sona lili tan ilo lipu kulupu",
- "Description[tr]": "Ağ çerezlerini depolar",
- "Description[uk]": "Зберігання кук мережі",
- "Description[vi]": "Lưu bánh quy mạng",
- "Description[x-test]": "xxStores network cookiesxx",
- "Description[zh_CN]": "存储网络 Cookie",
- "Description[zh_TW]": "儲存網路 cookies",
- "Name": "Cookie Jar",
- "Name[ar]": "إناء الكعك",
- "Name[ast]": "Almacén de cookies",
- "Name[az]": "Kuki xidməti",
- "Name[be at latin]": "Schovišča cookie",
- "Name[be]": "Сховішча cookie",
- "Name[bg]": "Кутия за бисквитки",
- "Name[bs]": "Tegla sa Kolačićima",
- "Name[ca at valencia]": "Repositori de les galetes",
- "Name[ca]": "Repositori de les galetes",
- "Name[cs]": "Cookie Jar",
- "Name[cy]": "Ystên coginiaid",
- "Name[da]": "Cookie jar",
- "Name[de]": "Cookie-Behälter",
- "Name[el]": "Cookie Jar",
- "Name[en_GB]": "Cookie Jar",
- "Name[eo]": "Kuket-Bokalo",
- "Name[es]": "Tarro de cookies",
- "Name[et]": "Küpsisekarp",
- "Name[eu]": "Cookie ontzia",
- "Name[fi]": "Evästeiden säilytys",
- "Name[fr]": "Boîte à cookies",
- "Name[gd]": "Crogan bhriosgaidean",
- "Name[gl]": "Bote de cookies",
- "Name[hu]": "Sütitároló",
- "Name[ia]": "Cookie Jar",
- "Name[id]": "Cookie Jar",
- "Name[ie]": "Potte de cookies",
- "Name[is]": "Vefkökubox",
- "Name[it]": "Contenitore dei cookie",
- "Name[ka]": "Cookie Jar",
- "Name[ko]": "쿠키 통",
- "Name[lt]": "Slapukų indas",
- "Name[ml]": "കുക്കി ജാർ",
- "Name[my]": "ကွတ်ကီးဘူး",
- "Name[nl]": "Cookie-depot",
- "Name[nn]": "Infokapsel-lager",
- "Name[pa]": "ਕੂਕੀਜ਼ ਜ਼ਾਰ",
- "Name[pl]": "Słoiki z ciastkami",
- "Name[pt]": "Repositório de 'Cookies'",
- "Name[pt_BR]": "Repositório de cookies",
- "Name[ro]": "Cookie Jar",
- "Name[ru]": "Служба cookie",
- "Name[sk]": "Úložisko cookie",
- "Name[sl]": "Posoda s piškotki",
- "Name[sr at ijekavian]": "Тегла колачића",
- "Name[sr at ijekavianlatin]": "Tegla kolačića",
- "Name[sr at latin]": "Tegla kolačića",
- "Name[sr]": "Тегла колачића",
- "Name[sv]": "Kakburk",
- "Name[ta]": "நினைவி சேமிப்பகம்",
- "Name[tg]": "Гунҷоиши кукиҳо",
- "Name[tok]": "ilo poki pi sona lili awen",
- "Name[tr]": "Çerez Kavanozu",
- "Name[uk]": "Глечик з куками",
- "Name[vi]": "Hũ bánh quy",
- "Name[x-test]": "xxCookie Jarxx",
- "Name[zh_CN]": "Cookie Jar",
- "Name[zh_TW]": "Cookie Jar"
- },
- "X-KDE-DBus-ServiceName": "org.kde.kcookiejar5",
- "X-KDE-Kded-autoload": false,
- "X-KDE-Kded-load-on-demand": true
-}
diff --git a/src/kioworkers/http/kcookiejar/kcookiejar_include.h b/src/kioworkers/http/kcookiejar/kcookiejar_include.h
deleted file mode 100644
index bde32b3449..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookiejar_include.h
+++ /dev/null
@@ -1,9 +0,0 @@
-// krazy:excludeall=copyright,license (nothing substantial in this file)
-// remove as soon as dbusxml2cpp is fixed, Alex
-
-#include <QDBusConnection>
-
-#ifndef QDECLAREQLISTINT_HACK_H
-#define QDECLAREQLISTINT_HACK_H
-
-#endif
diff --git a/src/kioworkers/http/kcookiejar/kcookieserver.cpp b/src/kioworkers/http/kcookiejar/kcookieserver.cpp
deleted file mode 100644
index b02b6f425c..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookieserver.cpp
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- This file is part of KDE
- SPDX-FileCopyrightText: 1998-2000 Waldo Bastian <bastian at kde.org>
-
- SPDX-License-Identifier: MIT
-*/
-
-// KDE Cookie Server
-
-#include "kcookieserver.h"
-
-static constexpr int s_saveDelay = 3; // Save after 3 minutes
-
-#include <QFile>
-#include <QTimer>
-
-#include <KConfig>
-#include <QDebug>
-
-#include <KLocalizedString>
-#include <KPluginFactory>
-#include <QMessageBox>
-#include <QStandardPaths>
-#include <kwindowsystem.h>
-
-#include <QLoggingCategory>
-Q_DECLARE_LOGGING_CATEGORY(KIO_COOKIEJAR)
-
-#include "kcookiejar.h"
-#include "kcookieserveradaptor.h"
-#include "kcookiewin.h"
-
-K_PLUGIN_CLASS_WITH_JSON(KCookieServer, "kcookiejar.json")
-
-static QDir getOrCreateCookieJarDir()
-{
- const QDir dataDir(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
- const QString kcookiejarDirName = dataDir.absoluteFilePath(QStringLiteral("kcookiejar"));
-
- if (dataDir.exists(QStringLiteral("kcookiejar"))) {
- const QFileInfo cookiejarDirInfo(kcookiejarDirName);
-
- if (!cookiejarDirInfo.isDir()) {
- QFile kcookieBogusFile(kcookiejarDirName);
-
- if (!kcookieBogusFile.remove()) {
- QMessageBox::warning(nullptr, i18n("Cannot Save Cookies"), i18n("Could not remove %1, check permissions", cookiejarDirInfo.absoluteFilePath()));
- }
- } else {
- return QDir(kcookiejarDirName);
- }
- }
-
- if (!dataDir.mkpath(QStringLiteral("kcookiejar"))) {
- QMessageBox::warning(nullptr, i18n("Cannot Save Cookies"), i18n("Could not create directory %1", kcookiejarDirName));
- }
-
- return QDir(kcookiejarDirName);
-}
-
-// Cookie field indexes
-enum CookieDetails {
- CF_DOMAIN = 0,
- CF_PATH,
- CF_NAME,
- CF_HOST,
- CF_VALUE,
- CF_EXPIRE,
- CF_PROVER,
- CF_SECURE,
-};
-
-class CookieRequest
-{
-public:
- QDBusMessage reply;
- QString url;
- bool DOM;
- qlonglong windowId;
-};
-
-template class QList<CookieRequest *>;
-
-class RequestList : public QList<CookieRequest *>
-{
-public:
- RequestList()
- : QList<CookieRequest *>()
- {
- }
-};
-
-KCookieServer::KCookieServer(QObject *parent, const QList<QVariant> &)
- : KDEDModule(parent)
-{
- (void)new KCookieServerAdaptor(this);
- mCookieJar = new KCookieJar;
- mPendingCookies = new KHttpCookieList;
- mRequestList = new RequestList;
- mAdvicePending = false;
- mTimer = new QTimer();
- mTimer->setSingleShot(true);
- connect(mTimer, &QTimer::timeout, this, &KCookieServer::slotSave);
- mConfig = new KConfig(QStringLiteral("kcookiejarrc"));
- mCookieJar->loadConfig(mConfig);
- mFilename = getOrCreateCookieJarDir().absoluteFilePath(QStringLiteral("cookies"));
- mCookieJar->loadCookies(mFilename);
- connect(this, &KDEDModule::windowUnregistered, this, &KCookieServer::slotDeleteSessionCookies);
-}
-
-KCookieServer::~KCookieServer()
-{
- slotSave();
- delete mCookieJar;
- delete mTimer;
- delete mPendingCookies;
- delete mConfig;
-}
-
-bool KCookieServer::cookiesPending(const QString &url, KHttpCookieList *cookieList)
-{
- QString fqdn;
- QString path;
- // Check whether 'url' has cookies on the pending list
- if (mPendingCookies->isEmpty()) {
- return false;
- }
- if (!KCookieJar::parseUrl(url, fqdn, path)) {
- return false;
- }
-
- QStringList domains;
- mCookieJar->extractDomains(fqdn, domains);
- for (const KHttpCookie &cookie : std::as_const(*mPendingCookies)) {
- if (cookie.match(fqdn, domains, path)) {
- if (!cookieList) {
- return true;
- }
- cookieList->append(cookie);
- }
- }
- if (!cookieList) {
- return false;
- }
- return cookieList->isEmpty();
-}
-
-void KCookieServer::addCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId, bool useDOMFormat)
-{
- KHttpCookieList cookieList;
- if (useDOMFormat) {
- cookieList = mCookieJar->makeDOMCookies(url, cookieHeader, windowId);
- } else {
- cookieList = mCookieJar->makeCookies(url, cookieHeader, windowId);
- }
-
- checkCookies(&cookieList, windowId);
-
- *mPendingCookies += cookieList;
-
- if (!mAdvicePending) {
- mAdvicePending = true;
- while (!mPendingCookies->isEmpty()) {
- checkCookies(nullptr, windowId);
- }
- mAdvicePending = false;
- }
-}
-
-void KCookieServer::checkCookies(KHttpCookieList *cookieList)
-{
- checkCookies(cookieList, 0);
-}
-
-void KCookieServer::checkCookies(KHttpCookieList *cookieList, qlonglong windowId)
-{
- KHttpCookieList *list;
-
- if (cookieList) {
- list = cookieList;
- } else {
- list = mPendingCookies;
- }
-
- QMutableListIterator<KHttpCookie> cookieIterator(*list);
- while (cookieIterator.hasNext()) {
- KHttpCookie &cookie = cookieIterator.next();
- const KCookieAdvice advice = mCookieJar->cookieAdvice(cookie);
- switch (advice) {
- case KCookieAccept:
- case KCookieAcceptForSession:
- mCookieJar->addCookie(cookie);
- cookieIterator.remove();
- break;
- case KCookieReject:
- cookieIterator.remove();
- break;
- case KCookieDunno:
- case KCookieAsk:
- break;
- }
- }
-
- if (cookieList || list->isEmpty()) {
- return;
- }
-
- // Collect all pending cookies with the same host as the first pending cookie
- const KHttpCookie ¤tCookie = mPendingCookies->first();
- KHttpCookieList currentList;
- currentList.append(currentCookie);
- const QString currentHost = currentCookie.host();
- QList<int> shownCookies;
- shownCookies << 0;
- for (int i = 1 /*first already done*/; i < mPendingCookies->count(); ++i) {
- const KHttpCookie &cookie = (*mPendingCookies)[i];
- if (cookie.host() == currentHost) {
- currentList.append(cookie);
- shownCookies << i;
- }
- }
- // qDebug() << shownCookies;
-
- KCookieWin *kw = new KCookieWin(nullptr, currentList, mCookieJar->preferredDefaultPolicy(), mCookieJar->showCookieDetails());
- if (windowId > 0) {
- kw->setAttribute(Qt::WA_NativeWindow, true);
- KWindowSystem::setMainWindow(kw->windowHandle(), windowId);
- }
-
- KCookieAdvice userAdvice = kw->advice(mCookieJar, currentCookie);
- delete kw;
- // Save the cookie config if it has changed
- mCookieJar->saveConfig(mConfig);
-
- // Apply the user's choice to all cookies that are currently
- // queued for this host (or just the first one, if the user asks for that).
- QMutableListIterator<KHttpCookie> cookieIterator2(*mPendingCookies);
- int pendingCookieIndex = -1;
- while (cookieIterator2.hasNext()) {
- ++pendingCookieIndex;
- KHttpCookie &cookie = cookieIterator2.next();
- if (cookie.host() != currentHost) {
- continue;
- }
- if (mCookieJar->preferredDefaultPolicy() == KCookieJar::ApplyToShownCookiesOnly && !shownCookies.contains(pendingCookieIndex)) {
- // User chose "only those cookies", and this one was added while the dialog was up -> skip
- break;
- }
- switch (userAdvice) {
- case KCookieAccept:
- case KCookieAcceptForSession:
- // Store the user's choice for the cookie.
- // This is only used to check later if the cookie should expire
- // at the end of the session. The choice is not saved on disk.
- cookie.setUserSelectedAdvice(userAdvice);
- mCookieJar->addCookie(cookie);
- cookieIterator2.remove();
- break;
-
- case KCookieReject:
- cookieIterator2.remove();
- break;
-
- case KCookieDunno:
- case KCookieAsk:
- qCWarning(KIO_COOKIEJAR) << "userAdvice not accept or reject, this should never happen!";
- break;
- }
- }
-
- // Check if we can handle any request
- QMutableListIterator<CookieRequest *> requestIterator(*mRequestList);
- while (requestIterator.hasNext()) {
- CookieRequest *request = requestIterator.next();
- if (!cookiesPending(request->url)) {
- const QString res = mCookieJar->findCookies(request->url, request->DOM, request->windowId);
-
- QDBusConnection::sessionBus().send(request->reply.createReply(res));
- delete request;
- requestIterator.remove();
- }
- }
-
- saveCookieJar();
-}
-
-void KCookieServer::slotSave()
-{
- if (mCookieJar->changed()) {
- mCookieJar->saveCookies(mFilename);
- }
-}
-
-void KCookieServer::saveCookieJar()
-{
- if (mTimer->isActive()) {
- return;
- }
-
- mTimer->start(1000 * 60 * s_saveDelay);
-}
-
-void KCookieServer::putCookie(QStringList &out, const KHttpCookie &cookie, const QList<int> &fields)
-{
- for (int i : fields) {
- switch (i) {
- case CF_DOMAIN:
- out << cookie.domain();
- break;
- case CF_NAME:
- out << cookie.name();
- break;
- case CF_PATH:
- out << cookie.path();
- break;
- case CF_HOST:
- out << cookie.host();
- break;
- case CF_VALUE:
- out << cookie.value();
- break;
- case CF_EXPIRE:
- out << QString::number(cookie.expireDate());
- break;
- case CF_PROVER:
- out << QString::number(cookie.protocolVersion());
- break;
- case CF_SECURE:
- out << QString::number(cookie.isSecure() ? 1 : 0);
- break;
- default:
- out << QString();
- }
- }
-}
-
-bool KCookieServer::cookieMatches(const KHttpCookie &c, const QString &domain, const QString &fqdn, const QString &path, const QString &name)
-{
- const bool hasDomain = !domain.isEmpty();
- return (((hasDomain && c.domain() == domain) || fqdn == c.host()) && (c.path() == path) && (c.name() == name) && (!c.isExpired()));
-}
-
-// DBUS function
-QString KCookieServer::listCookies(const QString &url)
-{
- return findCookies(url, 0);
-}
-
-// DBUS function
-QString KCookieServer::findCookies(const QString &url, qlonglong windowId)
-{
- if (cookiesPending(url)) {
- CookieRequest *request = new CookieRequest;
- message().setDelayedReply(true);
- request->reply = message();
- request->url = url;
- request->DOM = false;
- request->windowId = windowId;
- mRequestList->append(request);
- return QString(); // Talk to you later :-)
- }
-
- QString cookies = mCookieJar->findCookies(url, false, windowId);
- saveCookieJar();
- return cookies;
-}
-
-// DBUS function
-QStringList KCookieServer::findDomains()
-{
- QStringList result;
- for (const QString &domain : mCookieJar->getDomainList()) {
- // Ignore domains that have policy set for but contain
- // no cookies whatsoever...
- const KHttpCookieList *list = mCookieJar->getCookieList(domain, QString());
- if (list && !list->isEmpty()) {
- result << domain;
- }
- }
- return result;
-}
-
-// DBUS function
-QStringList KCookieServer::findCookies(const QList<int> &fields, const QString &_domain, const QString &fqdn, const QString &path, const QString &name)
-{
- QStringList result;
- const bool allCookies = name.isEmpty();
- const QStringList domainList = _domain.split(QLatin1Char(' '));
-
- if (allCookies) {
- for (const QString &domain : domainList) {
- const KHttpCookieList *list = mCookieJar->getCookieList(domain, fqdn);
- if (!list) {
- continue;
- }
- for (const KHttpCookie &cookie : *list) {
- if (cookie.isExpired()) {
- continue;
- }
- putCookie(result, cookie, fields);
- }
- }
- } else {
- for (const QString &domain : domainList) {
- const KHttpCookieList *list = mCookieJar->getCookieList(domain, fqdn);
- if (!list) {
- continue;
- }
- for (const KHttpCookie &cookie : *list) {
- if (cookie.isExpired()) {
- continue;
- }
- if (cookieMatches(cookie, domain, fqdn, path, name)) {
- putCookie(result, cookie, fields);
- break;
- }
- }
- }
- }
-
- return result;
-}
-
-// DBUS function
-QString KCookieServer::findDOMCookies(const QString &url)
-{
- return findDOMCookies(url, 0);
-}
-
-// DBUS function
-QString KCookieServer::findDOMCookies(const QString &url, qlonglong windowId)
-{
- // We don't wait for pending cookies because it locks up konqueror
- // which can cause a deadlock if it happens to have a popup-menu up.
- // Instead we just return pending cookies as if they had been accepted already.
- KHttpCookieList pendingCookies;
- cookiesPending(url, &pendingCookies);
-
- return mCookieJar->findCookies(url, true, windowId, &pendingCookies);
-}
-
-// DBUS function
-void KCookieServer::addCookies(const QString &arg1, const QByteArray &arg2, qlonglong arg3)
-{
- addCookies(arg1, arg2, arg3, false);
-}
-
-// DBUS function
-void KCookieServer::deleteCookie(const QString &domain, const QString &fqdn, const QString &path, const QString &name)
-{
- KHttpCookieList *cookieList = mCookieJar->getCookieList(domain, fqdn);
- if (cookieList && !cookieList->isEmpty()) {
- KHttpCookieList::Iterator itEnd = cookieList->end();
- for (KHttpCookieList::Iterator it = cookieList->begin(); it != itEnd; ++it) {
- if (cookieMatches(*it, domain, fqdn, path, name)) {
- mCookieJar->eatCookie(it);
- saveCookieJar();
- break;
- }
- }
- }
-}
-
-// DBUS function
-void KCookieServer::deleteCookiesFromDomain(const QString &domain)
-{
- mCookieJar->eatCookiesForDomain(domain);
- saveCookieJar();
-}
-
-// Qt function
-void KCookieServer::slotDeleteSessionCookies(qlonglong windowId)
-{
- deleteSessionCookies(windowId);
-}
-
-// DBUS function
-void KCookieServer::deleteSessionCookies(qlonglong windowId)
-{
- mCookieJar->eatSessionCookies(windowId);
- saveCookieJar();
-}
-
-void KCookieServer::deleteSessionCookiesFor(const QString &fqdn, qlonglong windowId)
-{
- mCookieJar->eatSessionCookies(fqdn, windowId);
- saveCookieJar();
-}
-
-// DBUS function
-void KCookieServer::deleteAllCookies()
-{
- mCookieJar->eatAllCookies();
- saveCookieJar();
-}
-
-// DBUS function
-void KCookieServer::addDOMCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId)
-{
- addCookies(url, cookieHeader, windowId, true);
-}
-
-// DBUS function
-bool KCookieServer::setDomainAdvice(const QString &url, const QString &advice)
-{
- QString fqdn;
- QString dummy;
- if (KCookieJar::parseUrl(url, fqdn, dummy)) {
- QStringList domains;
- mCookieJar->extractDomains(fqdn, domains);
-
- mCookieJar->setDomainAdvice(domains[domains.count() > 3 ? 3 : 0], KCookieJar::strToAdvice(advice));
- // Save the cookie config if it has changed
- mCookieJar->saveConfig(mConfig);
- return true;
- }
- return false;
-}
-
-// DBUS function
-QString KCookieServer::getDomainAdvice(const QString &url)
-{
- KCookieAdvice advice = KCookieDunno;
- QString fqdn;
- QString dummy;
- if (KCookieJar::parseUrl(url, fqdn, dummy)) {
- QStringList domains;
- mCookieJar->extractDomains(fqdn, domains);
-
- QStringListIterator it(domains);
- while ((advice == KCookieDunno) && it.hasNext()) {
- // Always check advice in both ".domain" and "domain". Note
- // that we only want to check "domain" if it matches the
- // fqdn of the requested URL.
- const QString &domain = it.next();
- if (domain.at(0) == QLatin1Char('.') || domain == fqdn) {
- advice = mCookieJar->getDomainAdvice(domain);
- }
- }
- if (advice == KCookieDunno) {
- advice = mCookieJar->getGlobalAdvice();
- }
- }
- return KCookieJar::adviceToStr(advice);
-}
-
-// DBUS function
-void KCookieServer::reloadPolicy()
-{
- mCookieJar->loadConfig(mConfig, true);
-}
-
-// DBUS function
-void KCookieServer::shutdown()
-{
- deleteLater();
-}
-
-#include "kcookieserver.moc"
-#include "moc_kcookieserver.cpp"
diff --git a/src/kioworkers/http/kcookiejar/kcookieserver.h b/src/kioworkers/http/kcookiejar/kcookieserver.h
deleted file mode 100644
index 9c42c4dc47..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookieserver.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- This file is part of the KDE File Manager
- SPDX-FileCopyrightText: 1998 Waldo Bastian <bastian at kde.org>
-
- SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only
-*/
-
-// KDE Cookie Server
-
-#ifndef KCOOKIESERVER_H
-#define KCOOKIESERVER_H
-
-#include <KDEDModule>
-#include <QDBusConnection>
-#include <QDBusContext>
-#include <QStringList>
-
-class KHttpCookieList;
-class KCookieJar;
-class KHttpCookie;
-class QTimer;
-class RequestList;
-class KConfig;
-
-// IMPORTANT: Do *NOT* replace qlonglong with WId in this class.
-//
-// KCookieServer is exposed over DBus and DBus does not know how to handle the
-// WId type. If a method has a WId argument it is not exposed and one gets a
-// warning at compile time:
-//
-// "addFunction: Unregistered input type in parameter list: WId"
-
-class KCookieServer : public KDEDModule, protected QDBusContext
-{
- Q_OBJECT
- Q_CLASSINFO("D-Bus Interface", "org.kde.KCookieServer")
-public:
- KCookieServer(QObject *parent, const QList<QVariant> &);
- ~KCookieServer() override;
-
-public Q_SLOTS:
- // KDE5 TODO: don't overload names here, it prevents calling e.g. findCookies from the command-line using qdbus.
- QString listCookies(const QString &url);
- QString findCookies(const QString &url, qlonglong windowId);
- QStringList findDomains();
- // KDE5: rename
- QStringList findCookies(const QList<int> &fields, const QString &domain, const QString &fqdn, const QString &path, const QString &name);
- QString findDOMCookies(const QString &url);
- QString findDOMCookies(const QString &url, qlonglong windowId); // KDE5: merge with above, using default value (windowId = 0)
- void addCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId);
- void deleteCookie(const QString &domain, const QString &fqdn, const QString &path, const QString &name);
- void deleteCookiesFromDomain(const QString &domain);
- void deleteSessionCookies(qlonglong windowId);
- void deleteSessionCookiesFor(const QString &fqdn, qlonglong windowId);
- void deleteAllCookies();
- void addDOMCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId);
- /**
- * Sets the cookie policy for the domain associated with the specified URL.
- */
- bool setDomainAdvice(const QString &url, const QString &advice);
- /**
- * Returns the cookie policy in effect for the specified URL.
- */
- QString getDomainAdvice(const QString &url);
- void reloadPolicy();
- void shutdown();
-
-public:
- bool cookiesPending(const QString &url, KHttpCookieList *cookieList = nullptr);
- void addCookies(const QString &url, const QByteArray &cookieHeader, qlonglong windowId, bool useDOMFormat);
- void checkCookies(KHttpCookieList *cookieList);
- // TODO: KDE5 merge with above function and make all these public functions
- // private since they are not used externally.
- void checkCookies(KHttpCookieList *cookieList, qlonglong windowId);
-
-private Q_SLOTS:
- void slotSave();
- void slotDeleteSessionCookies(qlonglong windowId);
-
-private:
- KCookieJar *mCookieJar;
- KHttpCookieList *mPendingCookies;
- RequestList *mRequestList;
- QTimer *mTimer;
- bool mAdvicePending;
- KConfig *mConfig;
- QString mFilename;
-
-private:
- bool cookieMatches(const KHttpCookie &, const QString &, const QString &, const QString &, const QString &);
- void putCookie(QStringList &, const KHttpCookie &, const QList<int> &);
- void saveCookieJar();
-};
-
-#endif
diff --git a/src/kioworkers/http/kcookiejar/kcookiewin.cpp b/src/kioworkers/http/kcookiejar/kcookiewin.cpp
deleted file mode 100644
index 97aed1023d..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookiewin.cpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- This file is part of KDE
- SPDX-FileCopyrightText: 2000 Waldo Bastian <bastian at kde.org>
- SPDX-FileCopyrightText: 2000 Dawit Alemayehu <adawit at kde.org>
-
- SPDX-License-Identifier: MIT
-*/
-
-// KDE File Manager -- HTTP Cookie Dialogs
-
-// The purpose of the QT_NO_TOOLTIP and QT_NO_WHATSTHIS ifdefs is because
-// this file is also used in Konqueror/Embedded. One of the aims of
-// Konqueror/Embedded is to be a small as possible to fit on embedded
-// devices. For this it's also useful to strip out unneeded features of
-// Qt, like for example QToolTip or QWhatsThis. The availability (or the
-// lack thereof) can be determined using these preprocessor defines.
-// The same applies to the QT_NO_ACCEL ifdef below. I hope it doesn't make
-// too much trouble... (Simon)
-
-#include "kcookiewin.h"
-
-#include <QDateTime>
-#include <QDialogButtonBox>
-#include <QLabel>
-#include <QLayout>
-#include <QLineEdit>
-#include <QPushButton>
-#include <QShortcut>
-#include <QStyle>
-#include <QUrl>
-
-#include <KLocalizedString>
-#include <kwindowsystem.h>
-
-#include "config-kcookiejar.h"
-#if HAVE_X11
-#include <KUserTimestamp>
-#endif
-
-enum {
- AcceptedForSession = QDialog::Accepted + 1,
-};
-
-KCookieWin::KCookieWin(QWidget *parent, KHttpCookieList cookieList, int defaultButton, bool showDetails)
- : QDialog(parent)
-{
- setModal(true);
- setObjectName(QStringLiteral("cookiealert"));
- setWindowTitle(i18n("Cookie Alert"));
- setWindowIcon(QIcon::fromTheme(QStringLiteral("preferences-web-browser-cookies")));
- // all cookies in the list should have the same window at this time, so let's take the first
- if (!cookieList.first().windowIds().isEmpty()) {
- setAttribute(Qt::WA_NativeWindow, true);
- KWindowSystem::setMainWindow(windowHandle(), cookieList.first().windowIds().first());
- } else {
- // No window associated... make sure the user notices our dialog.
- KWindowSystem::setState(winId(), NET::KeepAbove);
-#if HAVE_X11
- KUserTimestamp::updateUserTimestamp();
-#endif
- }
-
- const int count = cookieList.count();
- const KHttpCookie &cookie = cookieList.first();
- QString host(cookie.host());
- const int pos = host.indexOf(QLatin1Char(':'));
- if (pos > 0) {
- QString portNum = host.left(pos);
- host.remove(0, pos + 1);
- host += QLatin1Char(':');
- host += portNum;
- }
-
- QString txt = QStringLiteral("<html><body style=\"p {line-height: 150%}; text-align: center;\">");
- txt += i18ncp("%2 hostname, %3 optional cross domain suffix (translated below)",
- "<p>You received a cookie from<br/>"
- "<b>%2%3</b><br/>"
- "Do you want to accept or reject this cookie?</p>",
- "<p>You received %1 cookies from<br/>"
- "<b>%2%3</b><br/>"
- "Do you want to accept or reject these cookies?</p>",
- count,
- QUrl::fromAce(host.toLatin1()),
- cookie.isCrossDomain() ? i18nc("@item:intext cross domain cookie", " [Cross Domain]") : QString());
- txt += QLatin1String("</body></html>");
-
- QVBoxLayout *topLayout = new QVBoxLayout(this);
- // This may look wrong, but it makes the dialogue automatically
- // shrink when the details are shown and then hidden again.
- topLayout->setSizeConstraint(QLayout::SetFixedSize);
-
- QFrame *vBox1 = new QFrame(this);
- topLayout->addWidget(vBox1);
-
- m_detailsButton = new QPushButton;
- m_detailsButton->setText(i18n("Details") + QLatin1String(" >>"));
- m_detailsButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-information")));
-#ifndef QT_NO_TOOLTIP
- m_detailsButton->setToolTip(i18n("See or modify the cookie information"));
-#endif
- connect(m_detailsButton, &QAbstractButton::clicked, this, &KCookieWin::slotToggleDetails);
-
- QPushButton *sessionOnlyButton = new QPushButton;
- sessionOnlyButton->setText(i18n("Accept for this &session"));
- sessionOnlyButton->setIcon(QIcon::fromTheme(QStringLiteral("chronometer")));
-#ifndef QT_NO_TOOLTIP
- sessionOnlyButton->setToolTip(i18n("Accept cookie(s) until the end of the current session"));
-#endif
- connect(sessionOnlyButton, &QAbstractButton::clicked, this, &KCookieWin::slotSessionOnlyClicked);
-
- QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
- buttonBox->addButton(m_detailsButton, QDialogButtonBox::ActionRole);
- buttonBox->addButton(sessionOnlyButton, QDialogButtonBox::ActionRole);
-
- buttonBox->setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
- QPushButton *but = buttonBox->button(QDialogButtonBox::Yes);
- but->setText(i18n("&Accept"));
- connect(but, &QAbstractButton::clicked, this, &QDialog::accept);
- but = buttonBox->button(QDialogButtonBox::No);
- but->setText(i18n("&Reject"));
- connect(but, &QAbstractButton::clicked, this, &QDialog::reject);
-
- topLayout->addWidget(buttonBox);
-
- QVBoxLayout *vBox1Layout = new QVBoxLayout(vBox1);
- vBox1Layout->setSpacing(-1);
- vBox1Layout->setContentsMargins(0, 0, 0, 0);
-
- // Cookie image and message to user
- QFrame *hBox = new QFrame(vBox1);
- vBox1Layout->addWidget(hBox);
- QHBoxLayout *hBoxLayout = new QHBoxLayout(hBox);
- hBoxLayout->setSpacing(0);
- hBoxLayout->setContentsMargins(0, 0, 0, 0);
- QLabel *icon = new QLabel(hBox);
- hBoxLayout->addWidget(icon);
- icon->setPixmap(QIcon::fromTheme(QStringLiteral("dialog-warning")).pixmap(style()->pixelMetric(QStyle::PM_LargeIconSize)));
- icon->setAlignment(Qt::AlignCenter);
- icon->setFixedSize(2 * icon->sizeHint());
-
- QFrame *vBox = new QFrame(hBox);
- QVBoxLayout *vBoxLayout = new QVBoxLayout(vBox);
- vBoxLayout->setSpacing(0);
- vBoxLayout->setContentsMargins(0, 0, 0, 0);
- hBoxLayout->addWidget(vBox);
- QLabel *lbl = new QLabel(txt, vBox);
- vBoxLayout->addWidget(lbl);
- lbl->setAlignment(Qt::AlignCenter);
-
- // Cookie Details dialog...
- m_detailView = new KCookieDetail(cookieList, count, vBox1);
- vBox1Layout->addWidget(m_detailView);
- m_detailView->hide();
-
- // Cookie policy choice...
- QGroupBox *m_btnGrp = new QGroupBox(i18n("Apply Choice To"), vBox1);
- vBox1Layout->addWidget(m_btnGrp);
- QVBoxLayout *vbox = new QVBoxLayout(m_btnGrp);
- txt = (count == 1) ? i18n("&Only this cookie") : i18n("&Only these cookies");
- m_onlyCookies = new QRadioButton(txt, m_btnGrp);
- vbox->addWidget(m_onlyCookies);
-#ifndef QT_NO_WHATSTHIS
- m_onlyCookies->setWhatsThis(
- i18n("Select this option to only accept or reject this cookie. "
- "You will be prompted again if you receive another cookie."));
-#endif
- m_allCookiesDomain = new QRadioButton(i18n("All cookies from this do&main"), m_btnGrp);
- vbox->addWidget(m_allCookiesDomain);
-#ifndef QT_NO_WHATSTHIS
- m_allCookiesDomain->setWhatsThis(
- i18n("Select this option to accept or reject all cookies from "
- "this site. Choosing this option will add a new policy for "
- "the site this cookie originated from. This policy will be "
- "permanent until you manually change it from the System Settings."));
-#endif
- m_allCookies = new QRadioButton(i18n("All &cookies"), m_btnGrp);
- vbox->addWidget(m_allCookies);
-#ifndef QT_NO_WHATSTHIS
- m_allCookies->setWhatsThis(
- i18n("Select this option to accept/reject all cookies from "
- "anywhere. Choosing this option will change the global "
- "cookie policy for all cookies until you manually change "
- "it from the System Settings."));
-#endif
-
- switch (defaultButton) {
- case KCookieJar::ApplyToShownCookiesOnly:
- m_onlyCookies->setChecked(true);
- break;
- case KCookieJar::ApplyToCookiesFromDomain:
- m_allCookiesDomain->setChecked(true);
- break;
- case KCookieJar::ApplyToAllCookies:
- m_allCookies->setChecked(true);
- break;
- default:
- m_onlyCookies->setChecked(true);
- break;
- }
-
- if (showDetails) {
- slotToggleDetails();
- }
-}
-
-KCookieWin::~KCookieWin()
-{
-}
-
-KCookieAdvice KCookieWin::advice(KCookieJar *cookiejar, const KHttpCookie &cookie)
-{
- const int result = exec();
-
- cookiejar->setShowCookieDetails(!m_detailView->isHidden());
-
- KCookieAdvice advice;
-
- switch (result) {
- case QDialog::Accepted:
- advice = KCookieAccept;
- break;
- case AcceptedForSession:
- advice = KCookieAcceptForSession;
- break;
- default:
- advice = KCookieReject;
- break;
- }
-
- KCookieJar::KCookieDefaultPolicy preferredPolicy = KCookieJar::ApplyToShownCookiesOnly;
- if (m_allCookiesDomain->isChecked()) {
- preferredPolicy = KCookieJar::ApplyToCookiesFromDomain;
- cookiejar->setDomainAdvice(cookie, advice);
- } else if (m_allCookies->isChecked()) {
- preferredPolicy = KCookieJar::ApplyToAllCookies;
- cookiejar->setGlobalAdvice(advice);
- }
- cookiejar->setPreferredDefaultPolicy(preferredPolicy);
-
- return advice;
-}
-
-KCookieDetail::KCookieDetail(const KHttpCookieList &cookieList, int cookieCount, QWidget *parent)
- : QGroupBox(parent)
-{
- setTitle(i18n("Cookie Details"));
- QGridLayout *grid = new QGridLayout(this);
- grid->addItem(new QSpacerItem(0, fontMetrics().lineSpacing()), 0, 0);
- grid->setColumnStretch(1, 3);
-
- QLabel *label = new QLabel(i18n("Name:"), this);
- grid->addWidget(label, 1, 0);
- m_name = new QLineEdit(this);
- m_name->setReadOnly(true);
- m_name->setMaximumWidth(fontMetrics().maxWidth() * 25);
- grid->addWidget(m_name, 1, 1);
-
- // Add the value
- label = new QLabel(i18n("Value:"), this);
- grid->addWidget(label, 2, 0);
- m_value = new QLineEdit(this);
- m_value->setReadOnly(true);
- m_value->setMaximumWidth(fontMetrics().maxWidth() * 25);
- grid->addWidget(m_value, 2, 1);
-
- label = new QLabel(i18n("Expires:"), this);
- grid->addWidget(label, 3, 0);
- m_expires = new QLineEdit(this);
- m_expires->setReadOnly(true);
- m_expires->setMaximumWidth(fontMetrics().maxWidth() * 25);
- grid->addWidget(m_expires, 3, 1);
-
- label = new QLabel(i18n("Path:"), this);
- grid->addWidget(label, 4, 0);
- m_path = new QLineEdit(this);
- m_path->setReadOnly(true);
- m_path->setMaximumWidth(fontMetrics().maxWidth() * 25);
- grid->addWidget(m_path, 4, 1);
-
- label = new QLabel(i18n("Domain:"), this);
- grid->addWidget(label, 5, 0);
- m_domain = new QLineEdit(this);
- m_domain->setReadOnly(true);
- m_domain->setMaximumWidth(fontMetrics().maxWidth() * 25);
- grid->addWidget(m_domain, 5, 1);
-
- label = new QLabel(i18nc("@label a description string of how 'accessible' the cookie is (e.g. see exposure string in this file)", "Exposure:"), this);
- grid->addWidget(label, 6, 0);
- m_secure = new QLineEdit(this);
- m_secure->setReadOnly(true);
- m_secure->setMaximumWidth(fontMetrics().maxWidth() * 25);
- grid->addWidget(m_secure, 6, 1);
-
- if (cookieCount > 1) {
- QPushButton *btnNext = new QPushButton(i18nc("Next cookie", "&Next >>"), this);
- btnNext->setFixedSize(btnNext->sizeHint());
- grid->addWidget(btnNext, 8, 0, 1, 2);
- connect(btnNext, &QAbstractButton::clicked, this, &KCookieDetail::slotNextCookie);
-#ifndef QT_NO_TOOLTIP
- btnNext->setToolTip(i18n("Show details of the next cookie"));
-#endif
- }
- m_cookieList = cookieList;
- m_cookieNumber = 0;
- slotNextCookie();
-}
-
-KCookieDetail::~KCookieDetail()
-{
-}
-
-void KCookieDetail::slotNextCookie()
-{
- if (m_cookieNumber == m_cookieList.count() - 1) {
- m_cookieNumber = 0;
- } else {
- ++m_cookieNumber;
- }
- displayCookieDetails();
-}
-
-void KCookieDetail::displayCookieDetails()
-{
- const KHttpCookie &cookie = m_cookieList.at(m_cookieNumber);
- m_name->setText(cookie.name());
- m_value->setText((cookie.value()));
- if (cookie.domain().isEmpty()) {
- m_domain->setText(i18nc("@label cookie has no explicit 'Domain' value specified", "Not specified"));
- } else {
- m_domain->setText(cookie.domain());
- }
- m_path->setText(cookie.path());
- QDateTime cookiedate = QDateTime::fromSecsSinceEpoch(cookie.expireDate());
- if (cookie.expireDate()) {
- m_expires->setText(cookiedate.toString());
- } else {
- m_expires->setText(i18nc("@label the cookie expires when the browser session ends", "End of Session"));
- }
- QString sec;
- if (cookie.isSecure()) {
- if (cookie.isHttpOnly()) {
- sec = i18nc("@label exposure string - the cookie may only be used by https servers", "Secure servers only");
- } else {
- sec = i18nc("@label exposure string - the cookie may be used by https servers AND client-side javascripts", "Secure servers, page scripts");
- }
- } else {
- if (cookie.isHttpOnly()) {
- sec = i18nc("@label exposure string - the cookie may only be used by http servers", "Servers");
- } else {
- sec = i18nc("@label exposure string - the cookie may be used by http servers AND client-side javascripts", "Servers, page scripts");
- }
- }
- m_secure->setText(sec);
-}
-
-void KCookieWin::slotSessionOnlyClicked()
-{
- done(AcceptedForSession);
-}
-
-void KCookieWin::slotToggleDetails()
-{
- const QString baseText = i18nc(
- "@action:button show details about a cookie that needs approval. This string gets >> and << appended, to visualize if the dialog expands or compacts!",
- "Details");
-
- if (!m_detailView->isHidden()) {
- m_detailsButton->setText(baseText + QLatin1String(" >>"));
- m_detailView->hide();
- } else {
- m_detailsButton->setText(baseText + QLatin1String(" <<"));
- m_detailView->show();
- }
-}
-
-#include "moc_kcookiewin.cpp"
diff --git a/src/kioworkers/http/kcookiejar/kcookiewin.h b/src/kioworkers/http/kcookiejar/kcookiewin.h
deleted file mode 100644
index caf8fc9c2b..0000000000
--- a/src/kioworkers/http/kcookiejar/kcookiewin.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- This file is part of the KDE File Manager
- SPDX-FileCopyrightText: 1998 Waldo Bastian <bastian at kde.org>
- SPDX-FileCopyrightText: 2000 Dawit Alemayehu <adawit at kde.org>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-// KDE File Manager -- HTTP Cookie Dialogs
-
-#ifndef KCOOKIEWIN_H
-#define KCOOKIEWIN_H
-
-#include "kcookiejar.h"
-#include <QDialog>
-#include <QGroupBox>
-#include <QRadioButton>
-
-class QLineEdit;
-class QPushButton;
-
-class KCookieDetail : public QGroupBox
-{
- Q_OBJECT
-
-public:
- KCookieDetail(const KHttpCookieList &cookieList, int cookieCount, QWidget *parent = nullptr);
- ~KCookieDetail() override;
-
-private Q_SLOTS:
- void slotNextCookie();
-
-private:
- void displayCookieDetails();
-
- QLineEdit *m_name;
- QLineEdit *m_value;
- QLineEdit *m_expires;
- QLineEdit *m_domain;
- QLineEdit *m_path;
- QLineEdit *m_secure;
-
- KHttpCookieList m_cookieList;
- int m_cookieNumber;
-};
-
-class KCookieWin : public QDialog
-{
- Q_OBJECT
-
-public:
- KCookieWin(QWidget *parent, KHttpCookieList cookieList, int defaultButton = 0, bool showDetails = false);
- ~KCookieWin() override;
-
- KCookieAdvice advice(KCookieJar *cookiejar, const KHttpCookie &cookie);
-
-private Q_SLOTS:
- void slotSessionOnlyClicked();
- void slotToggleDetails();
-
-private:
- QPushButton *m_detailsButton;
- QRadioButton *m_onlyCookies, *m_allCookies, *m_allCookiesDomain;
- KCookieDetail *m_detailView;
-};
-
-#endif
diff --git a/src/kioworkers/http/kcookiejar/main.cpp b/src/kioworkers/http/kcookiejar/main.cpp
deleted file mode 100644
index 277ef071f3..0000000000
--- a/src/kioworkers/http/kcookiejar/main.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- This file is part of KDE
- SPDX-FileCopyrightText: 1998-2000 Waldo Bastian <bastian at kde.org>
-
- SPDX-License-Identifier: MIT
-*/
-
-#include <QDBusConnection>
-#include <QDBusInterface>
-
-#include "kcookieserverinterface.h"
-#include <KLocalizedString>
-#include <QCommandLineOption>
-#include <QCommandLineParser>
-
-static void callKded(const QString &arg1, const QString &arg2)
-{
- QDBusInterface iface(QStringLiteral("org.kde.kded6"), QStringLiteral("/kded"), QStringLiteral("org.kde.kded6"));
- iface.call(arg1, arg2);
-}
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- app.setApplicationVersion(QStringLiteral("1.0"));
- KLocalizedString::setApplicationDomain("kio6");
-
- QString description = QCoreApplication::translate("main", "Command-line client for the HTTP Cookie Daemon");
-
- QCommandLineParser parser;
- parser.addVersionOption();
- parser.setApplicationDescription(description);
- parser.addHelpOption();
- parser.addOption(QCommandLineOption(QStringList{QStringLiteral("shutdown")}, QCoreApplication::translate("main", "Shut down cookie jar")));
- parser.addOption(
- QCommandLineOption(QStringList{QStringLiteral("remove")}, QCoreApplication::translate("main", "Remove cookies for domain"), QStringLiteral("domain")));
- parser.addOption(QCommandLineOption(QStringList{QStringLiteral("remove-all")}, QCoreApplication::translate("main", "Remove all cookies")));
- parser.addOption(QCommandLineOption(QStringList{QStringLiteral("reload-config")}, QCoreApplication::translate("main", "Reload configuration file")));
- parser.process(app);
-
- org::kde::KCookieServer *kcookiejar =
- new org::kde::KCookieServer(QStringLiteral("org.kde.kcookiejar5"), QStringLiteral("/modules/kcookiejar"), QDBusConnection::sessionBus());
- if (parser.isSet(QStringLiteral("remove-all"))) {
- kcookiejar->deleteAllCookies();
- }
- if (parser.isSet(QStringLiteral("remove"))) {
- QString domain = parser.value(QStringLiteral("remove"));
- kcookiejar->deleteCookiesFromDomain(domain);
- }
- if (parser.isSet(QStringLiteral("shutdown"))) {
- callKded(QStringLiteral("unloadModule"), QStringLiteral("kcookiejar"));
- } else if (parser.isSet(QStringLiteral("reload-config"))) {
- kcookiejar->reloadPolicy();
- } else {
- callKded(QStringLiteral("loadModule"), QStringLiteral("kcookiejar"));
- }
- delete kcookiejar;
-
- return 0;
-}
diff --git a/src/kioworkers/http/kcookiejar/netscape_cookie_spec.html b/src/kioworkers/http/kcookiejar/netscape_cookie_spec.html
deleted file mode 100644
index 6b575e8c54..0000000000
--- a/src/kioworkers/http/kcookiejar/netscape_cookie_spec.html
+++ /dev/null
@@ -1,331 +0,0 @@
-<HTML>
-<HEAD>
-<TITLE>Client Side State - HTTP Cookies</TITLE>
-</HEAD>
-
-<BODY BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#ff0000" ALINK="#ff0000" TEXT="#000000" >
-
-
-<CENTER>
-<!-- BANNER:s3 -->
-<A HREF="/maps/banners/documentation_s3.map"><IMG SRC="/images/banners/documentation_s3.gif" ALT="Documentation" BORDER=0 WIDTH=612 HEIGHT=50 ISMAP USEMAP="#banner_nav"></A>
-<MAP NAME="banner_nav">
-<AREA SHAPE=RECT COORDS="62,11,91,40" HREF="/">
-<AREA SHAPE=RECT COORDS="153,41,221,50" HREF="/">
-<AREA SHAPE=RECT COORDS="298,8,374,34" HREF="/support/index.html">
-<AREA SHAPE=RECT COORDS="381,15,586,43" HREF="http://help.netscape.com/browse/index.html">
-<AREA SHAPE=default NOHREF>
-</MAP>
-
-<!-- BANNER:s3 -->
-
-<H2>
-<FONT SIZE=+3>P</FONT>ERSISTENT
-<FONT SIZE=+3>C</FONT>LIENT
-<FONT SIZE=+3>S</FONT>TATE<BR>
-<FONT SIZE=+3>HTTP C</FONT>OOKIES
-</H2>
-
-<H3>Preliminary Specification - Use with caution</H3>
-</CENTER>
-
-<HR SIZE=4>
-
-<CENTER>
-<H3>
-<FONT SIZE=+2>I</FONT>NTRODUCTION
-</H3>
-</CENTER>
-
-Cookies are a general mechanism which server side connections (such as
-CGI scripts) can use to both store and retrieve information on the
-client side of the connection. The addition of a simple, persistent,
-client-side state significantly extends the capabilities of Web-based
-client/server applications.<P>
-
-<CENTER>
-<H3>
-<FONT SIZE=+2>O</FONT>VERVIEW
-</H3>
-</CENTER>
-
-A server, when returning an HTTP object to a client, may also send a
-piece of state information which the client will store. Included in that
-state object is a description of the range of URLs for which that state is
-valid. Any future HTTP requests made by the client which fall in that
-range will include a transmittal of the current value of the state
-object from the client back to the server. The state object is called
-a <B>cookie</B>, for no compelling reason. <P>
-This simple mechanism provides a powerful new tool which enables a host
-of new types of applications to be written for web-based environments.
-Shopping applications can now store information about the currently
-selected items, for fee services can send back registration information
-and free the client from retyping a user-id on next connection,
-sites can store per-user preferences on the client, and have the client supply
-those preferences every time that site is connected to.
-
-<CENTER>
-<H3>
-<FONT SIZE=+2>S</FONT>PECIFICATION
-</H3>
-</CENTER>
-
-A cookie is introduced to the client by including a <B>Set-Cookie</B>
-header as part of an HTTP response, typically this will be generated
-by a CGI script.
-
-<H3>Syntax of the Set-Cookie HTTP Response Header</H3>
-
-This is the format a CGI script would use to add to the HTTP headers
-a new piece of data which is to be stored by the client for later retrieval.
-
-<PRE>
-Set-Cookie: <I>NAME</I>=<I>VALUE</I>; expires=<I>DATE</I>;
-path=<I>PATH</I>; domain=<I>DOMAIN_NAME</I>; secure
-</PRE>
-<DL>
-<DT> <I>NAME</I>=<I>VALUE</I><DD>
-This string is a sequence of characters excluding semi-colon, comma and white
-space. If there is a need to place such data in the name or value, some
-encoding method such as URL style %XX encoding is recommended, though no
-encoding is defined or required. <P> This is the only required attribute
-on the <B>Set-Cookie</B> header. <P>
-<DT><B>expires</B>=<I>DATE</I>
-<DD>
-The <B>expires</B> attribute specifies a date string that
-defines the valid life time of that cookie. Once the expiration
-date has been reached, the cookie will no longer be stored or
-given out. <P>
-The date string is formatted as:
-<BLOCKQUOTE> <TT>Wdy, DD-Mon-YYYY HH:MM:SS GMT</TT></BLOCKQUOTE>
-This is based on
-<A TARGET="_top" HREF="http://ds.internic.net/rfc/rfc822.txt">RFC 822</A>,
-<A TARGET="_top" HREF="http://ds.internic.net/rfc/rfc850.txt">RFC 850</A>,
-<A TARGET="_top" HREF="http://www.w3.org/hypertext/WWW/Protocols/rfc1036/rfc1036.html#z6">
-RFC 1036</A>, and
-<A TARGET="_top" HREF="http://ds1.internic.net/rfc/rfc1123.txt">
-RFC 1123</A>,
-with the variations that the only legal time zone is <B>GMT</B> and
-the separators between the elements of the date must be dashes.
-<P>
-<B>expires</B> is an optional attribute. If not specified, the cookie will
-expire when the user's session ends. <P>
-<B>Note:</B> There is a bug in Netscape Navigator version 1.1 and earlier.
-Only cookies whose <B>path</B> attribute is set explicitly to "/" will
-be properly saved between sessions if they have an <B>expires</B>
-attribute.<P>
-
-<DT> <B>domain</B>=<I>DOMAIN_NAME</I>
-<DD>
-When searching the cookie list for valid cookies, a comparison of the
-<B>domain</B>
-attributes of the cookie is made with the Internet domain name of the
-host from which the URL will be fetched. If there is a tail match,
-then the cookie will go through <B>path</B> matching to see if it
-should be sent. "Tail matching" means that <B>domain</B> attribute
-is matched against the tail of the fully qualified domain name of
-the host. A <B>domain</B> attribute of "acme.com" would match
-host names "anvil.acme.com" as well as "shipping.crate.acme.com". <P>
-
-Only hosts within the specified domain
-can set a cookie for a domain and domains must have at least two (2)
-or three (3) periods in them to prevent domains of the form:
-".com", ".edu", and "va.us". Any domain that fails within
-one of the seven special top level domains listed below only require
-two periods. Any other domain requires at least three. The
-seven special top level domains are: "COM", "EDU", "NET", "ORG",
-"GOV", "MIL", and "INT".
-
- <P>
-The default value of <B>domain</B> is the host name of the server
-which generated the cookie response. <P>
-<DT> <B>path</B>=<I>PATH</I>
-<DD>
-The <B>path</B> attribute is used to specify the subset of URLs in a
-domain for
-which the cookie is valid. If a cookie has already passed <B>domain</B>
-matching, then the pathname component
-of the URL is compared with the path attribute, and if there is
-a match, the cookie is considered valid and is sent along with
-the URL request. The path "/foo"
-would match "/foobar" and "/foo/bar.html". The path "/" is the most
-general path. <P>
-If the <B>path</B> is not specified, it as assumed to be the same path
-as the document being described by the header which contains the cookie.
-<P>
-<DT> <B>secure</B>
-<DD>
-If a cookie is marked <B>secure</B>, it will only be transmitted if the
-communications channel with the host is a secure one. Currently
-this means that secure cookies will only be sent to HTTPS (HTTP over SSL)
-servers. <P>
-If <B>secure</B> is not specified, a cookie is considered safe to be sent
-in the clear over unsecured channels.
-</DL>
-
-<H3>Syntax of the Cookie HTTP Request Header</H3>
-
-When requesting a URL from an HTTP server, the browser will match
-the URL against all cookies and if any of them match, a line
-containing the name/value pairs of all matching cookies will
-be included in the HTTP request. Here is the format of that line:
-<PRE>
-Cookie: <I>NAME1=OPAQUE_STRING1</I>; <I>NAME2=OPAQUE_STRING2 ...</I>
-</PRE>
-
-<H3>Additional Notes</H3>
-
-<UL>
-<LI>Multiple <B>Set-Cookie</B> headers can be issued in a single server
-response.
-<p>
-<LI>Instances of the same path and name will overwrite each other, with the
-latest instance taking precedence. Instances of the same path but
-different names will add additional mappings.
-<p>
-<LI>Setting the path to a higher-level value does not override other more
-specific path mappings. If there are multiple matches for a given cookie
-name, but with separate paths, all the matching cookies will be sent.
-(See examples below.)
-<p>
-<LI>The
-expires header lets the client know when it is safe to purge the mapping
-but the client is not required to do so. A client may also delete a
-cookie before it's expiration date arrives if the number of cookies
-exceeds its internal limits.
-<p>
-<LI>When sending cookies to a server, all cookies with a more specific
-path mapping should be sent before cookies with less specific path
-mappings. For example, a cookie "name1=foo" with a path mapping
-of "/" should be sent after a cookie "name1=foo2" with
-a path mapping of "/bar" if they are both to be sent.
-<p>
-<LI>There are limitations on the number of cookies that a client
-can store at any one time. This is a specification of the minimum
-number of cookies that a client should be prepared to receive and
-store.
-
-<UL>
- <LI>300 total cookies
- <LI>4 kilobytes per cookie, where the name and the OPAQUE_STRING
- combine to form the 4 kilobyte limit.
- <LI>20 cookies per server or domain. (note that completely
- specified hosts and domains are treated as separate entities
- and have a 20 cookie limitation for each, not combined)
-</UL>
-Servers should not expect clients to be able to exceed these limits.
-When the 300 cookie limit or the 20 cookie per server limit
-is exceeded, clients should delete the least recently used cookie.
-When a cookie larger than 4 kilobytes is encountered the cookie
-should be trimmed to fit, but the name should remain intact
-as long as it is less than 4 kilobytes.
- <P>
-<LI>If a CGI script wishes to delete a cookie, it can do so by
-returning a cookie with the same name, and an <B>expires</B> time
-which is in the past. The path and name must match exactly
-in order for the expiring cookie to replace the valid cookie.
-This requirement makes it difficult for anyone but the originator
-of a cookie to delete a cookie.
-<P><LI>When caching HTTP, as a proxy server might do, the <B>Set-cookie</B>
-response header should never be cached.
-<P><LI>If a proxy server receives a response which
-contains a <B>Set-cookie</B> header, it should propagate the <B>Set-cookie</B>
-header to the client, regardless of whether the response was 304
-(Not Modified) or 200 (OK).
-<P>Similarly, if a client request contains a Cookie: header, it
-should be forwarded through a proxy, even if the conditional
-If-modified-since request is being made.
-</UL>
-
-<CENTER>
-<H3>
-<FONT SIZE=+2>E</FONT>XAMPLES
-</H3>
-</CENTER>
-
-Here are some sample exchanges which are designed to illustrate the use
-of cookies.
-<H3>First Example transaction sequence:</H3>
-<DL>
-<dt>Client requests a document, and receives in the response:<dd>
-<PRE>
-Set-Cookie: CUSTOMER=WILE_E_COYOTE; path=/; expires=Wednesday, 09-Nov-99 23:12:40 GMT</PRE>
-<dt>When client requests a URL in path "/" on this server, it sends:<DD>
-<PRE>Cookie: CUSTOMER=WILE_E_COYOTE</PRE>
-<dt>Client requests a document, and receives in the response:<dd>
-<PRE>Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/</PRE>
-<dt>When client requests a URL in path "/" on this server, it sends:<dd>
-<PRE>Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001</PRE>
-<dt>Client receives:<dd>
-<PRE>Set-Cookie: SHIPPING=FEDEX; path=/foo</PRE>
-<dt>When client requests a URL in path "/" on this server, it sends:<dd>
-<PRE>Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001</PRE>
-<dt>When client requests a URL in path "/foo" on this server, it sends:<dd>
-<PRE>Cookie: CUSTOMER=WILE_E_COYOTE; PART_NUMBER=ROCKET_LAUNCHER_0001; SHIPPING=FEDEX</PRE>
-</DL>
-<H3>Second Example transaction sequence:</H3>
-<DL>
-<dt>Assume all mappings from above have been cleared.<p>
-<dt>Client receives:<dd>
-<PRE>Set-Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001; path=/</PRE>
-<dt>When client requests a URL in path "/" on this server, it sends:<dd>
-<PRE>Cookie: PART_NUMBER=ROCKET_LAUNCHER_0001</PRE>
-<dt>Client receives:<dd>
-<PRE>Set-Cookie: PART_NUMBER=RIDING_ROCKET_0023; path=/ammo</PRE>
-<dt>When client requests a URL in path "/ammo" on this server, it sends:<dd>
-<PRE>Cookie: PART_NUMBER=RIDING_ROCKET_0023; PART_NUMBER=ROCKET_LAUNCHER_0001</PRE>
-<dd>NOTE: There are two name/value pairs named "PART_NUMBER" due to the
-inheritance
-of the "/" mapping in addition to the "/ammo" mapping.
-</DL>
-
-<HR SIZE=4>
-<P>
-
-<CENTER>
-
-
-<!-- footer -->
-<TABLE WIDTH=600 BORDER=0 CELLPADDING=0 CELLSPACING=0>
-<TR>
-<TD WIDTH=600 HEIGHT=8><HR SIZE=1 NOSHADE></TD></TR>
-<TR><TD ALIGN=LEFT VALIGN=TOP><FONT FACE="sans-serif, Arial, Helvetica" SIZE=-2><A HREF="http://home.netscape.com/misc/nav_redir/help.html" TARGET="_top">Help</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/site_map.html" TARGET="_top">Site Map</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/howtoget.html" TARGET="_top">How to Get Netscape Products</A> | <A HREF="http://home.netscape.com/misc/nav_redir/ad.html" TARGET="_top">Advertise With Us</A> | <A HREF="http://home.netscape.com/misc/nav_redir/addsite.html" TARGET="_top">Add Site</A> | <A HREF="http://home.netscape.com/misc/nav_redir/custom_browser.html" TARGET="_top">Custom Browser Program</A></FONT></TD></TR>
-<TR>
-<TD WIDTH=600 HEIGHT=8 COLSPAN=0></TD>
-</TR>
-
-<TR>
-<TD ALIGN=LEFT VALIGN=TOP>
-<!-- Channels -->
-<FONT FACE="sans-serif, Arial, Helvetica" SIZE=-2><A HREF="http://home.netscape.com/misc/nav_redir/channels/autos.html" TARGET="_top">Autos</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/business.html" TARGET="_top">Business</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/computers_internet.html" TARGET="_top">Computing & Internet</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/entertainment.html" TARGET="_top">Entertainment</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/kids_family.html" TARGET="_top">Family</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/games.html" TARGET="_top">Games</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/health.html" TARGET="_top">Health</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/lifestyles.html" TARGET="_top">Lifestyles</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/local.html" TARGET="_top">Local</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/netscape.html" TARGET="_top">Netscape</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/open_directory.html">Netscape Open Directory</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/news.html" TARGET="_top">News</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/personalize_finance.html" TARGET="_top">Personal Finance</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/real_estate.html" TARGET="_top">Real Estate</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/education.html" TARGET="_top">Research & Learn</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/shopping.html" TARGET="_top">Shopping</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/smallbiz.html" TARGET="_top">Small Business</A> | <A
-HREF="http://home.netscape.com/misc/nav_redir/channels/sports.html" TARGET="_top">Sports</A> | <A HREF="http://home.netscape.com/misc/nav_redir/channels/travel.html" TARGET="_top">Travel</A></FONT></TD></TR>
-</TABLE>
-
-<TABLE WIDTH=600 BORDER=0 CELLPADDING=0 CELLSPACING=0>
-<TR><TD WIDTH=600 HEIGHT=8 COLSPAN=0></TD></TR>
-<TR>
-<TD WIDTH=600 COLSPAN=5 VALIGN=TOP ALIGN=LEFT>
-<FONT FACE="sans-serif, Arial, Helvetica" SIZE=-2>
-© 1999 Netscape, All Rights Reserved. <A HREF="http://home.netscape.com/legal_notices/index.html">Legal & Privacy Notices</A><BR>This site powered by <A HREF="http://home.netscape.com/comprod/server_central/index.html" TARGET="_top">Netscape SuiteSpot servers</A>.</FONT></TD>
-</TR>
-</TABLE>
-<!-- end footer -->
-
-
-
-
-</CENTER>
-<P>
-
-
-
-</BODY>
-</HTML>
diff --git a/src/kioworkers/http/kcookiejar/specifications b/src/kioworkers/http/kcookiejar/specifications
deleted file mode 100644
index 8e07c8cf71..0000000000
--- a/src/kioworkers/http/kcookiejar/specifications
+++ /dev/null
@@ -1,3 +0,0 @@
-HTTP State Management Mechanism
-http://www.ietf.org/rfc/rfc2965.txt
-http://www.ietf.org/rfc/rfc2109.txt
More information about the kde-doc-english
mailing list