[master] 43b4bec Make VRY_Create() operate on the busyobj and specifically on the bereq.* rather than the req.*, since that's what the backend saw.
Poul-Henning Kamp
phk at varnish-cache.org
Mon May 13 14:30:43 CEST 2013
commit 43b4bec0860f45c75d8d097a5d8a6cf6362c764e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon May 13 12:30:07 2013 +0000
Make VRY_Create() operate on the busyobj and specifically on the
bereq.* rather than the req.*, since that's what the backend saw.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 9b96e4e..aa83773 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -1007,7 +1007,7 @@ void RES_BuildHttp(struct req *);
void RES_WriteObj(struct req *);
/* cache_vary.c */
-int VRY_Create(struct req *req, const struct http *hp, struct vsb **psb);
+int VRY_Create(struct busyobj *bo, struct vsb **psb);
int VRY_Match(struct req *, const uint8_t *vary);
void VRY_Validate(const uint8_t *vary);
void VRY_Prep(struct req *);
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index c9e0e05..a1baa0e 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -576,7 +576,7 @@ cnt_fetchbody(struct worker *wrk, struct req *req)
/* Create Vary instructions */
if (req->objcore->objhead != NULL) {
- varyl = VRY_Create(req, bo->beresp, &vary);
+ varyl = VRY_Create(bo, &vary);
if (varyl > 0) {
AN(vary);
assert(varyl == VSB_len(vary));
diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c
index ba87608..1ec8548 100644
--- a/bin/varnishd/cache/cache_vary.c
+++ b/bin/varnishd/cache/cache_vary.c
@@ -71,18 +71,21 @@
*/
int
-VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
+VRY_Create(struct busyobj *bo, struct vsb **psb)
{
char *v, *p, *q, *h, *e;
struct vsb *sb, *sbh;
unsigned l;
int error = 0;
+ CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
+ CHECK_OBJ_NOTNULL(bo->bereq, HTTP_MAGIC);
+ CHECK_OBJ_NOTNULL(bo->beresp, HTTP_MAGIC);
AN(psb);
AZ(*psb);
/* No Vary: header, no worries */
- if (!http_GetHdr(hp, H_Vary, &v))
+ if (!http_GetHdr(bo->beresp, H_Vary, &v))
return (0);
/* For vary matching string */
@@ -102,7 +105,7 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
continue;
if (q - p > INT8_MAX) {
- VSLb(req->vsl, SLT_Error,
+ VSLb(bo->vsl, SLT_Error,
"Vary header name length exceeded");
error = 1;
break;
@@ -114,7 +117,7 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
(char)(1 + (q - p)), (int)(q - p), p, 0);
AZ(VSB_finish(sbh));
- if (http_GetHdr(req->http, VSB_data(sbh), &h)) {
+ if (http_GetHdr(bo->bereq, VSB_data(sbh), &h)) {
AZ(vct_issp(*h));
/* Trim trailing space */
e = strchr(h, '\0');
@@ -123,7 +126,7 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
/* Encode two byte length and contents */
l = e - h;
if (l > 0xffff - 1) {
- VSLb(req->vsl, SLT_Error,
+ VSLb(bo->vsl, SLT_Error,
"Vary header maximum length exceeded");
error = 1;
break;
@@ -143,7 +146,7 @@ VRY_Create(struct req *req, const struct http *hp, struct vsb **psb)
if (*q == '\0')
break;
if (*q != ',') {
- VSLb(req->vsl, SLT_Error, "Malformed Vary header");
+ VSLb(bo->vsl, SLT_Error, "Malformed Vary header");
error = 1;
break;
}
More information about the varnish-commit
mailing list