diff --git a/src/http_ana.c b/src/http_ana.c index a52b0f24a7..a045e53fe0 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -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)))) { diff --git a/src/stream_interface.c b/src/stream_interface.c index 6d26919d8d..cd01840e25 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -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 */