diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c index be4b0e1c6..22a64359e 100644 --- a/lib/roles/h2/http2.c +++ b/lib/roles/h2/http2.c @@ -2133,7 +2133,7 @@ fail_length: int lws_h2_ws_handshake(struct lws *wsi) { - uint8_t buf[LWS_PRE + 384], *p = buf + LWS_PRE, *start = p, + uint8_t buf[LWS_PRE + 2048], *p = buf + LWS_PRE, *start = p, *end = &buf[sizeof(buf) - 1]; const struct lws_http_mount *hit; const char * uri_ptr; diff --git a/lib/roles/ws/server-ws.c b/lib/roles/ws/server-ws.c index 8c5f25c99..70de61be9 100644 --- a/lib/roles/ws/server-ws.c +++ b/lib/roles/ws/server-ws.c @@ -269,10 +269,7 @@ lws_process_ws_upgrade(struct lws *wsi) lws_pt_lock(pt, __func__); - if (wsi->h2_stream_carries_ws) - lws_role_transition(wsi, LWSIFR_SERVER | LWSIFR_P_ENCAP_H2, - LRS_ESTABLISHED, &role_ops_ws); - else + if (!wsi->h2_stream_carries_ws) lws_role_transition(wsi, LWSIFR_SERVER, LRS_ESTABLISHED, &role_ops_ws); @@ -406,6 +403,8 @@ lws_process_ws_upgrade(struct lws *wsi) lwsl_notice("h2 ws handshake failed\n"); return 1; } + lws_role_transition(wsi, LWSIFR_SERVER | LWSIFR_P_ENCAP_H2, + LRS_ESTABLISHED, &role_ops_ws); } else #endif {