MINOR: http-ana: Perform L7 retries because of status codes in response analyser
L7 retries because of status codes are now performed in the response analyser. This way, it is no longer required to handle L7 retries in si_cs_recv(). It is also useless to set CF_READ_ERROR on the response channel to be able to trigger such retries. In addition, if no L7 retries are performed when the response is received, the L7 buffer is immediately released. Before in this case, it was only released with the stream.
This commit is contained in:
parent
d976923ab2
commit
1f08bffe0c
|
@ -1542,10 +1542,23 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||
* response which at least looks like HTTP. We have an indicator
|
||||
* of each header's length, so we can parse them quickly.
|
||||
*/
|
||||
msg->msg_state = HTTP_MSG_BODY;
|
||||
BUG_ON(htx_get_first_type(htx) != HTX_BLK_RES_SL);
|
||||
sl = http_get_stline(htx);
|
||||
|
||||
/* Perform a L7 retry because of the status code */
|
||||
if ((si_b->flags & SI_FL_L7_RETRY) &&
|
||||
l7_status_match(s->be, sl->info.res.status) &&
|
||||
do_l7_retry(s, si_b) == 0) {
|
||||
DBG_TRACE_DEVEL("leaving on L7 retry", STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Now, L7 buffer is useless, it can be released */
|
||||
b_free(&s->si[1].l7_buffer);
|
||||
|
||||
msg->msg_state = HTTP_MSG_BODY;
|
||||
|
||||
|
||||
/* 0: we might have to print this header in debug mode */
|
||||
if (unlikely((global.mode & MODE_DEBUG) &&
|
||||
(!(global.mode & MODE_QUIET) || (global.mode & MODE_VERBOSE)))) {
|
||||
|
|
|
@ -1367,28 +1367,6 @@ int si_cs_recv(struct conn_stream *cs)
|
|||
break;
|
||||
}
|
||||
|
||||
/* L7 retries enabled and maximum connection retries not reached */
|
||||
if ((si->flags & SI_FL_L7_RETRY) && si->conn_retries) {
|
||||
struct htx *htx;
|
||||
struct htx_sl *sl;
|
||||
|
||||
htx = htxbuf(&ic->buf);
|
||||
if (htx) {
|
||||
sl = http_get_stline(htx);
|
||||
if (sl && l7_status_match(si_strm(si)->be,
|
||||
sl->info.res.status)) {
|
||||
/* If we got a status for which we would
|
||||
* like to retry the request, empty
|
||||
* the buffer and pretend there's an
|
||||
* error on the channel.
|
||||
*/
|
||||
ic->flags |= CF_READ_ERROR;
|
||||
htx_reset(htx);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
si->flags &= ~SI_FL_L7_RETRY;
|
||||
}
|
||||
cur_read += ret;
|
||||
|
||||
/* if we're allowed to directly forward data, we must update ->o */
|
||||
|
|
Loading…
Reference in New Issue