Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Chunked encoding and HTTP/1.0
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Christopher Lenz  
View profile  
 More options Apr 25 2008, 3:00 pm
From: Christopher Lenz <cml...@gmx.de>
Date: Fri, 25 Apr 2008 14:00:49 -0500
Local: Fri, Apr 25 2008 3:00 pm
Subject: Chunked encoding and HTTP/1.0
Hey all,

we're now using MochiWeb in CouchDB, and we're using chunked encoding  
via mochiweb_request:respond(chunked). Now we're getting reports from  
people behind HTTP/1.0 proxies (such as apparently nginx) that CouchDB  
is sending chunked responses even to HTTP/1.0 clients. Doh :P

So we'd need to fallback to closing connections or setting the Content-
Length for such clients. The question is where that'd be best done.  
I.e. should MochiWeb do the fallback itself, while still letting the  
application use the chunked API? Or should CouchDB be doing this, the  
disadvantage being that all MochiWeb-based applications would need the  
same fallback logic.

Thoughts?
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bob Ippolito  
View profile  
 More options Apr 25 2008, 5:59 pm
From: "Bob Ippolito" <b...@redivi.com>
Date: Fri, 25 Apr 2008 14:59:25 -0700
Local: Fri, Apr 25 2008 5:59 pm
Subject: Re: [mochiweb] Chunked encoding and HTTP/1.0
I think that if you want to use chunked responses then you should be
either willing to deal with HTTP/1.0 separately or not at all. It
would probably be a good idea to check for HTTP/1.0 and die miserably
with some HTTP error response if the server tries to send a chunked
response (patches accepted!).

I don't think mochiweb should try and buffer chunked responses
indefinitely in order to determine the Content-Length since that could
be used to craft a denial of service attack on an application that
doesn't know better.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Lenz  
View profile  
 More options Apr 25 2008, 9:09 pm
From: Christopher Lenz <cml...@gmx.de>
Date: Fri, 25 Apr 2008 20:09:10 -0500
Local: Fri, Apr 25 2008 9:09 pm
Subject: Re: [mochiweb] Re: Chunked encoding and HTTP/1.0
On 25.04.2008, at 16:59, Bob Ippolito wrote:

> I think that if you want to use chunked responses then you should be
> either willing to deal with HTTP/1.0 separately or not at all. It
> would probably be a good idea to check for HTTP/1.0 and die miserably
> with some HTTP error response if the server tries to send a chunked
> response (patches accepted!).

I suspect lacking HTTP/1.1 support is more widespread for proxies than  
I personally had thought/hoped. See:

  <https://issues.apache.org/jira/browse/COUCHDB-40>

which explicitly mentions using nginx as the HTTP proxy. I have not  
tried to reproduce the problems myself, but heard a couple others  
having them on our mailing list. Anyway...

> I don't think mochiweb should try and buffer chunked responses
> indefinitely in order to determine the Content-Length since that could
> be used to craft a denial of service attack on an application that
> doesn't know better.

Good point. But what about the other fallback option: omit the Content-
Length for HTTP/1.0, and keep sending data without buffering (but also  
without chunk delimiters), and finally simply close the connection at  
the last "chunk" to clearly mark the end of the entity body?

That seems to be what google.com does for HTTP/1.0 requests, as far as  
I can tell.

Thanks,
--
Christopher Lenz
  cmlenz at gmx.de
  http://www.cmlenz.net/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bob Ippolito  
View profile  
 More options Apr 26 2008, 1:58 am
From: "Bob Ippolito" <b...@redivi.com>
Date: Fri, 25 Apr 2008 22:58:57 -0700
Local: Sat, Apr 26 2008 1:58 am
Subject: Re: [mochiweb] Re: Chunked encoding and HTTP/1.0

That seems reasonable. A patch with tests would make this happen
faster. We don't need it because we don't use chunked anywhere in
production.

-bob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Lenz  
View profile  
 More options Apr 27 2008, 7:37 pm
From: Christopher Lenz <cml...@gmx.de>
Date: Sun, 27 Apr 2008 18:37:46 -0500
Local: Sun, Apr 27 2008 7:37 pm
Subject: Re: [mochiweb] Re: Chunked encoding and HTTP/1.0
On 26.04.2008, at 00:58, Bob Ippolito wrote:

>> Good point. But what about the other fallback option: omit the  
>> Content-
>> Length for HTTP/1.0, and keep sending data without buffering (but  
>> also
>> without chunk delimiters), and finally simply close the connection at
>> the last "chunk" to clearly mark the end of the entity body?

>> That seems to be what google.com does for HTTP/1.0 requests, as far  
>> as
>> I can tell.

> That seems reasonable. A patch with tests would make this happen
> faster. We don't need it because we don't use chunked anywhere in
> production.

I've put together a simple patch that seems to do the trick and  
uploaded it to the CouchDB issue tracker:

   <https://issues.apache.org/jira/secure/attachment/12381004/mochiweb_ch...
 >

I'm hoping this will attract feedback from the people actually running  
into the issue in the real world.

Not sure how to go about writing a test for this :/ Any hints?

BTW, the MochiWeb code seems to (increasingly?) contain mixed tabs and  
spaces, which makes it kind of hairy to produce clean patches (and of  
course screws up visual indentation in many cases). See the  
mochiweb_request:respond(chunked) function that is modified by the  
patch.

Cheers,
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Lenz  
View profile  
 More options Apr 28 2008, 6:39 pm
From: Christopher Lenz <cml...@gmx.de>
Date: Mon, 28 Apr 2008 17:39:43 -0500
Local: Mon, Apr 28 2008 6:39 pm
Subject: Re: [mochiweb] Re: Chunked encoding and HTTP/1.0
On 27.04.2008, at 18:37, Christopher Lenz wrote:

> On 26.04.2008, at 00:58, Bob Ippolito wrote:
>> That seems reasonable. A patch with tests would make this happen
>> faster. We don't need it because we don't use chunked anywhere in
>> production.

> I've put together a simple patch that seems to do the trick and
> uploaded it to the CouchDB issue tracker:

>   <https://issues.apache.org/jira/secure/attachment/12381004/mochiweb_ch...

And here's another version that also works when the request specifies  
a Connection: Keep-Alive header:

   <https://issues.apache.org/jira/secure/attachment/12381058/mochiweb_ch...
 >

This adds a FORCE_CLOSE flag to the process dictionary. Not sure if  
there's a better way to go about this.

Cheers,
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bob Ippolito  
View profile  
 More options Apr 28 2008, 10:16 pm
From: "Bob Ippolito" <b...@redivi.com>
Date: Mon, 28 Apr 2008 19:16:20 -0700
Local: Mon, Apr 28 2008 10:16 pm
Subject: Re: [mochiweb] Re: Chunked encoding and HTTP/1.0
Ok, this is committed in r65. I also detabbed the source. The reason
being is that we changed our emacs config to use only spaces at some
point after mochiweb was written... so anything before that was Emacs'
weird idea of tab+spaces, and anything after that was just spaces. Of
course everything looks fine in Emacs either way :)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher Lenz  
View profile  
 More options May 9 2008, 5:47 pm
From: Christopher Lenz <cml...@gmx.de>
Date: Fri, 9 May 2008 23:47:45 +0200
Local: Fri, May 9 2008 5:47 pm
Subject: Re: [mochiweb] Re: Chunked encoding and HTTP/1.0
On 29.04.2008, at 04:16, Bob Ippolito wrote:

> Ok, this is committed in r65. I also detabbed the source. The reason
> being is that we changed our emacs config to use only spaces at some
> point after mochiweb was written... so anything before that was Emacs'
> weird idea of tab+spaces, and anything after that was just spaces. Of
> course everything looks fine in Emacs either way :)

Thanks!
--
Christopher Lenz
   cmlenz at gmx.de
   http://www.cmlenz.net/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »