...

View Full Version : Bad Request? Cookie limmit exceeded?



Kirl
12-25-2007, 11:46 AM
I made a snake browser game with javascript (for learning purposes mostly), which I deemed finished until I was playing around with the level editor just now. I included a level editor that saves levels as a cookie, however when I saved this last level, the list to load levels went blank, and worse, when I refreshed the page I got the following message:


400 Bad request

"Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit."

Now, the message is pretty clear, but still quite puzzeling.

- I obviously exceeded some kind of limmit, but does anybody know how big/small this limmit is? Does it depend on the server?
- What does the server have to do with cookies, I thought cookies were saved locally?
- And most importantly, what can I do to prevent this from happening to anybody else?


You can find the game in question here (http://www.kirl.nl/snakers2.5.php).

Philip M
12-26-2007, 10:28 AM
Have a look at:-

http://www.thismuchiknow.co.uk/?p=13


The real problem, however, comes when you try and set cookies with a large size. The standards state that a browser must support a minimum of 4096 bytes per cookie. IE6 doesn’t do this. Instead, it seems to have a maximum size of 4096 bytes for all cookies from a domain. And, even worse, once this maximum is exceeded, you can’t read or write any further cookies for that domain. The only solution I’ve been able to find is for the user to “Delete cookies…” from Tools > Internet Options > General, and start again.

Kirl
12-26-2007, 02:19 PM
Thanks for the link, I couldn't find anything on it!

Unfortunatly, there doesn't appear to be a quick remedy except to prevent the cookie from ever reaching that size. Is there any way to check the cookie size or otherwise prevent it from reaching the 4096 byte limmit?

Philip M
12-26-2007, 02:34 PM
Thanks for the link, I couldn't find anything on it!


Uh? It seems an excellent explanation to me!



Is there any way to check the cookie size or otherwise prevent it from reaching the 4096 byte limmit?


Only by reading in the cookie value and counting the number of characters.

Kirl
12-26-2007, 04:17 PM
Uh? It seems an excellent explanation to me!Haha no, I meant when I searched for it before posting. :)
The link was excellent, thanks.




Only by reading in the cookie value and counting the number of characters.I was afraid of something like that, thanks though.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum