Christopher,

as mentioned in my comment in #640 I wrote a test that verifies that unique IDs
via PPv2 continue to work or ALPN servers in the future:

    https://github.com/haproxy/haproxy/issues/640#issuecomment-634117124

The test does the bare minimum, receiving a single unique ID. The remaining
behavior is tested in proxy_protocol_send_unique_id.vtc which does not depend
on SSL.

Best regards
Tim Düsterhus

Apply with `git am --scissors` to automatically cut the commit message.

-- >8 --
This reg-test checks that sending unique IDs via PPv2 works for servers
with the `alpn` option specified (issue #640). As a side effect it also
checks that PPv2 works with ALPN (issue #651).

It has been verified that the test fails without the following commits
applied and succeeds with them applied.

   1f9a4ecea BUG/MEDIUM: backend: set the connection owner to the session when 
using alpn.
   083fd42d5 BUG/MEDIUM: connection: Ignore PP2 unique ID for stream-less 
connections
   eb9ba3cb2 BUG/MINOR: connection: Always get the stream when available to 
send PP2 line

Without the first two commits HAProxy crashes during execution of the
test. Without the last commit the test will fail, because no unique ID
is received.
---
 .../proxy_protocol_send_unique_id_alpn.vtc    | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 reg-tests/connection/proxy_protocol_send_unique_id_alpn.vtc

diff --git a/reg-tests/connection/proxy_protocol_send_unique_id_alpn.vtc 
b/reg-tests/connection/proxy_protocol_send_unique_id_alpn.vtc
new file mode 100644
index 000000000..87e590a9b
--- /dev/null
+++ b/reg-tests/connection/proxy_protocol_send_unique_id_alpn.vtc
@@ -0,0 +1,33 @@
+varnishtest "Check that the unique ID TLV is properly sent for servers with 
ALPN option"
+
+#REQUIRE_VERSION=2.2
+#REQUIRE_OPTIONS=OPENSSL
+
+feature ignore_unknown_macro
+
+haproxy h1 -conf {
+    defaults
+        mode http
+        log global
+        unique-id-format %{+X}o\ TEST-%[req.hdr(in)]
+
+    listen sender
+        bind "fd@${feS}"
+
+        server example ${h1_feR_addr}:${h1_feR_port} send-proxy-v2 
proxy-v2-options unique-id ssl alpn XXX verify none
+
+    listen receiver
+        bind "fd@${feR}" ssl crt ${testdir}/common.pem accept-proxy
+
+        http-request set-var(txn.proxy_unique_id) fc_pp_unique_id
+        http-after-response set-header proxy_unique_id 
%[var(txn.proxy_unique_id)]
+        http-request return status 200
+} -start
+
+# Validate that a correct header passes
+client c1 -connect ${h1_feS_sock} {
+    txreq -url "/" \
+        -hdr "in: foo"
+    rxresp
+    expect resp.http.proxy_unique_id == "TEST-foo"
+} -run
-- 
2.26.2


Reply via email to