nodejs / http-parser

http request/response parser for c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsubscribe from the header callback?

SalmaanP opened this issue · comments

Is there a way to unsubscribe from the header callbacks once we have processed whatever headers were needed? From what I see callbacks are defined in the hp settings, but we have access to only the parser in the actual callback.

An equally efficient way to do this is to set a bit in the "user data" of the parser, when you want to ignore further header callbacks. Check that bit first thing in your header callback, and return if set. If you use the parser for multiple messages, reset the bit in the message complete callback.

Okay, I can make that work. Thanks!