- parser: in some cases, the next state was not being set if a user callback
returned a non 0.
- evhtp: check for a paused request, no matter if the parser failed.
- Due to some changes made recently, when the htparser state went back to the
beginning after a request had been processed, some variables were not being
reset. When multiple requests exist, the prior request could have written
something the current request doesn't use. This resulted in corrupted data.
The fix was to simply reset those variables each time the state goes to start.
- Rewrote the test.c app to be more flexible and verbose on output.
Set the path that will be used when calling hook_path_run() and
hook_uri_run() in s_after_slash_in_uri state to "/", not " ".
Also handle empty path when a port is specified in the host part.
The query component is indicated by the first question mark ("?")
character and terminated by a number sign ("#") character or by the
end of the URI.
The old code started the query component at the *last* question mark.
* evhtp_send_reply_end bugfix: evhtp_send_reply_end() would set the request as
finished and then call bufferevent_flush(). The assumption here was bufferevent_flush()
actually does something, which in reality isn't the case:
bufferevent_sock = be_socket_flush(...) { return 0; }
bufferevent_openssl = be_openssl_flush(...) { return 0; }
My dumb expectation was the writecb would get called on a flush, so instead
send_reply_end() will now call the writecb directly (this function makes sure
all data has been sent and the request is finished, etc).
* _evhtp_accept_cb() will now check the return status of evthr_pool_defer, which
may return a RETRY. In this case it is assumed that the evthr is way too busy
and will drop the connection. In the future we may want to create a retry
mechanism to avoid dropped connections. Reasoning for this is if a evthr_defer
fails, a connection will be in limbo, and never accepted().
* Fixed minor bug in the http parser for reply status code errors.
* Made evhtp_unset_hook() public.
* Made evhtp_unset_all_hooks() public.
The ctype.h functions, unfortunately, depend on the current locale.
This makes them unsuitable for handling network data, since they can
tell you different answers depending on what locale is set.
This patch also changes the behavior of % in queries in evhtp.c.
Previously, any alphanumeric, non-punctuation character was
acceptable. Now, it's only hex characters. If we should change it
back for some reason, there is just one function to edit.
The htparse library makes some assumptions about characters that are
not true for non-ascii-based system. (For example, that all
upper-case letters are numerically between 'A' and 'Z'; or that
(int)'A' is the same as the encoding of 'h' on the wire.) This is
always true in practice, except for some really horrible places we
will never want to build. But in theory, C allows (int)'A' to be
basically anything. So let's put our pedantic hats on briefly and
detect non-ASCII environments, if only to give an error.