Move state enum from http_parser.c to http_parser.h. #123

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

bog-dan-ro commented Aug 29, 2012

It is needed to check the state field of http_parser struct in callback functions. This way when "on_body" callback is called you can check if the state field is "s_message_done", then you parse it without making additional copies., otherwise you need to copy the buffer and wait for on_message_complete callback.

Contributor

udp commented Aug 29, 2012

That's an interesting idea - I'm not sure I agree with making the state enum itself public, but certainly some way to indicate to on_body that this is the final fragment would be useful. +1

Contributor

bog-dan-ro commented Aug 29, 2012

The state field of http_parser struct may be needed in other cases, I only spot one :), so, IMHO making the state enum public is not such a bad idea.

Many thanks for your +1 !

Member

bnoordhuis commented Aug 29, 2012

The state enum is internal, exposing it will not do. I understand where you're coming from, though. What about a int http_body_is_final(const struct http_parser *) function?

Contributor

bog-dan-ro commented Aug 30, 2012

That will work too. Should I do it and create a new pull request ?

Member

bnoordhuis commented Aug 30, 2012

Should I do it and create a new pull request ?

Yes, please. Can you add a test or two to test.c?

@bnoordhuis bnoordhuis closed this Aug 30, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment