Skip to content

Commit

Permalink
http-parser: Error on EOF errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Feb 5, 2011
1 parent e42c74e commit c783aef
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/node_http_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Value>();

if (rv != 0) {
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
Local<Object> obj = e->ToObject();
obj->Set(String::NewSymbol("bytesParsed"), Integer::New(0));
return scope.Close(e);
}

return Undefined();
}

Expand Down

0 comments on commit c783aef

Please sign in to comment.