char *f; /* first (F)ree byte */
char *e; /* (E)nd of buffer */
- unsigned conds; /* If-* headers present */
+ unsigned char conds; /* If-* headers present */
+ unsigned char objlog;
struct http_hdr hd[MAX_HTTP_HDRS];
unsigned nhd;
if (http_GetHdr(vc->http, H_Last_Modified, &b))
sp->obj->last_modified = TIM_parse(b);
+ /*
+ * We borrow the sessions workspace and http header for building the
+ * headers to store in the object, then copy them over there.
+ * The actual headers to reply with are built later on over in
+ * cache_response.c
+ */
sp->http->f = sp->http->v;
sp->http->nhd = HTTP_HDR_FIRST;
+ sp->http->objlog = 1; /* log as SLT_ObjHeader */
http_CopyResp(sp->fd, sp->http, vc->http);
http_FilterHeader(sp->fd, sp->http, vc->http, HTTPH_A_INS);
cls = fetch_chunked(sp, vc->fd, vc->http);
else
cls = fetch_eof(sp, vc->fd, vc->http);
- http_PrintfHeader(sp->fd, sp->http, "Content-Length: %u", sp->obj->len);
+ http_PrintfHeader(sp->fd, sp->http,
+ "Content-Length: %u", sp->obj->len);
} else
cls = 0;
+ sp->http->objlog = 0;
http_CopyHttp(&sp->obj->http, sp->http);
+ sp->http->f = sp->http->v;
if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close"))
cls = 1;
#define VSLH(ax, bx, cx, dx) \
VSLR((ax), (bx), (cx)->hd[(dx)].b, (cx)->hd[(dx)].e);
+#define VSLHT(bx, cx, dx) \
+ VSLH((cx)->objlog ? SLT_ObjHeader : SLT_TxHeader, bx, cx, dx)
+
/*--------------------------------------------------------------------*/
void
if (to->nhd < MAX_HTTP_HDRS) {
to->hd[to->nhd].b = fm->hd[n].b;
to->hd[to->nhd].e = fm->hd[n].e;
- VSLH(SLT_TxHeader, fd, to, to->nhd);
+ VSLHT(fd, to, to->nhd);
to->nhd++;
} else {
VSL_stats->losthdr++;
n = to->nhd++;
to->hd[n].b = (void*)(uintptr_t)hdr;
to->hd[n].e = strchr(hdr, '\0');
- VSLH(SLT_TxHeader, fd, to, n);
+ VSLHT(fd, to, n);
}
/*--------------------------------------------------------------------*/
to->hd[to->nhd].b = to->f;
to->hd[to->nhd].e = to->f + n;
to->f += n + 1;
- VSLH(SLT_TxHeader, fd, to, to->nhd);
+ VSLHT(fd, to, to->nhd);
to->nhd++;
}
va_end(ap);
SLTM(Protocol)
SLTM(RxHeader)
SLTM(TxHeader)
+SLTM(ObjHeader)
SLTM(LostHeader)
SLTM(TTL)
SLTM(VCL_acl)