Commit efa129a6 authored by Dag Haavi Finstad's avatar Dag Haavi Finstad

Fix cache_req_body handling for H/2 requests

The h/2 request body VFP would drop data when the input buffer was too
small to fit the data in the received frame.

With this fix we have the VFP code call us again with a fresh buffer
when we run out.

Fixes: #2679
parent 561f73e8
......@@ -770,6 +770,12 @@ h2_vfp_body(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr, ssize_t *lp)
h2->rxf_len -= l;
}
*lp = l;
if (h2->rxf_len > 0) {
/* We ran out of storage: Have VFP call us
* again with a fresh buffer */
Lck_Unlock(&h2->sess->mtx);
return (VFP_OK);
}
if (h2->rxf_len == 0) {
if (h2->rxf_flags & H2FF_DATA_END_STREAM)
retval = VFP_END;
......
varnishtest "#2679: H/2 rxbody vfp drops data"
server s1 {
rxreq
expect req.http.content-length == "31469"
expect req.bodylen == 31469
txresp
} -start
varnish v1 -vcl+backend {
import std;
sub vcl_recv {
# std.cache_req_body(100KB);
}
} -start
varnish v1 -cliok "param.set feature +http2"
client c1 {
stream 1 {
txreq -req POST -hdr "content-length" "31469" -nostrend
txdata -datalen 1550 -nostrend
rxwinup
txdata -datalen 16000 -nostrend
rxwinup
txdata -datalen 13919
rxwinup
rxresp
expect resp.status == 200
} -run
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment