Skip to content

Commit 292b072

Browse files
committed
BUG/MEDIUM: http-ana: Don't ignore L7 retry errors
with L7 retries are configured, when the max number of retries is reached the error must be reported to the client. However, when it was an abort on a reused connections, the client connection is silently closed. While it is expected without L7 retries, to let the client retries on its own, it is unexepcted with L7 retries. So let's fix it by ignoring the SF_SRV_REUSED flag on the stream when a L7 retry fails. This way, a 502/425 will be reported to the client. This patch should help to fix the issue #3414. It must be backported to all supported versions.
1 parent 7bfa568 commit 292b072

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/http_ana.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
12651265
struct htx *htx;
12661266
struct connection *srv_conn;
12671267
struct htx_sl *sl;
1268-
int n;
1268+
int n, l7_retry_failed = 0;
12691269

12701270
DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn, msg);
12711271

@@ -1306,19 +1306,22 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
13061306
(!conn || conn->err_code != CO_ER_SSL_EARLY_FAILED)) {
13071307
if (co_data(rep) || do_l7_retry(s, s->scb) == 0)
13081308
return 0;
1309+
l7_retry_failed = 1;
13091310
}
13101311

13111312
/* Perform a L7 retry on empty response or because server refuses the early data. */
13121313
if ((txn->flags & TX_L7_RETRY) &&
13131314
(s->be->retry_type & PR_RE_EARLY_ERROR) &&
1314-
conn && conn->err_code == CO_ER_SSL_EARLY_FAILED &&
1315-
do_l7_retry(s, s->scb) == 0) {
1316-
DBG_TRACE_DEVEL("leaving on L7 retry",
1317-
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
1318-
return 0;
1315+
conn && conn->err_code == CO_ER_SSL_EARLY_FAILED) {
1316+
if (do_l7_retry(s, s->scb) == 0) {
1317+
DBG_TRACE_DEVEL("leaving on L7 retry",
1318+
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
1319+
return 0;
1320+
}
1321+
l7_retry_failed = 1;
13191322
}
13201323

1321-
if (s->flags & SF_SRV_REUSED)
1324+
if (!l7_retry_failed && (s->flags & SF_SRV_REUSED))
13221325
goto abort_keep_alive;
13231326

13241327
if (s->be_tgcounters)
@@ -1416,9 +1419,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
14161419
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
14171420
return 0;
14181421
}
1422+
l7_retry_failed = 1;
14191423
}
14201424

1421-
if (s->flags & SF_SRV_REUSED)
1425+
if (!l7_retry_failed && (s->flags & SF_SRV_REUSED))
14221426
goto abort_keep_alive;
14231427

14241428
if (s->be_tgcounters)

0 commit comments

Comments
 (0)