WaterSweet / mochiweb

Automatically exported from code.google.com/p/mochiweb
Other
0 stars 0 forks source link

Small chunks in request causes connection to be closed #53

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Send a "Transfer-Encoding: chunked" request with small (<4K) chunk size.

What is the expected output? What do you see instead?
Connection should remain open for additional requests but connection is 
closed.

What version of the product are you using? On what operating system?
OS: Linux
Version: As bundled in CouchDB but appears to be applicable to trunk too.

Please provide any additional information below.
mochiweb_request:read_chunk/1 doesn't call mochiweb_request:recv/2 and so 
'mochiweb_request_recv' is never set in the process dictionary. 
mochiweb_request:should_close/0 then thinks there's been some sort of error 
and forces the connection to close.

Attached patch modifies read_chunk/1 to use recv/2 to ensure process dict 
is updated correctly.

Note: the patch was initially prepared against couchdb's copy of mochiweb 
but "ports" to mochiweb trunk cleanly. I haven't tested against trunk 
though!

Original issue reported on code.google.com by matt.goo...@gmail.com on 16 Dec 2009 at 11:54

Attachments:

GoogleCodeExporter commented 8 years ago
r120 puts it in the right place, the attached patch could in some contrived 
cases set the flag incorrectly so I did 
it somewhat differently

Original comment by bob.ippo...@gmail.com on 2 Jan 2010 at 9:18