vtls: use a backend standard message for "ALPN: offers %s"
I call it VTLS_INFOF_ALPN_OFFER_1STR, the '1str' meaning that the infof() call also needs a string argument: the ALPN ID. Closes #8657
This commit is contained in:
parent
62d5818242
commit
55043b40c1
@ -698,12 +698,12 @@ static CURLcode bearssl_connect_step1(struct Curl_easy *data,
|
||||
#endif
|
||||
) {
|
||||
backend->protocols[cur++] = ALPN_H2;
|
||||
infof(data, "ALPN, offering %s", ALPN_H2);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
}
|
||||
#endif
|
||||
|
||||
backend->protocols[cur++] = ALPN_HTTP_1_1;
|
||||
infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
|
||||
br_ssl_engine_set_protocol_names(&backend->ctx.eng,
|
||||
backend->protocols, cur);
|
||||
|
||||
@ -640,14 +640,14 @@ gtls_connect_step1(struct Curl_easy *data,
|
||||
protocols[cur].data = (unsigned char *)ALPN_H2;
|
||||
protocols[cur].size = ALPN_H2_LENGTH;
|
||||
cur++;
|
||||
infof(data, "ALPN, offering %.*s", ALPN_H2_LENGTH, ALPN_H2);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
}
|
||||
#endif
|
||||
|
||||
protocols[cur].data = (unsigned char *)ALPN_HTTP_1_1;
|
||||
protocols[cur].size = ALPN_HTTP_1_1_LENGTH;
|
||||
cur++;
|
||||
infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
|
||||
if(gnutls_alpn_set_protocols(session, protocols, cur, 0)) {
|
||||
failf(data, "failed setting ALPN");
|
||||
|
||||
@ -628,7 +628,7 @@ mbed_connect_step1(struct Curl_easy *data, struct connectdata *conn,
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
for(p = &backend->protocols[0]; *p; ++p)
|
||||
infof(data, "ALPN, offering %s", *p);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, *p);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -2851,14 +2851,14 @@ static CURLcode ossl_connect_step1(struct Curl_easy *data,
|
||||
|
||||
memcpy(&protocols[cur], ALPN_H2, ALPN_H2_LENGTH);
|
||||
cur += ALPN_H2_LENGTH;
|
||||
infof(data, "ALPN, offering %s", ALPN_H2);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
}
|
||||
#endif
|
||||
|
||||
protocols[cur++] = ALPN_HTTP_1_1_LENGTH;
|
||||
memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH);
|
||||
cur += ALPN_HTTP_1_1_LENGTH;
|
||||
infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
|
||||
/* expects length prefixed preference ordered list of protocols in wire
|
||||
* format
|
||||
|
||||
@ -325,12 +325,12 @@ cr_init_backend(struct Curl_easy *data, struct connectdata *conn,
|
||||
|
||||
config_builder = rustls_client_config_builder_new();
|
||||
#ifdef USE_HTTP2
|
||||
infof(data, "offering ALPN for HTTP/1.1 and HTTP/2");
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
rustls_client_config_builder_set_alpn_protocols(config_builder, alpn, 2);
|
||||
#else
|
||||
infof(data, "offering ALPN for HTTP/1.1 only");
|
||||
rustls_client_config_builder_set_alpn_protocols(config_builder, alpn, 1);
|
||||
#endif
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
if(!verifypeer) {
|
||||
rustls_client_config_builder_dangerous_set_certificate_verifier(
|
||||
config_builder, cr_verify_none);
|
||||
|
||||
@ -908,14 +908,14 @@ schannel_connect_step1(struct Curl_easy *data, struct connectdata *conn,
|
||||
alpn_buffer[cur++] = ALPN_H2_LENGTH;
|
||||
memcpy(&alpn_buffer[cur], ALPN_H2, ALPN_H2_LENGTH);
|
||||
cur += ALPN_H2_LENGTH;
|
||||
infof(data, "schannel: ALPN, offering %s", ALPN_H2);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
}
|
||||
#endif
|
||||
|
||||
alpn_buffer[cur++] = ALPN_HTTP_1_1_LENGTH;
|
||||
memcpy(&alpn_buffer[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH);
|
||||
cur += ALPN_HTTP_1_1_LENGTH;
|
||||
infof(data, "schannel: ALPN, offering %s", ALPN_HTTP_1_1);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
|
||||
*list_len = curlx_uitous(cur - list_start_index);
|
||||
*extension_len = *list_len + sizeof(unsigned int) + sizeof(unsigned short);
|
||||
|
||||
@ -1851,12 +1851,12 @@ static CURLcode sectransp_connect_step1(struct Curl_easy *data,
|
||||
#endif
|
||||
) {
|
||||
CFArrayAppendValue(alpnArr, CFSTR(ALPN_H2));
|
||||
infof(data, "ALPN, offering %s", ALPN_H2);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
}
|
||||
#endif
|
||||
|
||||
CFArrayAppendValue(alpnArr, CFSTR(ALPN_HTTP_1_1));
|
||||
infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
|
||||
/* expects length prefixed preference ordered list of protocols in wire
|
||||
* format
|
||||
|
||||
@ -36,6 +36,8 @@ struct ssl_connect_data;
|
||||
|
||||
#define VTLS_INFOF_NO_ALPN \
|
||||
"ALPN: server did not agree on a protocol. Uses default."
|
||||
#define VTLS_INFOF_ALPN_OFFER_1STR \
|
||||
"ALPN: offers %s"
|
||||
|
||||
struct Curl_ssl {
|
||||
/*
|
||||
|
||||
@ -526,12 +526,12 @@ wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn,
|
||||
#ifdef USE_HTTP2
|
||||
if(data->state.httpwant >= CURL_HTTP_VERSION_2) {
|
||||
strcpy(protocols + strlen(protocols), ALPN_H2 ",");
|
||||
infof(data, "ALPN, offering %s", ALPN_H2);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_H2);
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy(protocols + strlen(protocols), ALPN_HTTP_1_1);
|
||||
infof(data, "ALPN, offering %s", ALPN_HTTP_1_1);
|
||||
infof(data, VTLS_INFOF_ALPN_OFFER_1STR, ALPN_HTTP_1_1);
|
||||
|
||||
if(wolfSSL_UseALPN(backend->handle, protocols,
|
||||
(unsigned)strlen(protocols),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user