[Libwebsockets] How to abort connection

Andy Green andy at warmcat.com
Thu Nov 11 12:37:58 CET 2021



On 11/11/21 11:31, Søren Holm wrote:
> Hi
> 
> Is it possible to terminate a HTTP connection returning a 0 byte body.

For h1, you should be able to return -1 from the callback or close the 
connection using lws_wsi_close(wsi, LWS_TO_KILL_ASYNC); ... if it's h2, 
you might have to do an lws_write() of zero length and 
LWS_WRITE_HTTP_FINAL type.

-Andy


More information about the Libwebsockets mailing list