1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

h2: client: do not apply host header if h2 negotiated by alpn

If client negotiated over alpn, it will have done SNI.  Some
peers like youtube.com reject with 400 if you sent a host: as
well.
This commit is contained in:
Andy Green 2020-05-05 12:17:27 +01:00
parent 54e63cf75d
commit 401d6951da

View file

@ -1414,6 +1414,7 @@ lws_h2_parse_end_of_frame(struct lws *wsi)
/* pass on the initial headers to SID 1 */
h2n->swsi->http.ah = wsi->http.ah;
h2n->swsi->client_mux_substream = 1;
h2n->swsi->client_h2_alpn = 1;
#if defined(LWS_WITH_CLIENT)
h2n->swsi->flags = wsi->flags;
#endif
@ -2382,7 +2383,8 @@ lws_h2_client_handshake(struct lws *wsi)
&p, end))
goto fail_length;
if (lws_add_http_header_by_token(wsi, WSI_TOKEN_HOST,
if (!wsi->client_h2_alpn &&
lws_add_http_header_by_token(wsi, WSI_TOKEN_HOST,
(unsigned char *)lws_hdr_simple_ptr(wsi,
_WSI_TOKEN_CLIENT_HOST),
lws_hdr_total_length(wsi, _WSI_TOKEN_CLIENT_HOST),