Bug 134753 - Problem with cookies in konqueror when server specified as IP adress.
Summary: Problem with cookies in konqueror when server specified as IP adress.
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: http (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-27 18:15 UTC by Anton
Modified: 2007-09-01 23:03 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anton 2006-09-27 18:15:48 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages
Compiler:          Gentoo-linux/x86/2006.0, gcc-4.1.1, glibc-2.4-r3, 2.6.17-gentoo-r8 i686 
OS:                Linux

When server, wich named by IP adress, sets cookie, konqueror saves it but doesn't send it back. When server named by symbolic domain name - everything are correct.
Comment 1 Dawit Alemayehu 2007-09-01 16:33:41 UTC
Sorry, priority and severity level was changed by mistake.
Comment 2 Dawit Alemayehu 2007-09-01 23:03:22 UTC
SVN commit 707427 by adawit:


- Send back saved cookies that came from ip-address based hosts.
- Added a test case to exercise given secnairo above.

BUG: 134753


 M  +2 -10     kcookiejar.cpp  
 M  +10 -0     tests/cookie.test  


--- trunk/KDE/kdelibs/kioslave/http/kcookiejar/kcookiejar.cpp #707426:707427
@@ -79,6 +79,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
@@ -614,17 +615,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].toLatin1()))
-          {
-             allNumeric = false;
-             break;
-          }
-       }
-       if (allNumeric)
-       {
           _domains.append( _fqdn );
           return;
        }
--- trunk/KDE/kdelibs/kioslave/http/kcookiejar/tests/cookie.test #707426:707427
@@ -149,3 +149,13 @@
 CONFIG AcceptSessionCookies true
 COOKIE ACCEPT http://www.foobar.com Set-Cookie: from=foobar.com; domain=bar.com; Path="/"
 CHECK http://bar.com
+## 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