[master] 234ef63 CLI debug.listen_address emits "/path -" when the address is UDS.
Geoff Simmons
geoff at uplex.de
Thu Feb 22 09:23:09 UTC 2018
commit 234ef63f0b2889d7ad80e0816dfd87633233ccfd
Author: Geoff Simmons <geoff at uplex.de>
Date: Sat Feb 17 10:26:40 2018 +0100
CLI debug.listen_address emits "/path -" when the address is UDS.
This determines the values of the vtc macros vN_addr, _port and _sock.
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index b54c99a..44b89de 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -673,8 +673,12 @@ ccf_listen_address(struct cli *cli, const char * const *av, void *priv)
AZ(pthread_mutex_lock(&shut_mtx));
VTAILQ_FOREACH(ls, &heritage.socks, list) {
- VTCP_myname(ls->sock, h, sizeof h, p, sizeof p);
- VCLI_Out(cli, "%s %s\n", h, p);
+ if (!ls->uds) {
+ VTCP_myname(ls->sock, h, sizeof h, p, sizeof p);
+ VCLI_Out(cli, "%s %s\n", h, p);
+ }
+ else
+ VCLI_Out(cli, "%s -\n", ls->endpoint);
}
AZ(pthread_mutex_unlock(&shut_mtx));
}
diff --git a/bin/varnishtest/tests/a00019.vtc b/bin/varnishtest/tests/a00019.vtc
new file mode 100644
index 0000000..864ab21
--- /dev/null
+++ b/bin/varnishtest/tests/a00019.vtc
@@ -0,0 +1,25 @@
+varnishtest "vtc v_* macros when the listen address is UDS"
+
+varnish v1 -arg "-a ${tmpdir}/v1.sock -b '${bad_backend}'" -start
+
+varnish v2 -vcl {
+ backend default { .host = "${bad_ip}"; }
+
+ sub vcl_recv {
+ return(synth(200));
+ }
+
+ sub vcl_synth {
+ set resp.http.addr = "${v1_addr}";
+ set resp.http.port = "${v1_port}";
+ set resp.http.sock = "${v1_sock}";
+ }
+} -start
+
+client c1 -connect ${v2_sock} {
+ txreq
+ rxresp
+ expect resp.http.addr == "${tmpdir}/v1.sock"
+ expect resp.http.port == "-"
+ expect resp.http.sock == "${tmpdir}/v1.sock -"
+} -run
More information about the varnish-commit
mailing list