[master] d192350 Make vrt_selecthttp public

Federico G. Schwindt fgsch at lodoss.net
Fri Nov 28 01:07:21 CET 2014


commit d192350fdb7dcfa4f0fed24cb4af1ce89827df8e
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu Nov 27 18:42:39 2014 +0000

    Make vrt_selecthttp public

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index a49da52..5fbf923 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -90,8 +90,8 @@ VRT_acl_log(VRT_CTX, const char *msg)
 
 /*--------------------------------------------------------------------*/
 
-static struct http *
-vrt_selecthttp(VRT_CTX, enum gethdr_e where)
+struct http *
+VRT_selecthttp(VRT_CTX, enum gethdr_e where)
 {
 	struct http *hp;
 
@@ -110,7 +110,7 @@ vrt_selecthttp(VRT_CTX, enum gethdr_e where)
 		hp = ctx->http_resp;
 		break;
 	default:
-		WRONG("vrt_selecthttp 'where' invalid");
+		WRONG("VRT_selecthttp 'where' invalid");
 	}
 	return (hp);
 }
@@ -130,7 +130,7 @@ VRT_GetHdr(VRT_CTX, const struct gethdr_s *hs)
 		return(HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore,
 		    hs->what));
 	}
-	hp = vrt_selecthttp(ctx, hs->where);
+	hp = VRT_selecthttp(ctx, hs->where);
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	if (!http_GetHdr(hp, hs->what, &p))
 		return (NULL);
@@ -228,7 +228,7 @@ VRT_SetHdr(VRT_CTX , const struct gethdr_s *hs,
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	AN(hs);
 	AN(hs->what);
-	hp = vrt_selecthttp(ctx, hs->where);
+	hp = VRT_selecthttp(ctx, hs->where);
 	CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
 	va_start(ap, p);
 	if (p == vrt_magic_string_unset) {
diff --git a/include/vrt.h b/include/vrt.h
index 9331600..2e720a2 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -208,6 +208,7 @@ int VRT_rewrite(const char *, const char *);
 void VRT_error(VRT_CTX, unsigned, const char *);
 int VRT_switch_config(const char *);
 
+struct http *VRT_selecthttp(VRT_CTX, enum gethdr_e);
 const char *VRT_GetHdr(VRT_CTX, const struct gethdr_s *);
 void VRT_SetHdr(VRT_CTX, const struct gethdr_s *, const char *, ...);
 void VRT_handling(VRT_CTX, unsigned hand);
diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c
index 35c417b..42b356a 100644
--- a/lib/libvmod_std/vmod_std.c
+++ b/lib/libvmod_std/vmod_std.c
@@ -174,16 +174,11 @@ vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...)
 VCL_VOID __match_proto__(td_std_collect)
 vmod_collect(VRT_CTX, VCL_HEADER hdr)
 {
+	struct http *hp;
 
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	if (hdr->where == HDR_REQ)
-		http_CollectHdr(ctx->http_req, hdr->what);
-	else if (hdr->where == HDR_BEREQ)
-		http_CollectHdr(ctx->http_bereq, hdr->what);
-	else if (hdr->where == HDR_BERESP)
-		http_CollectHdr(ctx->http_beresp, hdr->what);
-	else if (hdr->where == HDR_RESP)
-		http_CollectHdr(ctx->http_resp, hdr->what);
+	hp = VRT_selecthttp(ctx, hdr->where);
+	http_CollectHdr(hp, hdr->what);
 }
 
 VCL_BOOL __match_proto__(td_std_healthy)



More information about the varnish-commit mailing list