minimal: updates
|
@ -2737,7 +2737,18 @@ lws_is_cgi(struct lws *wsi) {
|
|||
#endif
|
||||
}
|
||||
|
||||
const struct lws_protocol_vhost_options *
|
||||
lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name)
|
||||
{
|
||||
while (pvo) {
|
||||
if (!strcmp(pvo->name, name))
|
||||
break;
|
||||
|
||||
pvo = pvo->next;
|
||||
}
|
||||
|
||||
return pvo;
|
||||
}
|
||||
|
||||
#ifdef LWS_NO_EXTENSIONS
|
||||
LWS_EXTERN int
|
||||
|
|
|
@ -2346,6 +2346,17 @@ lws_adjust_protocol_psds(struct lws *wsi, size_t new_size);
|
|||
LWS_VISIBLE LWS_EXTERN int
|
||||
lws_finalize_startup(struct lws_context *context);
|
||||
|
||||
/**
|
||||
* lws_pvo_search() - helper to find a named pvo in a linked-list
|
||||
*
|
||||
* \param pvo: the first pvo in the linked-list
|
||||
* \param name: the name of the pvo to return if found
|
||||
*
|
||||
* Returns NULL, or a pointer to the name pvo in the linked-list
|
||||
*/
|
||||
const struct lws_protocol_vhost_options *
|
||||
lws_pvo_search(const struct lws_protocol_vhost_options *pvo, const char *name);
|
||||
|
||||
LWS_VISIBLE LWS_EXTERN int
|
||||
lws_protocol_init(struct lws_context *context);
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
*
|
||||
* This demonstrates a minimal multithreaded http server you can make with lws.
|
||||
*
|
||||
* To keep it simple, it serves stuff in the directory it was started in.
|
||||
* To keep it simple, it serves stuff in the subdirectory "./mount-origin" of
|
||||
* the directory it was started in.
|
||||
* You can change that by changing mount.origin.
|
||||
*
|
||||
* Also for simplicity the number of threads is set in the code... note that
|
||||
|
@ -29,7 +30,7 @@ static int interrupted;
|
|||
static const struct lws_http_mount mount = {
|
||||
/* .mount_next */ NULL, /* linked-list "next" */
|
||||
/* .mountpoint */ "/", /* mountpoint URL */
|
||||
/* .origin */ ".", /* serve from dir */
|
||||
/* .origin */ "./mount-origin", /* serve from dir */
|
||||
/* .def */ "index.html", /* default filename */
|
||||
/* .protocol */ NULL,
|
||||
/* .cgienv */ NULL,
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
@ -8,8 +8,9 @@
|
|||
*
|
||||
* This demonstrates the most minimal http server you can make with lws.
|
||||
*
|
||||
* To keep it simple, it serves stuff in the directory it was started in.
|
||||
* You can change that by changing mount.origin
|
||||
* To keep it simple, it serves stuff from the subdirectory
|
||||
* "./mount-origin" of the directory it was started in.
|
||||
* You can change that by changing mount.origin below.
|
||||
*/
|
||||
|
||||
#include <libwebsockets.h>
|
||||
|
@ -21,7 +22,7 @@ static int interrupted;
|
|||
static const struct lws_http_mount mount = {
|
||||
/* .mount_next */ NULL, /* linked-list "next" */
|
||||
/* .mountpoint */ "/", /* mountpoint URL */
|
||||
/* .origin */ ".", /* serve from dir */
|
||||
/* .origin */ "./mount-origin", /* serve from dir */
|
||||
/* .def */ "index.html", /* default filename */
|
||||
/* .protocol */ NULL,
|
||||
/* .cgienv */ NULL,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<meta charset="UTF-8">
|
||||
<html>
|
||||
<body>
|
||||
<img src="libwebsockets.org-logo.png"><br>
|
||||
<h1>404</h1>
|
||||
Sorry, that file doesn't exist.
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -4,6 +4,9 @@
|
|||
<img src="libwebsockets.org-logo.png"><br>
|
||||
|
||||
Hello from the <b>minimal http server example</b>.
|
||||
<br>
|
||||
You can confirm the 404 page handler by going to this
|
||||
nonexistant <a href="notextant.html">page</a>.
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
@ -8,8 +8,9 @@
|
|||
*
|
||||
* This demonstrates the most minimal http server you can make with lws.
|
||||
*
|
||||
* To keep it simple, it serves stuff in the directory it was started in.
|
||||
* You can change that by changing mount.origin
|
||||
* To keep it simple, it serves stuff in the subdirectory "./mount-origin" of
|
||||
* the directory it was started in.
|
||||
* You can change that by changing mount.origin.
|
||||
*/
|
||||
|
||||
#include <libwebsockets.h>
|
||||
|
@ -30,7 +31,7 @@ static int interrupted;
|
|||
static const struct lws_http_mount mount = {
|
||||
/* .mount_next */ NULL, /* linked-list "next" */
|
||||
/* .mountpoint */ "/", /* mountpoint URL */
|
||||
/* .origin */ ".", /* serve from dir */
|
||||
/* .origin */ "./mount-origin", /* serve from dir */
|
||||
/* .def */ "index.html", /* default filename */
|
||||
/* .protocol */ NULL,
|
||||
/* .cgienv */ NULL,
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
@ -8,8 +8,9 @@
|
|||
*
|
||||
* This demonstrates the most minimal http server you can make with lws.
|
||||
*
|
||||
* To keep it simple, it serves stuff in the directory it was started in.
|
||||
* You can change that by changing mount.origin
|
||||
* To keep it simple, it serves stuff in the subdirectory "./mount-origin" of
|
||||
* the directory it was started in.
|
||||
* You can change that by changing mount.origin.
|
||||
*/
|
||||
|
||||
#include <libwebsockets.h>
|
||||
|
@ -30,7 +31,7 @@ static int interrupted;
|
|||
static const struct lws_http_mount mount = {
|
||||
/* .mount_next */ NULL, /* linked-list "next" */
|
||||
/* .mountpoint */ "/", /* mountpoint URL */
|
||||
/* .origin */ ".", /* serve from dir */
|
||||
/* .origin */ "./mount-origin", /* serve from dir */
|
||||
/* .def */ "index.html", /* default filename */
|
||||
/* .protocol */ NULL,
|
||||
/* .cgienv */ NULL,
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
@ -9,8 +9,9 @@
|
|||
* This demonstrates the most minimal http server you can make with lws,
|
||||
* with an added websocket chat server using a ringbuffer.
|
||||
*
|
||||
* To keep it simple, it serves stuff in the directory it was started in.
|
||||
* You can change that by changing mount.origin
|
||||
* To keep it simple, it serves stuff in the subdirectory "./mount-origin" of
|
||||
* the directory it was started in.
|
||||
* You can change that by changing mount.origin.
|
||||
*/
|
||||
|
||||
#include <libwebsockets.h>
|
||||
|
@ -31,7 +32,7 @@ static int interrupted;
|
|||
static const struct lws_http_mount mount = {
|
||||
/* .mount_next */ NULL, /* linked-list "next" */
|
||||
/* .mountpoint */ "/", /* mountpoint URL */
|
||||
/* .origin */ ".", /* serve from dir */
|
||||
/* .origin */ "./mount-origin", /* serve from dir */
|
||||
/* .def */ "index.html", /* default filename */
|
||||
/* .protocol */ NULL,
|
||||
/* .cgienv */ NULL,
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
|
@ -9,8 +9,9 @@
|
|||
* This demonstrates the most minimal http server you can make with lws,
|
||||
* with an added websocket chat server.
|
||||
*
|
||||
* To keep it simple, it serves stuff in the directory it was started in.
|
||||
* You can change that by changing mount.origin
|
||||
* To keep it simple, it serves stuff in the subdirectory "./mount-origin" of
|
||||
* the directory it was started in.
|
||||
* You can change that by changing mount.origin.
|
||||
*/
|
||||
|
||||
#include <libwebsockets.h>
|
||||
|
@ -31,7 +32,7 @@ static int interrupted;
|
|||
static const struct lws_http_mount mount = {
|
||||
/* .mount_next */ NULL, /* linked-list "next" */
|
||||
/* .mountpoint */ "/", /* mountpoint URL */
|
||||
/* .origin */ ".", /* serve from dir */
|
||||
/* .origin */ "./mount-origin", /* serve from dir */
|
||||
/* .def */ "index.html", /* default filename */
|
||||
/* .protocol */ NULL,
|
||||
/* .cgienv */ NULL,
|
||||
|
|
BIN
minimal-examples/minimal-ws-server/mount-origin/favicon.ico
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |