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

Commit f0cbf3f

Browse files
committed
squashme: Extract rapid reset to its own function, invoke prior to h2_kill_req
1 parent a15c38a commit f0cbf3f

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

bin/varnishd/http2/cache_http2_proto.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,15 @@ h2_rx_push_promise(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
321321
/**********************************************************************
322322
*/
323323

324-
static h2_error v_matchproto_(h2_rxframe_f)
325-
h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
324+
static h2_error
325+
h2_rapid_reset(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
326326
{
327327
vtim_real now;
328328
vtim_dur d;
329329

330330
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
331331
ASSERT_RXTHR(h2);
332-
CHECK_OBJ_ORNULL(r2, H2_REQ_MAGIC);
333-
334-
if (h2->rxf_len != 4) // rfc7540,l,2003,2004
335-
return (H2CE_FRAME_SIZE_ERROR);
336-
if (r2 == NULL)
337-
return (0);
338-
h2_kill_req(wrk, h2, r2, h2_streamerror(vbe32dec(h2->rxf_data)));
332+
CHECK_OBJ_NOTNULL(r2, H2_REQ_MAGIC);
339333

340334
if (cache_param->h2_rapid_reset_limit == 0)
341335
return (0);
@@ -360,10 +354,27 @@ h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
360354
return (H2CE_RAPID_RESET);
361355
}
362356
h2->rst_budget -= 1.0;
363-
364357
return (0);
365358
}
366359

360+
static h2_error v_matchproto_(h2_rxframe_f)
361+
h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
362+
{
363+
h2_error h2e;
364+
365+
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
366+
ASSERT_RXTHR(h2);
367+
CHECK_OBJ_ORNULL(r2, H2_REQ_MAGIC);
368+
369+
if (h2->rxf_len != 4) // rfc7540,l,2003,2004
370+
return (H2CE_FRAME_SIZE_ERROR);
371+
if (r2 == NULL)
372+
return (0);
373+
h2e = h2_rapid_reset(wrk, h2, r2);
374+
h2_kill_req(wrk, h2, r2, h2_streamerror(vbe32dec(h2->rxf_data)));
375+
return (h2e);
376+
}
377+
367378
/**********************************************************************
368379
*/
369380

0 commit comments

Comments
 (0)