Skip to content

Commit c8e9372

Browse files
committed
Fix streaming body with keep-alive
The body would get discarded and state would be stuck on `REQUEST_LINE` prior to this change.
1 parent 9e5daea commit c8e9372

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

http-parser.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,13 @@ HTTPParser.prototype.HEADER = function () {
353353
}
354354

355355
info.shouldKeepAlive = this.shouldKeepAlive();
356+
357+
// if we have a keep alive connection and no content length header,
358+
// the body is streaming and should be read raw.
359+
if (info.shouldKeepAlive && !hasContentLength) {
360+
this.body_bytes = null;
361+
}
362+
356363
//problem which also exists in original node: we should know skipBody before calling onHeadersComplete
357364
var skipBody;
358365
if (compatMode0_12) {

0 commit comments

Comments
 (0)