Skip to content

Commit

Permalink
cache: If enabled return HTTP response to RX_OVERFLOW
Browse files Browse the repository at this point in the history
  • Loading branch information
cartoush committed Oct 3, 2024
1 parent 6fb85ef commit c9f22bf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/varnishd/http1/cache_http1_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ HTTP1_Session(struct worker *wrk, struct req *req)
cache_param->http_req_size);
assert(!WS_IsReserved(req->htc->ws));
if (hs < HTC_S_EMPTY) {
if (FEATURE(FEATURE_OVERFLOW_HTTP_RESP) && hs == HTC_S_OVERFLOW) {
(void)req->transport->minimal_response(req,
cache_param->req_overflow_status);
}
req->acct.req_hdrbytes +=
req->htc->rxbuf_e - req->htc->rxbuf_b;
Req_AcctLogCharge(wrk->stats, req);
Expand Down
28 changes: 28 additions & 0 deletions bin/varnishtest/tests/b00092.vtc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
varnishtest "HTTP response to RX_OVERFLOW"

# server s1 {} -start

varnish v1 -cliok "param.set http_req_size 500b" -vcl {
backend default none;
} -start

client c1 {
txreq -url "/world?hello=world${string,repeat,100,&hello=world}"
expect_close
} -run

varnish v1 -cliok "param.set feature +overflow_http_resp"

client c1 {
txreq -url "/world?hello=world${string,repeat,100,&hello=world}"
rxresp
expect resp.status == 413
} -run

varnish v1 -cliok "param.set req_overflow_status 414"

client c1 {
txreq -url "/world?hello=world${string,repeat,100,_hello-world}"
rxresp
expect resp.status == 414
} -run

0 comments on commit c9f22bf

Please sign in to comment.