cannot load page send too large cookie

RESOLVED FIXED in mozilla8

Status

()

Core
Networking: HTTP
RESOLVED FIXED
7 years ago
6 years ago

People

(Reporter: arno renevier, Assigned: arno renevier)

Tracking

Trunk
mozilla8
x86_64
Linux
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [inbound], URL)

Attachments

(3 attachments)

(Assignee)

Description

7 years ago
Hi,
when a page tries to set a big cookie, page does not load. Gecko does not even display about:blank, it just stays on current page. If i copy this url in firefox urlbar and open a new tab with Alt-Enter, all I get is a blank tab with grey background.

http://localhost/tmp/cookie.php
source:
http://localhost/tmp/cookie.txt
(Assignee)

Updated

7 years ago

Comment 1

7 years ago
Can you attach the files here?
(Assignee)

Comment 2

7 years ago
Created attachment 440805 [details]
testcase

Comment 3

7 years ago
Sending an HTTP header that large will bust the limit on either the webserver, or the client (Firefox), and result in the connection being dropped. Hence the pageload fail.

This isn't a bug on our side; if anything, you should file a bug with the PHP folks to throw an error if you try to set a cookie larger than 4KB, and maybe if the total HTTP header size exceeds the limit. (I'm not sure exactly what that limit is; it varies between browsers and probably servers too.)
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → INVALID
(Assignee)

Comment 4

7 years ago
(In reply to comment #3)
> Sending an HTTP header that large will bust the limit on either the webserver,
> or the client (Firefox), 

It's probably Firefox: other browsers handle this page well.

> and result in the connection being dropped. Hence the
> pageload fail.

Ok. But may be it's better to load aubout:neterror when firefox drop connection instead of letting a grey background.

> This isn't a bug on our side; if anything, you should file a bug with the PHP
> folks to throw an error if you try to set a cookie larger than 4KB, and maybe
> if the total HTTP header size exceeds the limit. (I'm not sure exactly what
> that limit is; it varies between browsers and probably servers too.)

Even if php modifies his behaviour. I can still send those headers with python, C, whatever. That won't prevent users from having this
(Assignee)

Comment 5

7 years ago
> http://localhost/tmp/cookie.php
> source:
> http://localhost/tmp/cookie.txt

Oopps, sorry for that. 
Real links were:

http://renevier.net/bugs/bigcookie.txt
http://renevier.net/bugs/bigcookie.php
(Assignee)

Comment 6

7 years ago
(In reply to comment #3)
> Sending an HTTP header that large will bust the limit on either the webserver,
> or the client (Firefox), 

It's probably Firefox: other browsers handle this page well.

> and result in the connection being dropped. Hence the
> pageload fail.

Ok. But may be it's better to load about:neterror when firefox drop connection instead of doing nothing.

> This isn't a bug on our side; if anything, you should file a bug with the PHP
> folks to throw an error if you try to set a cookie larger than 4KB, and maybe
> if the total HTTP header size exceeds the limit. (I'm not sure exactly what
> that limit is; it varies between browsers and probably servers too.)

Even if php modifies his behaviour. I can still send those headers with python, C, whatever.
(Assignee)

Comment 7

7 years ago
Created attachment 440977 [details]
grey background when opening in a new tab

Comment 8

7 years ago
Other browsers don't die, you say?

Worth another look, then.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
nsHttpTransaction::ParseLineSegment has:

721     if (mLineBuf.Length() + len > MAX_LINEBUF_LENGTH) {
722         LOG(("excessively long header received, canceling transaction [trans=%x]", this));
723         return NS_ERROR_ABORT;
724     }

MAX_LINEBUF_LENGTH is (1024 * 10).

That code was added in bug 152697.

I suppose we could do an about:neterror here by using a status code nsDocShell::EndLoad recognizes or adding NS_ERROR_ABORT there, or using a new code just for this case.  We could also increase (or remove?) the limit here.

Comment 10

7 years ago
Sounds like a sensible thing to do, especially since a single cookie can be 4K. :)
Component: Networking: Cookies → Networking: HTTP
QA Contact: networking.cookies → networking.http
Which one does?

I just checked and chrome has no obvious header length limit, btw.

Comment 12

7 years ago
Either making it much bigger or removing it. Having such a small limit to prevent DOS isn't such a strong argument nowadays, I think.

Ideally we'd also have a neterror page, but that can be a separate bug...
My gut feel is to nix the check.  Jason, thoughts?
Sure, my gut feel is fine with nixing the check.  So long as we also make sure nothing breaks as a result :)
(Assignee)

Comment 15

6 years ago
Created attachment 546303 [details] [diff] [review]
patch proposal

patch proposal: remove http header length check.
Attachment #546303 - Flags: review?(bzbarsky)
Comment on attachment 546303 [details] [diff] [review]
patch proposal

r=me
Attachment #546303 - Flags: review?(bzbarsky) → review+
Assignee: nobody → arno
Keywords: checkin-needed

Updated

6 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/9c8b0c5a5591
Status: REOPENED → RESOLVED
Last Resolved: 7 years ago6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8

Updated

6 years ago
Duplicate of this bug: 685808

Updated

6 years ago
Duplicate of this bug: 692016
You need to log in before you can comment on or make changes to this bug.