kde.org's locale cookie

Jonathan Wakely cow at compsoc.man.ac.uk
Mon Apr 14 10:22:31 UTC 2003


On Sat, Apr 12, 2003 at 03:13:47PM +0100, Chris Howells wrote:

> > > What browser is this with?
> >
> > All browsers. The Set-Cookie header is wrong, it makes no difference
> 
> Just wondering as when I wrote the PHP code to set the cookie I have tested it 
> with Konquer 3.1 and it seemed to work correctly. I must admit that I have 
> little experience with cookies.

Consider yourself lucky!  :-)
Cookies are rarely as simple as they appear unfortunately.

> > whether I use Mozilla 1.3, Konqueror 3.0.0 or do an HTTP request by
> > hand, the header comes back as:
> >
> > Set-Cookie: locale=en; expires=Sun, 11-Apr-04 11:22:02 GMT; path=/.kde.org
> >
> > I assume that it should be "path=/; domain=.kde.org" but the "; domain="
> > fragment is missing.
> 
> The bit of PHP code that is used is:
> 
> setcookie('locale', $site_locale, time()+31536000, '/', '.kde.org');
> 
> I wonder if changing the last parameter to the function to 'kde.org' would 
> help....

Hmm, looks like a php bug, or maybe the last comma is missing from the
setcookie() call. Changing the domain to kde.org would make the cookie
invalid ... the domain must contain at least 3 dots, except for domains
in one of the .com, .org, .edu etc. TLDs which must contain two. So
".kde.org" is correct, but "kde.org" would be illegal (most browsers
will accept it anyway, since the cookie spec's are flawed and so are
most websites!)

regards,

jon

-- 
"Anybody who wants the presidency so much that he'll spend two years
 organizing and campaigning for it is not to be trusted with the office."
	- David Broder


More information about the kde-www mailing list