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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user