Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
http_parser: expose pause/resume method for parser
Browse files Browse the repository at this point in the history
  • Loading branch information
tjfontaine authored and trevnorris committed Oct 17, 2013
1 parent 2e16037 commit f051b89
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/node_http_parser.cc
Expand Up @@ -495,6 +495,15 @@ class Parser : public ObjectWrap {
}


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() {
Expand Down Expand Up @@ -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());

Expand Down

0 comments on commit f051b89

Please sign in to comment.