mirror of
https://github.com/curl/curl.git
synced 2026-06-08 01:14:40 +03:00
ALPN: query filter
Add a connection filter query to obtained the negotiated ALPN protocol to check in setup/protocols how the connection needs to behave. Remove the members `alpn` and `proxy_alpn` from `connectdata`.
This commit is contained in:
parent
44f5307891
commit
1dd0978ab5
16 changed files with 168 additions and 151 deletions
|
|
@ -226,24 +226,22 @@ static CURLcode baller_connected(struct Curl_cfilter *cf,
|
|||
cf->next = winner->cf;
|
||||
winner->cf = NULL;
|
||||
|
||||
switch(cf->conn->alpn) {
|
||||
case CURL_HTTP_VERSION_3:
|
||||
break;
|
||||
case CURL_HTTP_VERSION_2:
|
||||
#ifdef USE_NGHTTP2
|
||||
{
|
||||
/* Using nghttp2, we add the filter "below" us, so when the conn
|
||||
* closes, we tear it down for a fresh reconnect */
|
||||
result = Curl_http2_switch_at(cf, data);
|
||||
if(result) {
|
||||
ctx->state = CF_HC_FAILURE;
|
||||
ctx->result = result;
|
||||
return result;
|
||||
const char *alpn = Curl_conn_cf_get_alpn_negotiated(cf->next, data);
|
||||
if(alpn && !strcmp("h2", alpn)) {
|
||||
result = Curl_http2_switch_at(cf, data);
|
||||
if(result) {
|
||||
ctx->state = CF_HC_FAILURE;
|
||||
ctx->result = result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
ctx->state = CF_HC_SUCCESS;
|
||||
cf->connected = TRUE;
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue