Unsubscribe from the header callback?
SalmaanP opened this issue · comments
Salmaan Pehlari commented
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.
Pierce Lopez commented
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.
Salmaan Pehlari commented
Okay, I can make that work. Thanks!