[master] d6b1cb997 Revert "vcc: Ensure the authority does not contain a :<port>"

Nils Goroll nils.goroll at uplex.de
Fri Feb 7 12:51:11 UTC 2025


commit d6b1cb99759ffe92c460d50a9d3dc5914dfad234
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Feb 7 13:48:11 2025 +0100

    Revert "vcc: Ensure the authority does not contain a :<port>"
    
    It makes more sense to implement this as part of #4264, because once VSS tells
    us that the authority is not an ip address, we can just strip the port without
    having to basically duplicate vss_parse().
    
    This reverts commit cf658eb5f181c736a04de9d8ef421a563a9024ec.
    
    Closes #4265

diff --git a/bin/varnishtest/tests/c00042.vtc b/bin/varnishtest/tests/c00042.vtc
index dc3c5dc12..ed69de824 100644
--- a/bin/varnishtest/tests/c00042.vtc
+++ b/bin/varnishtest/tests/c00042.vtc
@@ -110,7 +110,7 @@ varnish v1 -vcl {
 		.via = v2;
 		.host = "${s1_addr}";
 		.port = "${s1_port}";
-		.host_header = "host.com:1234";
+		.host_header = "host.com";
 	}
 
 	sub vcl_recv {
diff --git a/doc/sphinx/reference/vcl-backend.rst b/doc/sphinx/reference/vcl-backend.rst
index 5d3ddd372..00904acbf 100644
--- a/doc/sphinx/reference/vcl-backend.rst
+++ b/doc/sphinx/reference/vcl-backend.rst
@@ -219,8 +219,6 @@ The HTTP authority to use when connecting to this backend. If unset,
 
 ``.authority = ""`` disables sending an authority.
 
-A colon and anything following (signifying a port) is removed from the authority.
-
 As of this release, the attribute is only used by ``.via`` connections
 as a ``PP2_TYPE_AUTHORITY`` Type-Length-Value (TLV) in the `PROXY2`_
 preamble.
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 31332b4a1..7e6bf64c6 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -374,9 +374,8 @@ vcc_ParseHostDef(struct vcc *tl, struct symbol *sym,
 	vtim_dur first_byte_timeout = NAN;
 	vtim_dur between_bytes_timeout = NAN;
 	vtim_dur backend_wait_timeout = NAN;
-	char *p, *pp;
+	char *p;
 	unsigned u;
-	int l;
 
 	if (tl->t->tok == ID &&
 	    (vcc_IdIs(tl->t, "none") || vcc_IdIs(tl->t, "None"))) {
@@ -676,11 +675,8 @@ vcc_ParseHostDef(struct vcc *tl, struct symbol *sym,
 			t_val = t_host;
 		p = t_val->dec;
 
-		pp = strchr(p, ':');
-		l = (pp == NULL) ? -1 : (int)(pp - p);
-
 		Fb(tl, 0, "\t.authority = ");
-		VSB_quote(tl->fb, p, l, VSB_QUOTE_CSTR);
+		VSB_quote(tl->fb, p, -1, VSB_QUOTE_CSTR);
 		Fb(tl, 0, ",\n");
 	}
 


More information about the varnish-commit mailing list