[Libwebsockets] v2.0 coming very soon

Andy Green andy at warmcat.com
Tue May 17 16:05:13 CEST 2016



On May 17, 2016 9:29:07 PM GMT+08:00, Andy Green <andy at warmcat.com> wrote:
>
>
>On May 17, 2016 8:43:15 PM GMT+08:00, Thomas Spitz
><thomas.spitz at hestia-france.com> wrote:
>>Everything work fine except cgitest (the test you explained here :
>>https://libwebsockets.org/pipermail/libwebsockets/2016-March/002253.html)
>
>Right, but I didn't put cgitest in the conf.d example.
>
>If I understood it, you can reproduce the conf.d example as it is fine.

I added the test cgi script to the example localhost config at /testcgi.

The test script issues headers to set the output to text/html and then sends a html table of /proc/meminfo.

Managing spawned cgis has a quirk, to make it work reliably the server process is detached from the controlling terminal when spawning the cgi.  If you run lwsws in daemon mode, which is how the systemd integration works, that doesn't make a problem and everything is normal.  But if not, it means after running the cgi, ^C from the controlling tty won't reach lwsws.  It's not that lwsws ignores it, it's not attached to the terminal any more in a way that receives the signal.

You can send it a SIGINT another way, like sudo killall -SIGINT lwsws and it will close fine.  But if you're planning on using cgi, you should run lwsws as a daemon.

There's example systemd integration provided

https://github.com/warmcat/libwebsockets/blob/master/lwsws/usr-lib-systemd-system-lwsws.service

-Andy



More information about the Libwebsockets mailing list