Commit b9708eac authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Fix a recently introduced issue with logging of ESI request headers.

parent da3c0bd9
......@@ -595,7 +595,8 @@ extern pthread_t cli_thread;
/* cache_http.c */
unsigned HTTP_estimate(unsigned nhttp);
void HTTP_Copy(struct http *to, const struct http * const fm);
void HTTP_Clone(struct http *to, const struct http * const fm);
void HTTP_Dup(struct http *to, const struct http * const fm);
struct http *HTTP_create(void *p, uint16_t nhttp, unsigned);
const char *http_Status2Reason(unsigned, const char **);
unsigned http_EstimateWS(const struct http *fm, unsigned how);
......
......@@ -141,7 +141,7 @@ ved_include(struct req *preq, const char *src, const char *host,
req->top = preq->top;
HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod);
HTTP_Copy(req->http, preq->http0);
HTTP_Dup(req->http, preq->http0);
http_SetH(req->http, HTTP_HDR_URL, src);
if (host != NULL && *host != '\0') {
......
......@@ -208,7 +208,7 @@ vbf_stp_mkbereq(struct worker *wrk, struct busyobj *bo)
HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod);
bo->ws_bo = WS_Snapshot(bo->ws);
HTTP_Copy(bo->bereq, bo->bereq0);
HTTP_Clone(bo->bereq, bo->bereq0);
if (bo->req->req_body_status == REQ_BODY_NONE) {
bo->req = NULL;
......
......@@ -190,19 +190,39 @@ http_Teardown(struct http *hp)
memset(hp->hdf, 0, sizeof *hp->hdf * hp->shd);
}
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------
* Duplicate the http content into another http
* We cannot just memcpy the struct because the hd & hdf are private
* storage to the struct http.
*/
void
HTTP_Copy(struct http *to, const struct http * const fm)
HTTP_Dup(struct http *to, const struct http * const fm)
{
assert(fm->nhd <= to->shd);
memcpy(&to->nhd, &fm->nhd, sizeof *to - offsetof(struct http, nhd));
memcpy(to->hd, fm->hd, fm->nhd * sizeof *to->hd);
memcpy(to->hdf, fm->hdf, fm->nhd * sizeof *to->hdf);
to->nhd = fm->nhd;
to->logtag = fm->logtag;
to->status = fm->status;
to->protover = fm->protover;
}
/*--------------------------------------------------------------------
* Clone the entire http structure, including vsl & ws
*/
void
HTTP_Clone(struct http *to, const struct http * const fm)
{
HTTP_Dup(to, fm);
to->vsl = fm->vsl;
to->ws = fm->ws;
}
/*--------------------------------------------------------------------*/
void
......
......@@ -189,7 +189,7 @@ Req_Rollback(struct req *req)
{
VCL_TaskLeave(req->vcl, req->privs);
VCL_TaskEnter(req->vcl, req->privs);
HTTP_Copy(req->http, req->http0);
HTTP_Clone(req->http, req->http0);
if (WS_Overflowed(req->ws))
req->wrk->stats->ws_client_overflow++;
WS_Reset(req->ws, req->ws_req);
......
......@@ -94,7 +94,7 @@ cnt_transport(struct worker *wrk, struct req *req)
}
req->ws_req = WS_Snapshot(req->ws);
HTTP_Copy(req->http0, req->http); // For ESI & restart
HTTP_Clone(req->http0, req->http); // For ESI & restart
req->req_step = R_STP_RECV;
return (REQ_FSM_MORE);
}
......
......@@ -639,7 +639,7 @@ VRT_Rollback(VRT_CTX, VCL_HTTP hp)
// -> VBO_Rollback ?
VCL_TaskLeave(ctx->bo->vcl, ctx->bo->privs);
VCL_TaskEnter(ctx->bo->vcl, ctx->bo->privs);
HTTP_Copy(ctx->bo->bereq, ctx->bo->bereq0);
HTTP_Clone(ctx->bo->bereq, ctx->bo->bereq0);
WS_Reset(ctx->bo->bereq->ws, ctx->bo->ws_bo);
WS_Reset(ctx->bo->ws, ctx->bo->ws_bo);
} else
......
......@@ -52,6 +52,10 @@
* binary/load-time compatible, increment MAJOR version
*
*
* 9.0 (scheduled for 2019-03-15)
* HTTP_Copy() removed
* HTTP_Dup() added
* HTTP_Clone() added
* 8.0 (2018-09-15)
* VRT_Strands() added
* VRT_StrandsWS() added
......
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