1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

minimal: updates

This commit is contained in:
Andy Green 2018-03-12 10:45:32 +08:00
parent aae2c24678
commit 61376bd734
27 changed files with 57 additions and 17 deletions

View file

@ -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

View file

@ -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);

View file

@ -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,

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -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,

View file

@ -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>

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -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>

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View file

@ -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,

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -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,

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -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,

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -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,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB