[Libwebsockets] Missing LWS_CALLBACK_HTTP_BODY_COMPLETION when using H2 https

Andy Green andy at warmcat.com
Wed Nov 17 12:44:27 CET 2021

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.


More information about the Libwebsockets mailing list