Skip to content

Commit c783aef

Browse files
committed
http-parser: Error on EOF errors
1 parent e42c74e commit c783aef

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/node_http_parser.cc

+8-1
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,17 @@ class Parser : public ObjectWrap {
308308
assert(!current_buffer);
309309
parser->got_exception_ = false;
310310

311-
http_parser_execute(&(parser->parser_), &settings, NULL, 0);
311+
int rv = http_parser_execute(&(parser->parser_), &settings, NULL, 0);
312312

313313
if (parser->got_exception_) return Local<Value>();
314314

315+
if (rv != 0) {
316+
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
317+
Local<Object> obj = e->ToObject();
318+
obj->Set(String::NewSymbol("bytesParsed"), Integer::New(0));
319+
return scope.Close(e);
320+
}
321+
315322
return Undefined();
316323
}
317324

0 commit comments

Comments
 (0)