From dd773d30157237a4523c732755f43767dff96767 Mon Sep 17 00:00:00 2001 From: retoor Date: Sat, 24 Oct 2026 04:05:35 +0200 Subject: [PATCH] fix(clients): offer only http/1.1 over ALPN so Google accepts the TLS handshake wolfSSL_UseALPN takes a comma separated list; the wire-format list was sent as one garbage protocol name and Google answered with a fatal alert. The transport speaks HTTP/1.1 only, so that is all it offers. Co-Authored-By: Claude Sonnet 5.5 --- src/clients/transports/tls_wolfssl.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/clients/transports/tls_wolfssl.cpp b/src/clients/transports/tls_wolfssl.cpp index 94c78d6..a010b6c 100644 --- a/src/clients/transports/tls_wolfssl.cpp +++ b/src/clients/transports/tls_wolfssl.cpp @@ -57,11 +57,14 @@ class WolfTlsSession : public ITlsSession { WOLFSSL_SUCCESS) throw TlsError("wolfSSL hostname check setup failed"); } - if (want_h2) { - // ALPN: offer h2 first, fall back to http/1.1. - const char protos[] = "\x02h2\x08http/1.1"; - if (wolfSSL_UseALPN(ssl_.get(), (char*)protos, (unsigned int)sizeof(protos) - 1, - WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) != WOLFSSL_SUCCESS) + // ALPN: this transport speaks HTTP/1.1 only, so that is all it offers + // (h2 is never negotiated even when requested). wolfSSL takes a + // comma-separated list; a wire-format list is sent as one garbage + // protocol name and servers such as Google answer with a fatal alert. + { + char protos[] = "http/1.1"; + if (wolfSSL_UseALPN(ssl_.get(), protos, (unsigned int)strlen(protos), + WOLFSSL_ALPN_FAILED_ON_MISMATCH) != WOLFSSL_SUCCESS) throw TlsError("wolfSSL ALPN setup failed"); } if (wolfSSL_set_fd(ssl_.get(), fd) != WOLFSSL_SUCCESS)