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)