-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
The comments in RequestHandler.h indicate that onRequest will be invoked for all handlers and that onError will never be invoked prior to onRequest:
/**
* Invoked when we have successfully fetched headers from client. This will
* always be the first callback invoked on your handler.
*/
virtual void onRequest(std::unique_ptr<HTTPMessage> headers) noexcept = 0;
/**
* Request failed. Maybe because of read/write error on socket or client
* not being able to send request in time.
*
* NOTE: Can be invoked at any time (except for before onRequest).
*
* No more callbacks will be invoked after this. You should clean up after
* yourself.
*/
virtual void onError(ProxygenError err) noexcept = 0;
These comments do not match the implementation. For example, when a request contains an Expect: foo header (where foo is anything other than 100-continue), RequestHandlerAdaptor will invoke onError and detach the handler without having invoked onRequest.
There are a lot of conditions between HTTPServerAcceptor::newHandler creating a handler and the session invoking onRequest, and the set of conditions varies depending on the underlying session type, so it's not obvious whether there are other scenarios that also violate the contract.
Is this a defect in the implementation or the comments?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels