Skip to content

Commit

Permalink
vtls: provide a unified APLN-disagree string for all backends
Browse files Browse the repository at this point in the history
Also rephrase to make it sound less dangerous:

 "ALPN: server did not agree on a protocol. Uses default."

Reported-by: Nick Coghlan
Fixes #8643
Closes #8651
  • Loading branch information
bagder committed Mar 31, 2022
1 parent 08ca1f2 commit 3bc5b32
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/vtls/bearssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ static CURLcode bearssl_connect_step3(struct Curl_easy *data,
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
}
else
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);
}

if(SSL_SET_OPTION(primary.sessionid)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/gtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ Curl_gtls_verifyserver(struct Curl_easy *data,
}
}
else
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);

Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ mbed_connect_step2(struct Curl_easy *data, struct connectdata *conn,
}
}
else {
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);
}
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/nss.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ static void HandshakeCallback(PRFileDesc *sock, void *arg)
#endif
case SSL_NEXT_PROTO_NO_SUPPORT:
case SSL_NEXT_PROTO_NO_OVERLAP:
infof(data, "ALPN/NPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);
return;
#ifdef SSL_ENABLE_ALPN
case SSL_NEXT_PROTO_SELECTED:
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3472,7 +3472,7 @@ static CURLcode ossl_connect_step2(struct Curl_easy *data,
}
}
else
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);

Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/rustls.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ cr_set_negotiated_alpn(struct Curl_easy *data, struct connectdata *conn,

rustls_connection_get_alpn_protocol(rconn, &protocol, &len);
if(!protocol) {
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/schannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ schannel_connect_step3(struct Curl_easy *data, struct connectdata *conn,
}
}
else
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);
Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/sectransp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2853,7 +2853,7 @@ sectransp_connect_step2(struct Curl_easy *data, struct connectdata *conn,
conn->negnpn = CURL_HTTP_VERSION_1_1;
}
else
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);

Curl_multiuse_state(data, conn->negnpn == CURL_HTTP_VERSION_2 ?
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
Expand Down
3 changes: 3 additions & 0 deletions lib/vtls/vtls.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ struct ssl_connect_data;
#define SSLSUPP_TLS13_CIPHERSUITES (1<<5) /* supports TLS 1.3 ciphersuites */
#define SSLSUPP_CAINFO_BLOB (1<<6)

#define VTLS_INFOF_NO_ALPN \
"ALPN: server did not agree on a protocol. Uses default."

struct Curl_ssl {
/*
* This *must* be the first entry to allow returning the list of available
Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/wolfssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ wolfssl_connect_step2(struct Curl_easy *data, struct connectdata *conn,
BUNDLE_MULTIPLEX : BUNDLE_NO_MULTIUSE);
}
else if(rc == SSL_ALPN_NOT_FOUND)
infof(data, "ALPN, server did not agree to a protocol");
infof(data, VTLS_INFOF_NO_ALPN);
else {
failf(data, "ALPN, failure getting protocol, error %d", rc);
return CURLE_SSL_CONNECT_ERROR;
Expand Down

0 comments on commit 3bc5b32

Please sign in to comment.