mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-23 00:00:06 +01:00

https://github.com/warmcat/libwebsockets/issues/1423 If you vhost->options has the flag LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK, then if the server is sent an upgrade request, the content of the Host: header is required to match the vhost name + port. The port is set to the well-known values of 80 and 443 if no :port on the host: value, depending on tls or not on the connection. minimal-ws-server can now take a -h flag to set this. lejp-conf (eg, lwsws) can now take a flag strict-host-check on the vhost to enable it as well.
29 lines
700 B
Markdown
29 lines
700 B
Markdown
# lws minimal ws server
|
|
|
|
## build
|
|
|
|
```
|
|
$ cmake . && make
|
|
```
|
|
|
|
## Commandline Options
|
|
|
|
Option|Meaning
|
|
---|---
|
|
-d|Set logging verbosity
|
|
-s|Serve using TLS selfsigned cert (ie, connect to it with https://...)
|
|
-h|Strict Host: header checking against vhost name (localhost) and port
|
|
|
|
## usage
|
|
|
|
```
|
|
$ ./lws-minimal-ws-server
|
|
[2018/03/04 09:30:02:7986] USER: LWS minimal ws server | visit http://localhost:7681
|
|
[2018/03/04 09:30:02:7986] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 on
|
|
```
|
|
|
|
Visit http://localhost:7681 on multiple browser windows
|
|
|
|
Text you type in any browser window is sent to all of them.
|
|
|
|
For simplicity of this example, only one line of text is cached at the server.
|