libwebsockets/minimal-examples-lowlevel/http-server/minimal-http-server-cgi
Albert Ribes 2cd0d9ed78 lws_http_mount: Add support for chroot and chdir in CGI mounts
All examples have been updated to provide NULL for these new fields.
2025-04-06 15:45:20 +01:00
..
CMakeLists.txt cmake: upgrade everyone to 3.5 minimum version 2023-12-08 13:23:04 +00:00
minimal-http-server.c lws_http_mount: Add support for chroot and chdir in CGI mounts 2025-04-06 15:45:20 +01:00
my-cgi-script.sh examples: move existing to m-e-lowlevel and start repoulating m-e with SS 2021-10-08 09:49:05 +01:00
README.md examples: move existing to m-e-lowlevel and start repoulating m-e with SS 2021-10-08 09:49:05 +01:00

lws minimal http server-cgi

build

 $ cmake . && make

usage

This example runs a script ./my-cgi-script.sh when you vist /

The script dumps some information from /proc on stdout, which is proxied back to the browser, script output on stderr is printed in the console.

It's able to serve the script output over h1 using chunked encoding, and over h2 having stripped the chunked encoding from the script output.

 $ ./lws-minimal-http-server-cgi
[2019/11/18 16:31:29:5481] U: LWS minimal http server | visit http://localhost:7681
[2019/11/18 16:31:40:2176] N: CGI-stderr: lwstest script stderr: REQUEST_METHOD was GET

Visit http://localhost:7681