[master] 461a22a46 Add VPX_Format_Proxy

Nils Goroll nils.goroll at uplex.de
Wed Jan 15 16:12:07 UTC 2020


commit 461a22a464da9b1ecde7b83efbf1cbc4da5a9914
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Nov 23 15:47:58 2018 +0100

    Add VPX_Format_Proxy

diff --git a/bin/varnishd/proxy/cache_proxy.h b/bin/varnishd/proxy/cache_proxy.h
index 1e4dd2540..c8d07ddb5 100644
--- a/bin/varnishd/proxy/cache_proxy.h
+++ b/bin/varnishd/proxy/cache_proxy.h
@@ -39,3 +39,5 @@
 #define PP2_SUBTYPE_SSL_MAX     0x25
 
 int VPX_tlv(const struct req *req, int tlv, void **dst, int *len);
+void VPX_Format_Proxy(struct vsb *, int, const struct suckaddr *,
+    const struct suckaddr *);
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 0f86d944e..dcb4a3de9 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -660,6 +660,35 @@ vpx_format_proxy_v2(struct vsb *vsb, int proto,
 	AZ(VSB_finish(vsb));
 }
 
+void
+VPX_Format_Proxy(struct vsb *vsb, int version,
+    const struct suckaddr *sac, const struct suckaddr *sas)
+{
+	int proto;
+	char hac[VTCP_ADDRBUFSIZE];
+	char pac[VTCP_PORTBUFSIZE];
+	char has[VTCP_ADDRBUFSIZE];
+	char pas[VTCP_PORTBUFSIZE];
+
+	AN(vsb);
+	AN(sac);
+	AN(sas);
+
+	assert(version == 1 || version == 2);
+
+	proto = VSA_Get_Proto(sas);
+	assert(proto == VSA_Get_Proto(sac));
+
+	if (version == 1) {
+		VTCP_name(sac, hac, sizeof hac, pac, sizeof pac);
+		VTCP_name(sas, has, sizeof has, pas, sizeof pas);
+		vpx_format_proxy_v1(vsb, proto, hac, pac, has, pas);
+	} else if (version == 2) {
+		vpx_format_proxy_v2(vsb, proto, sac, sas);
+	} else
+		WRONG("Wrong proxy version");
+}
+
 void
 VPX_Send_Proxy(int fd, int version, const struct sess *sp)
 {


More information about the varnish-commit mailing list