[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2007-09-01 21:04:33
Message-ID: 1188680673.476873.16668.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 707428 by adawit:
- Backport fix and test case for BR# 134753.
M +7 -13 kcookiejar.cpp
M +11 -0 tests/cookie.test
--- branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp #707427:707428
@@ -82,6 +82,7 @@
#define MAX_COOKIES_PER_HOST 25
#define READ_BUFFER_SIZE 8192
+#define IP_ADDRESS_EXPRESSION \
"(?:(?: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 QString::fromLatin1( )
// Cookies are stored as 8 bit data and passed to kio_http as
@@ -339,6 +340,8 @@
bool secureRequest = (_url.find( L1("https://"), 0, false) == 0 ||
_url.find( L1("webdavs://"), 0, false) == 0);
+ kdDebug(7104) << "findCookies: URL= " << _url << ", secure = " << secureRequest \
<< endl; +
extractDomains(fqdn, domains);
KHttpCookieList allCookies;
@@ -403,7 +406,7 @@
{
cookie->windowIds().append(windowId);
}
-
+
if (it == domains.end()) // Only needed when processing pending cookies
removeDuplicateFromList(&allCookies, cookie);
@@ -620,17 +623,8 @@
// Return numeric IPv4 addresses as is...
if ((_fqdn[0] >= '0') && (_fqdn[0] <= '9'))
{
- bool allNumeric = true;
- for(int i = _fqdn.length(); i--;)
+ if (_fqdn.find(QRegExp(IP_ADDRESS_EXPRESSION)) > -1)
{
- if (!strchr("0123456789:.", _fqdn[i].latin1()))
- {
- allNumeric = false;
- break;
- }
- }
- if (allNumeric)
- {
_domains.append( _fqdn );
return;
}
@@ -646,13 +640,13 @@
if (partList.count() == 1)
break; // We only have a TLD left.
-
+
if ((partList.count() == 2) && (m_twoLevelTLD[partList[1].lower()]))
{
// 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)
--- branches/KDE/3.5/kdelibs/kioslave/http/kcookiejar/tests/cookie.test \
#707427:707428 @@ -149,3 +149,14 @@
CONFIG AcceptSessionCookies true
COOKIE ACCEPT http://www.foobar.com Set-Cookie: from=foobar.com; domain=bar.com; \
Path="/" CHECK http://bar.com
+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: name11=value11; name1=value1 +CHECK \
http://192.168.0.1:8080 Cookie: name2=value2 +CHECK https://192.168.0.1 Cookie: \
name3=value3; name11=value11; name1=value1 +CHECK http://192.168.0.10
+CHECK http://192.168.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic