Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit 392a551

Browse files
committed
Add param h2_rapid_reset
Only RST frames received earlier than this duration will be considered rapid.
1 parent 9e9e9b3 commit 392a551

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

bin/varnishd/http2/cache_http2_proto.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,11 @@ h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
341341
return (0);
342342

343343
now = VTIM_real();
344+
CHECK_OBJ_NOTNULL(r2->req, REQ_MAGIC);
345+
AN(r2->req->t_first);
346+
if (now - r2->req->t_first > cache_param->h2_rapid_reset)
347+
return (0);
348+
344349
d = now - h2->last_rst;
345350
h2->rst_budget += cache_param->h2_rapid_reset_limit * d /
346351
cache_param->h2_rapid_reset_period;

include/tbl/params.h

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,20 @@ PARAM_SIMPLE(
12571257
"HTTP2 maximum size of an uncompressed header list."
12581258
)
12591259

1260+
PARAM_SIMPLE(
1261+
/* name */ h2_rapid_reset,
1262+
/* typ */ timeout,
1263+
/* min */ "0.000",
1264+
/* max */ NULL,
1265+
/* def */ "1.000",
1266+
/* units */ "seconds",
1267+
/* descr */
1268+
"The upper threshold for how rapid an http/2 RST has to come for "
1269+
"it to be treated as suspect and subjected to the rate limits "
1270+
"specified by h2_rapid_reset_limit and h2_rapid_reset_period.",
1271+
/* flags */ EXPERIMENTAL,
1272+
)
1273+
12601274
PARAM_SIMPLE(
12611275
/* name */ h2_rapid_reset_limit,
12621276
/* typ */ uint,
@@ -1284,7 +1298,6 @@ PARAM_SIMPLE(
12841298
/* flags */ EXPERIMENTAL|WIZARD,
12851299
)
12861300

1287-
12881301
/*--------------------------------------------------------------------
12891302
* Memory pool parameters
12901303
*/

0 commit comments

Comments
 (0)