http_parser: expose pause/resume method for parser

pull/24998/head
Timothy J Fontaine 2013-10-14 11:57:45 -07:00 committed by Trevor Norris
parent 2e16037201
commit f051b8919f
1 changed files with 11 additions and 0 deletions

View File

@ -495,6 +495,15 @@ public:
}
template <bool should_pause>
static Handle<Value> Pause(const Arguments& args) {
HandleScope scope;
Parser* parser = ObjectWrap::Unwrap<Parser>(args.This());
http_parser_pause(&parser->parser_, should_pause);
return Undefined();
}
private:
Local<Array> CreateHeaders() {
@ -574,6 +583,8 @@ void InitHttpParser(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD(t, "execute", Parser::Execute);
NODE_SET_PROTOTYPE_METHOD(t, "finish", Parser::Finish);
NODE_SET_PROTOTYPE_METHOD(t, "reinitialize", Parser::Reinitialize);
NODE_SET_PROTOTYPE_METHOD(t, "pause", Parser::Pause<true>);
NODE_SET_PROTOTYPE_METHOD(t, "resume", Parser::Pause<false>);
target->Set(String::NewSymbol("HTTPParser"), t->GetFunction());