Browse files

Fix pipelined requests with content-length header.

When a request includes a Content-length header, it does not include a
terminating CRLF after the content - the next request begins immediately.
This change prevents us from misparsing the next request.
  • Loading branch information...
1 parent 63afee9 commit e65957e155140cc2d9aef61dff84e1254efc93db @sethml sethml committed Nov 11, 2011
Showing with 3 additions and 3 deletions.
  1. +2 −1 lib/modes.js
  2. +1 −2 test/keep_alive_post.js
View
3 lib/modes.js
@@ -357,7 +357,8 @@ exports.readLen = function (buf, start, len) {
if (this._pendingBytes === 0) {
this.request.emit('end');
- this.mode = 'lastCRLF';
+ req.emit('rawEnd');
+ this.mode = this._shouldKeepAlive ? 'begin' : 'finished';
}
return start + slice.length;
View
3 test/keep_alive_post.js
@@ -73,8 +73,7 @@ test('keep-alive post', function (t) {
'Host: second.beep',
'Content-Length: 10',
'',
- '0123456789',
- 'POST /third HTTP/1.1',
+ '0123456789POST /third HTTP/1.1',
'Host: third.beep',
'Transfer-Encoding: chunked',
'',

0 comments on commit e65957e

Please sign in to comment.