Closed Bug 561042 Opened 11 years ago Closed 10 years ago

cannot load page send too large cookie

Categories

(Core :: Networking: HTTP, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: arno, Assigned: arno)

References

()

Details

(Whiteboard: [inbound])

Attachments

(3 files)

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
Can you attach the files here?
Attached file testcase
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
Closed: 11 years ago
Resolution: --- → INVALID
(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
(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.
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.
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.
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 :)
Attached patch patch proposalSplinter Review
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
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/9c8b0c5a5591
Status: REOPENED → RESOLVED
Closed: 11 years ago10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Duplicate of this bug: 685808
Duplicate of this bug: 692016
You need to log in before you can comment on or make changes to this bug.