|
@@ -3,8 +3,9 @@ Embedding CivetWeb
|
|
|
|
|
|
CivetWeb is primarily designed so applications can easily add HTTP and HTTPS server as well as WebSocket (WS and WSS) server functionality.
|
|
|
For example, a C/C++ application could use CivetWeb to enable a web service and configuration interface, to add a HTML5 data visualization interface, for automation or remote control, as a protocol gateway or as a HTTP/WebSocket client for firewall traversal.
|
|
|
+Often the easiest way to embedd CivetWeb is to add the civetweb.c file into your existing C project (see below).
|
|
|
|
|
|
-It can also be used as a stand-alone executable. It can deliver static files and offers built-in server side Lua, JavaScript and CGI support. Some instructions how to build the stand-alone server can be found in [Building.md](https://github.com/civetweb/civetweb/blob/master/docs/Building.md).
|
|
|
+CivetWeb can also be used as a stand-alone executable. It can deliver static files and offers built-in server side Lua, JavaScript and CGI support. Some instructions how to build the stand-alone server can be found in [Building.md](https://github.com/civetweb/civetweb/blob/master/docs/Building.md).
|
|
|
|
|
|
|
|
|
Files
|
|
@@ -31,6 +32,7 @@ but all functions required to run a HTTP server.
|
|
|
- src/handle\_form.inl (HTML form handling functions)
|
|
|
- src/response.inl (helper for generating HTTP response headers)
|
|
|
- src/timer.inl (optional timer support)
|
|
|
+ - src/http2.inl (optional HTTP2 support)
|
|
|
- Optional: C++ wrapper
|
|
|
- include/CivetServer.h (C++ interface)
|
|
|
- src/CivetServer.cpp (C++ wrapper implementation)
|
|
@@ -286,7 +288,7 @@ Initializing a HTTP server
|
|
|
}
|
|
|
```
|
|
|
|
|
|
-A simple callback (HTTP/1.x and HTTP/2):
|
|
|
+A simple callback (new structure supporting HTTP/1.x and HTTP/2):
|
|
|
```C
|
|
|
static int
|
|
|
handler(struct mg_connection *conn, void *ignored)
|
|
@@ -302,7 +304,7 @@ handler(struct mg_connection *conn, void *ignored)
|
|
|
}
|
|
|
```
|
|
|
|
|
|
-A simple callback supporting HTTP/1.x only:
|
|
|
+A simple callback (old structure supporting HTTP/1.x only):
|
|
|
```C
|
|
|
static int
|
|
|
handler(struct mg_connection *conn, void *ignored)
|