Skip to content

Commit

Permalink
Add param h2_rapid_reset
Browse files Browse the repository at this point in the history
Only RST frames received earlier than this duration will be considered
rapid.
  • Loading branch information
daghf committed Oct 17, 2023
1 parent 9e9e9b3 commit 392a551
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions bin/varnishd/http2/cache_http2_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
return (0);

now = VTIM_real();
CHECK_OBJ_NOTNULL(r2->req, REQ_MAGIC);
AN(r2->req->t_first);
if (now - r2->req->t_first > cache_param->h2_rapid_reset)
return (0);

d = now - h2->last_rst;
h2->rst_budget += cache_param->h2_rapid_reset_limit * d /
cache_param->h2_rapid_reset_period;
Expand Down
15 changes: 14 additions & 1 deletion include/tbl/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,20 @@ PARAM_SIMPLE(
"HTTP2 maximum size of an uncompressed header list."
)

PARAM_SIMPLE(
/* name */ h2_rapid_reset,
/* typ */ timeout,
/* min */ "0.000",
/* max */ NULL,
/* def */ "1.000",
/* units */ "seconds",
/* descr */
"The upper threshold for how rapid an http/2 RST has to come for "
"it to be treated as suspect and subjected to the rate limits "
"specified by h2_rapid_reset_limit and h2_rapid_reset_period.",
/* flags */ EXPERIMENTAL,
)

PARAM_SIMPLE(
/* name */ h2_rapid_reset_limit,
/* typ */ uint,
Expand Down Expand Up @@ -1284,7 +1298,6 @@ PARAM_SIMPLE(
/* flags */ EXPERIMENTAL|WIZARD,
)


/*--------------------------------------------------------------------
* Memory pool parameters
*/
Expand Down

0 comments on commit 392a551

Please sign in to comment.