diff --git a/CMakeLists.txt b/CMakeLists.txt index 0fa36c1b..0b9e273a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1512,6 +1512,10 @@ endif() if (NOT LWS_WITHOUT_TESTAPPS AND NOT LWS_WITHOUT_SERVER) install(FILES ${TEST_SERVER_DATA} DESTINATION share/libwebsockets-test-server + COMPONENT examples) + + install(FILES "${PROJECT_SOURCE_DIR}/test-server/private/index.html" + DESTINATION share/libwebsockets-test-server/private COMPONENT examples) if (LWS_WITH_CGI) set(CGI_TEST_SCRIPT "${PROJECT_SOURCE_DIR}/test-server/lws-cgi-test.sh") diff --git a/README.lwsws.md b/README.lwsws.md index 5ea4a2ab..da790bef 100644 --- a/README.lwsws.md +++ b/README.lwsws.md @@ -370,6 +370,36 @@ If you provide an extra mimetype entry Then any file is served, if the mimetype was not known then it is served without a Content-Type: header. +7) A mount can be protected by HTTP Basic Auth. This only makes sense when using +https, since otherwise the password can be sniffed. + +You can add a `basic-auth` entry on a mount like this` + +``` +{ + "mountpoint": "/basic-auth", + "origin": "file://_lws_ddir_/libwebsockets-test-server/private", + "basic-auth": "/var/www/balogins-private" +} +``` + +Before serving anything, lws will signal to the browser that a username / password +combination is required, and it will pop up a dialog. When the user has filled it +in, lwsws checks the user:password string against the text file named in the `basic-auth` +entry. + +The file should contain user:pass one per line + +``` +testuser:testpass +myuser:hispass +``` + +The file should be readable by lwsws, and for a little bit of extra security not +have a file suffix, so lws would reject to serve it even if it could find it on +a mount. + + @section lwswspl Lwsws Plugins Protcols and extensions may also be provided from "plugins", these are diff --git a/doc/html/functions.html b/doc/html/functions.html index f608df6c..e9f0570c 100644 --- a/doc/html/functions.html +++ b/doc/html/functions.html @@ -84,6 +84,9 @@ $(document).ready(function(){initNavTree('functions.html','');});

- b -