[MINOR] tcp_request: let the caller take care of errors and timeouts
tcp_request is not meant to decide how an error or a timeout has to be handled. It must just apply it rules. Now that the error checks have been added to the session, we don't need to check them anymore in tcp_request_inspect(), which will only consider the shutdown which may be the result of such an error. That makes a lot more sense since tcp_request is not really waiting for a request.
This commit is contained in:
parent
844553303d
commit
86ef7dc98d
@ -339,9 +339,10 @@ void tcpv6_add_listener(struct listener *listener)
|
||||
* needs more data, encounters an error, or wants to immediately abort the
|
||||
* request. It relies on buffers flags, and updates s->req->analysers. Its
|
||||
* behaviour is rather simple:
|
||||
* - the analyser must check for errors and timeouts, and react as expected.
|
||||
* It does not have to close anything upon error, the caller will.
|
||||
* - if the analyser does not have enough data, it must return 0without calling
|
||||
* - the analyser should check for errors and timeouts, and react as expected.
|
||||
* It does not have to close anything upon error, the caller will. Note that
|
||||
* the caller also knows how to report errors and timeouts.
|
||||
* - if the analyser does not have enough data, it must return 0 without calling
|
||||
* other ones. It should also probably do a buffer_write_dis() to ensure
|
||||
* that unprocessed data will not be forwarded. But that probably depends on
|
||||
* the protocol.
|
||||
@ -368,32 +369,6 @@ int tcp_inspect_request(struct session *s, struct buffer *req)
|
||||
req->l,
|
||||
req->analysers);
|
||||
|
||||
/* We will abort if we encounter a read error. In theory, we
|
||||
* should not abort if we get a close, it might be valid,
|
||||
* although very unlikely. FIXME: we'll abort for now, this
|
||||
* will be easier to change later.
|
||||
*/
|
||||
if (req->flags & BF_READ_ERROR) {
|
||||
req->analysers = 0;
|
||||
s->fe->failed_req++;
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLICL;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Abort if client read timeout has expired */
|
||||
else if (req->flags & BF_READ_TIMEOUT) {
|
||||
req->analysers = 0;
|
||||
s->fe->failed_req++;
|
||||
if (!(s->flags & SN_ERR_MASK))
|
||||
s->flags |= SN_ERR_CLITO;
|
||||
if (!(s->flags & SN_FINST_MASK))
|
||||
s->flags |= SN_FINST_R;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We don't know whether we have enough data, so must proceed
|
||||
* this way :
|
||||
* - iterate through all rules in their declaration order
|
||||
|
Loading…
x
Reference in New Issue
Block a user