diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 7390a71127..62dea03fd5 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -308,10 +308,17 @@ class Parser : public ObjectWrap { assert(!current_buffer); parser->got_exception_ = false; - http_parser_execute(&(parser->parser_), &settings, NULL, 0); + int rv = http_parser_execute(&(parser->parser_), &settings, NULL, 0); if (parser->got_exception_) return Local(); + if (rv != 0) { + Local e = Exception::Error(String::NewSymbol("Parse Error")); + Local obj = e->ToObject(); + obj->Set(String::NewSymbol("bytesParsed"), Integer::New(0)); + return scope.Close(e); + } + return Undefined(); }