[Libwebsockets] [EXT] Re: Missing LWS_CALLBACK_HTTP_BODY_COMPLETION when using H2 https

Avigail Wilk awilk at kramerav.com
Thu Nov 18 11:25:04 CET 2021

This worked for me.

-----Original Message-----
From: Libwebsockets <libwebsockets-bounces at ml.libwebsockets.org> On Behalf Of Andy Green
Sent: Wednesday, November 17, 2021 4:16 PM
To: Søren Holm <sgh at sgh.dk>; libwebsockets at ml.libwebsockets.org
Subject: [EXT] Re: [Libwebsockets] Missing LWS_CALLBACK_HTTP_BODY_COMPLETION when using H2 https

On 11/17/21 12:28, Søren Holm wrote:
> Sweet - I'll kill HTTP2 for now them.
> Should I reporte hte HTTP2 in a bugreport ?

Does this solve it for you?

diff --git a/lib/roles/h2/ops-h2.c b/lib/roles/h2/ops-h2.c index a791081176..989cb5b95e 100644
--- a/lib/roles/h2/ops-h2.c
+++ b/lib/roles/h2/ops-h2.c
@@ -837,6 +837,9 @@ lws_h2_bind_for_post_before_action(struct lws *wsi)

                 if (hit->protocol)
                         name = hit->protocol;
+               else
+                       if (hit->origin_protocol == LWSMPRO_FILE)
+                               return 0;

                 pp = lws_vhost_name_to_protocol(wsi->a.vhost, name);
                 if (!pp) {

> onsdag den 17. november 2021 12.44.27 CET skrev Andy Green:
>> On 11/17/21 10:45, Søren Holm wrote:
>>> Hi
>>> I get no LWS_CALLBACK_HTTP_BODY_COMPLETION on posts over https - I 
>>> do however get that callback if I disable the ssl key and cert. 
>>> Thereby running the server in http mode.
>>> I use commandline curl for the post.
>>> The difference as I can see is that curl somehow end up using HTTP2 
>>> on https, but HTTP1.1 on regular http. Forcing curl to use HTTP1.1 
>>> on the https brings the callback back.
>>> So, is something fweird going on on H2?
>> It looks like some problem with how it is closed...
>>   >> curl: (92) HTTP/2 stream 1 was not closed cleanly before end of 
>> the
>> underlying stream
>>> Can I disable H2 completely without recompiling libwebsocket?
>> You can disable it for build at cmake with -DLWS_WITH_HTTP2=0.
>> To do it at runtime, at vhost creation time (or context creation time 
>> if you just use the default vhost), you can tell the vhost what alpn 
>> services it should offer with info->alpn.  If you leave it NULL, then 
>> it figures out what to offer based on what roles are enabled in the build.
>> In this case if you set it to "http/1.1" it will only advertise h1 to 
>> clients at tls level, even if h2 is actually available.
>> -Andy
Libwebsockets mailing list
Libwebsockets at ml.libwebsockets.org
CAUTION:This email originated from outside of the organization.
Do not click links or open attachments unless you recognize the sender and know the content is safe.

This message has been scanned for malware by Websense. www.websense.com

More information about the Libwebsockets mailing list