Commit ab26b0b4 authored by Lachie's avatar Lachie Committed by Dridi Boukelmoune

bereq: Also unset a cached req body

parent 7bf4d5be
......@@ -35,6 +35,7 @@
#include <stdio.h>
#include "cache_varnishd.h"
#include "cache_objhead.h"
#include "cache_transport.h"
#include "common/heritage.h"
......@@ -595,6 +596,11 @@ VRT_u_bereq_body(VRT_CTX)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
if (ctx->bo->bereq_body != NULL) {
HSH_DerefObjCore(ctx->bo->wrk, &ctx->bo->bereq_body, 0);
http_Unset(ctx->bo->bereq, H_Content_Length);
}
if (ctx->bo->req != NULL) {
CHECK_OBJ(ctx->bo->req, REQ_MAGIC);
ctx->bo->req = NULL;
......
varnishtest "unset bereq.body with cached req body"
server s1 {
rxreq
expect req.method == "GET"
expect req.http.Content-Length == <undef>
txresp
rxreq
expect req.method == "GET"
txresp
} -start
varnish v1 -vcl+backend {
import std;
sub vcl_recv {
std.cache_req_body(2KB);
}
sub vcl_backend_fetch {
unset bereq.body;
}
} -start
client c1 {
txreq -body "fine"
rxresp
expect resp.status == 200
txreq
rxresp
expect resp.status == 200
} -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