[Libwebsockets] v2.0 coming very soon

Thomas Spitz thomas.spitz at hestia-france.com
Tue May 17 14:43:15 CEST 2016


Everything work fine except cgitest (the test you explained here :
https://libwebsockets.org/pipermail/libwebsockets/2016-March/002253.html)

If I compile the lib in DEBUG, the server doesn't work at all. Here below
the complete process :
thomas at thomas-laptop:~/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws$
cmake .. -DCMAKE_INSTALL_PREFIX:PATH=./ -DCMAKE_BUILD_TYPE=DEBUG
-- The C compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- CMAKE_TOOLCHAIN_FILE=''
-- Found Git: /usr/bin/git
Git commit hash: thomas at thomas-laptop-v2.0.0-44-g81a5a12
-- LWS_WITH_LWSWS --> Enabling LWS_WITH_PLUGINS and LWS_WITH_LIBUV
-- Performing Test LWS_HAVE_inline
-- Performing Test LWS_HAVE_inline - Success
-- Performing Test LWS_HAVE___inline__
-- Performing Test LWS_HAVE___inline__ - Success
-- Performing Test LWS_HAVE___inline
-- Performing Test LWS_HAVE___inline - Success
-- Looking for bzero
-- Looking for bzero - found
-- Looking for fork
-- Looking for fork - found
-- Looking for getenv
-- Looking for getenv - found
-- Looking for malloc
-- Looking for malloc - found
-- Looking for memset
-- Looking for memset - found
-- Looking for realloc
-- Looking for realloc - found
-- Looking for socket
-- Looking for socket - found
-- Looking for strerror
-- Looking for strerror - found
-- Looking for vfork
-- Looking for vfork - found
-- Looking for execvpe
-- Looking for execvpe - found
-- Looking for getifaddrs
-- Looking for getifaddrs - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for _snprintf
-- Looking for _snprintf - not found
-- Looking for _vsnprintf
-- Looking for _vsnprintf - not found
-- Looking for getloadavg
-- Looking for getloadavg - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for in6addr.h
-- Looking for in6addr.h - not found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for netinet/in.h
-- Looking for netinet/in.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for sys/prctl.h
-- Looking for sys/prctl.h - found
-- Looking for sys/socket.h
-- Looking for sys/socket.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for vfork.h
-- Looking for vfork.h - not found
-- Looking for zlib.h
-- Looking for zlib.h - found
-- Looking for 4 include files stdlib.h, ..., float.h
-- Looking for 4 include files stdlib.h, ..., float.h - found
-- Performing Test LWS_HAVE_VISIBILITY
-- Performing Test LWS_HAVE_VISIBILITY - Success
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8")
zlib include dirs: /usr/include
zlib libraries: /usr/lib/x86_64-linux-gnu/libz.so
Compiling with SSL support
-- Found OpenSSL:
/usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so
(found version "1.0.1f")
OpenSSL include dir: /usr/include
OpenSSL libraries:
/usr/lib/x86_64-linux-gnu/libssl.so;/usr/lib/x86_64-linux-gnu/libcrypto.so
-- Looking for openssl/ecdh.h
-- Looking for openssl/ecdh.h - found
libuv include dir: /usr/local/include
libuv libraries: /usr/local/lib/libuv.so
-- Looking for SSL_CTX_set1_param
-- Looking for SSL_CTX_set1_param - found
Searching for OpenSSL executable and dlls
OpenSSL executable: /usr/bin/openssl
Generating SSL Certificates for the test-server...
SUCCESSFULLY generated SSL certificate
Generating API documentation
-- Looking for RPMTools... - found rpmuild is /usr/bin/rpmbuild
-- RPMTools:: Using
RPM_ROOTDIR=/home/thomas/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws/RPM
-- Simple copy spec file <libwebsockets.spec> -->
</home/thomas/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws/RPM/SPECS/libwebsockets.spec>
---------------------------------------------------------------------
  Settings:  (For more help do cmake -LH <srcpath>)
---------------------------------------------------------------------
 LWS_WITH_STATIC = ON
 LWS_WITH_SHARED = ON
 LWS_WITH_SSL = ON (SSL Support)
 LWS_SSL_CLIENT_USE_OS_CA_CERTS = 1
 LWS_USE_WOLFSSL = OFF (wolfSSL/CyaSSL replacement for OpenSSL)
 LWS_USE_POLARSSL = OFF (PolarSSL replacement for OpenSSL)
 LWS_USE_MBEDTLS = OFF (mbedtls (nee Polarssl) replacement for OpenSSL)
 LWS_WITHOUT_BUILTIN_SHA1 = ON
 LWS_WITHOUT_BUILTIN_GETIFADDRS = ON
 LWS_WITHOUT_CLIENT = ON
 LWS_WITHOUT_SERVER = OFF
 LWS_LINK_TESTAPPS_DYNAMIC = OFF
 LWS_WITHOUT_TESTAPPS = OFF
 LWS_WITHOUT_TEST_SERVER = OFF
 LWS_WITHOUT_TEST_SERVER_EXTPOLL = ON
 LWS_WITHOUT_TEST_PING = ON
 LWS_WITHOUT_TEST_ECHO = ON
 LWS_WITHOUT_TEST_CLIENT = ON
 LWS_WITHOUT_TEST_FRAGGLE = ON
 LWS_WITHOUT_EXTENSIONS = OFF
 LWS_WITH_LATENCY = OFF
 LWS_WITHOUT_DAEMONIZE = ON
 LWS_USE_LIBEV =
 LWS_USE_LIBUV = 1
 LWS_IPV6 = OFF
 LWS_UNIX_SOCK = OFF
 LWS_WITH_HTTP2 = OFF
 LWS_MBED3 = OFF
 LWS_SSL_SERVER_WITH_ECDH_CERT = OFF
 LWS_MAX_SMP = 32
 LWS_WITH_CGI = ON
 LWS_HAVE_OPENSSL_ECDH_H = 1
 LWS_HAVE_SSL_CTX_set1_param = 1
 LWS_WITH_HTTP_PROXY = OFF
 LIBHUBBUB_LIBRARIES =
 PLUGINS =
protocol_dumb_increment;protocol_lws_mirror;protocol_lws_status;protocol_post_demo;protocol_lws_server_status
 LWS_WITH_ACCESS_LOG = 1
 LWS_WITH_SERVER_STATUS = 1
 LWS_WITH_LEJP = 1
---------------------------------------------------------------------
-- Configuring done
-- Generating done
-- Build files have been written to:
/home/thomas/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws
thomas at thomas-laptop:~/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws$
make
Scanning dependencies of target websockets_shared
[  1%] Building C object
CMakeFiles/websockets_shared.dir/lib/base64-decode.c.o
[  3%] Building C object CMakeFiles/websockets_shared.dir/lib/handshake.c.o
[  4%] Building C object
CMakeFiles/websockets_shared.dir/lib/libwebsockets.c.o
[  6%] Building C object CMakeFiles/websockets_shared.dir/lib/service.c.o
[  7%] Building C object CMakeFiles/websockets_shared.dir/lib/pollfd.c.o
[  9%] Building C object CMakeFiles/websockets_shared.dir/lib/output.c.o
[ 10%] Building C object CMakeFiles/websockets_shared.dir/lib/parsers.c.o
[ 12%] Building C object CMakeFiles/websockets_shared.dir/lib/context.c.o
[ 13%] Building C object CMakeFiles/websockets_shared.dir/lib/alloc.c.o
[ 15%] Building C object CMakeFiles/websockets_shared.dir/lib/header.c.o
[ 16%] Building C object CMakeFiles/websockets_shared.dir/lib/ssl.c.o
[ 18%] Building C object CMakeFiles/websockets_shared.dir/lib/ssl-server.c.o
[ 20%] Building C object
CMakeFiles/websockets_shared.dir/lib/lws-plat-unix.c.o
[ 21%] Building C object CMakeFiles/websockets_shared.dir/lib/server.c.o
[ 23%] Building C object
CMakeFiles/websockets_shared.dir/lib/server-handshake.c.o
[ 24%] Building C object CMakeFiles/websockets_shared.dir/lib/extension.c.o
[ 26%] Building C object
CMakeFiles/websockets_shared.dir/lib/extension-permessage-deflate.c.o
[ 27%] Building C object CMakeFiles/websockets_shared.dir/lib/libuv.c.o
[ 29%] Building C object CMakeFiles/websockets_shared.dir/lib/lejp.c.o
Linking C shared library lib/libwebsockets.so
[ 29%] Built target websockets_shared
Scanning dependencies of target lwsws
[ 30%] Building C object CMakeFiles/lwsws.dir/lwsws/main.c.o
[ 32%] Building C object CMakeFiles/lwsws.dir/lwsws/conf.c.o
Linking C executable bin/lwsws
[ 32%] Built target lwsws
Scanning dependencies of target protocol_dumb_increment
[ 33%] Building C object
CMakeFiles/protocol_dumb_increment.dir/plugins/protocol_dumb_increment.c.o
Linking C shared library lib/libprotocol_dumb_increment.so
[ 33%] Built target protocol_dumb_increment
Scanning dependencies of target protocol_lws_mirror
[ 35%] Building C object
CMakeFiles/protocol_lws_mirror.dir/plugins/protocol_lws_mirror.c.o
Linking C shared library lib/libprotocol_lws_mirror.so
[ 35%] Built target protocol_lws_mirror
Scanning dependencies of target protocol_lws_server_status
[ 36%] Building C object
CMakeFiles/protocol_lws_server_status.dir/plugins/protocol_lws_server_status.c.o
Linking C shared library lib/libprotocol_lws_server_status.so
[ 36%] Built target protocol_lws_server_status
Scanning dependencies of target protocol_lws_status
[ 38%] Building C object
CMakeFiles/protocol_lws_status.dir/plugins/protocol_lws_status.c.o
Linking C shared library lib/libprotocol_lws_status.so
[ 38%] Built target protocol_lws_status
Scanning dependencies of target protocol_post_demo
[ 40%] Building C object
CMakeFiles/protocol_post_demo.dir/plugins/protocol_post_demo.c.o
Linking C shared library lib/libprotocol_post_demo.so
[ 40%] Built target protocol_post_demo
Scanning dependencies of target websockets
[ 41%] Building C object CMakeFiles/websockets.dir/lib/base64-decode.c.o
[ 43%] Building C object CMakeFiles/websockets.dir/lib/handshake.c.o
[ 44%] Building C object CMakeFiles/websockets.dir/lib/libwebsockets.c.o
[ 46%] Building C object CMakeFiles/websockets.dir/lib/service.c.o
[ 47%] Building C object CMakeFiles/websockets.dir/lib/pollfd.c.o
[ 49%] Building C object CMakeFiles/websockets.dir/lib/output.c.o
[ 50%] Building C object CMakeFiles/websockets.dir/lib/parsers.c.o
[ 52%] Building C object CMakeFiles/websockets.dir/lib/context.c.o
[ 53%] Building C object CMakeFiles/websockets.dir/lib/alloc.c.o
[ 55%] Building C object CMakeFiles/websockets.dir/lib/header.c.o
[ 56%] Building C object CMakeFiles/websockets.dir/lib/ssl.c.o
[ 58%] Building C object CMakeFiles/websockets.dir/lib/ssl-server.c.o
[ 60%] Building C object CMakeFiles/websockets.dir/lib/lws-plat-unix.c.o
[ 61%] Building C object CMakeFiles/websockets.dir/lib/server.c.o
[ 63%] Building C object CMakeFiles/websockets.dir/lib/server-handshake.c.o
[ 64%] Building C object CMakeFiles/websockets.dir/lib/extension.c.o
[ 66%] Building C object
CMakeFiles/websockets.dir/lib/extension-permessage-deflate.c.o
[ 67%] Building C object CMakeFiles/websockets.dir/lib/libuv.c.o
[ 69%] Building C object CMakeFiles/websockets.dir/lib/lejp.c.o
Linking C static library lib/libwebsockets.a
[ 69%] Built target websockets
Scanning dependencies of target test-fuzxy
[ 70%] Building C object CMakeFiles/test-fuzxy.dir/test-server/fuzxy.c.o
Linking C executable bin/libwebsockets-test-fuzxy
[ 70%] Built target test-fuzxy
Scanning dependencies of target test-server
[ 72%] Building C object
CMakeFiles/test-server.dir/test-server/test-server.c.o
[ 73%] Building C object
CMakeFiles/test-server.dir/test-server/test-server-http.c.o
[ 75%] Building C object
CMakeFiles/test-server.dir/test-server/test-server-dumb-increment.c.o
[ 76%] Building C object
CMakeFiles/test-server.dir/test-server/test-server-mirror.c.o
[ 78%] Building C object
CMakeFiles/test-server.dir/test-server/test-server-status.c.o
[ 80%] Building C object
CMakeFiles/test-server.dir/test-server/test-server-echogen.c.o
Linking C executable bin/libwebsockets-test-server
[ 80%] Built target test-server
Scanning dependencies of target test-server-libuv
[ 81%] Building C object
CMakeFiles/test-server-libuv.dir/test-server/test-server-libuv.c.o
[ 83%] Building C object
CMakeFiles/test-server-libuv.dir/test-server/test-server-http.c.o
[ 84%] Building C object
CMakeFiles/test-server-libuv.dir/test-server/test-server-dumb-increment.c.o
[ 86%] Building C object
CMakeFiles/test-server-libuv.dir/test-server/test-server-mirror.c.o
[ 87%] Building C object
CMakeFiles/test-server-libuv.dir/test-server/test-server-status.c.o
[ 89%] Building C object
CMakeFiles/test-server-libuv.dir/test-server/test-server-echogen.c.o
Linking C executable bin/libwebsockets-test-server-libuv
[ 89%] Built target test-server-libuv
Scanning dependencies of target test-server-pthreads
[ 90%] Building C object
CMakeFiles/test-server-pthreads.dir/test-server/test-server-pthreads.c.o
[ 92%] Building C object
CMakeFiles/test-server-pthreads.dir/test-server/test-server-http.c.o
[ 93%] Building C object
CMakeFiles/test-server-pthreads.dir/test-server/test-server-dumb-increment.c.o
[ 95%] Building C object
CMakeFiles/test-server-pthreads.dir/test-server/test-server-mirror.c.o
[ 96%] Building C object
CMakeFiles/test-server-pthreads.dir/test-server/test-server-status.c.o
[ 98%] Building C object
CMakeFiles/test-server-pthreads.dir/test-server/test-server-echogen.c.o
Linking C executable bin/libwebsockets-test-server-pthreads
[ 98%] Built target test-server-pthreads
Scanning dependencies of target test-server-v2.0
[100%] Building C object
CMakeFiles/test-server-v2.0.dir/test-server/test-server-v2.0.c.o
Linking C executable bin/libwebsockets-test-server-v2.0
[100%] Built target test-server-v2.0
thomas at thomas-laptop:~/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws$
cd bin
thomas at thomas-laptop:~/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws/bin$
sudo valgrind ./lwsws
[sudo] password for thomas:
==4669== Memcheck, a memory error detector
==4669== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==4669== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==4669== Command: ./lwsws
==4669==
lwsws[4669]: lwsws libwebsockets web server - license GPL2.1
lwsws[4669]: (C) Copyright 2010-2016 Andy Green <andy at warmcat.com>
lwsws[4669]: Using config dir: "/etc/lwsws/conf.d"
lwsws[4669]: Initial logging level 7
lwsws[4669]: Libwebsockets version: 2.0.0
thomas at thomas-laptop-v2.0.0-44-g81a5a12
lwsws[4669]: IPV6 not compiled in
lwsws[4669]: libev support not compiled in
lwsws[4669]: libuv support compiled in and enabled
lwsws[4669]:  Threads: 1 each 1024 fds
lwsws[4669]:  mem: platform fd map:  8192 bytes
lwsws[4669]:   Plugins:
lwsws[4669]:   Scanning ./share/libwebsockets-test-server/plugins/
lwsws[4669]:    libprotocol_dumb_increment.so
lwsws[4669]:    libprotocol_lws_mirror.so
lwsws[4669]:    libprotocol_lws_server_status.so
lwsws[4669]:    libprotocol_lws_status.so
lwsws[4669]:    libprotocol_post_demo.so
lwsws[4669]:  Compiled with OpenSSL support
lwsws[4669]:  mem: per-conn:          680 bytes + protocol rx buf
lwsws[4669]:  canonical_hostname = thomas-laptop
==4669== Conditional jump or move depends on uninitialised value(s)
==4669==    at 0x54F0A03: vfprintf (vfprintf.c:1661)
==4669==    by 0x5517578: vsnprintf (vsnprintf.c:119)
==4669==    by 0x54F9531: snprintf (snprintf.c:33)
==4669==    by 0x402A7D: lejp_vhosts_cb (conf.c:473)
==4669==    by 0x4E59F42: lejp_parse (lejp.c:625)
==4669==    by 0x402BE0: lwsws_get_config (conf.c:504)
==4669==    by 0x402D8A: lwsws_get_config_d (conf.c:540)
==4669==    by 0x4030F6: lwsws_get_config_vhosts (conf.c:662)
==4669==    by 0x401960: main (main.c:173)
==4669==
lwsws[4669]: unsupported protocol:// er-status
lwsws[4669]: unsupported protocol:// gi-test.sh
lwsws[4669]:   adding protocol dumb-increment-protocol
lwsws[4669]:   adding protocol lws-mirror-protocol
lwsws[4669]:   adding protocol lws-status
lwsws[4669]:   adding protocol protocol-post-demo
lwsws[4669]:   adding protocol lws-server-status
lwsws[4669]: Creating Vhost 'localhost' port 7681, 6 protocols
lwsws[4669]:    mounting
file:///home/thomas/workspace/MyProgram/0_librairies_sources/libwebsockets/buildPC-lwsws/bin/share/libwebsockets-test-server
to /
lwsws[4669]:    mounting callback://protocol-post-demo to /formtest
==4669== Invalid read of size 1
==4669==    at 0x54F0A03: vfprintf (vfprintf.c:1661)
==4669==    by 0x5517578: vsnprintf (vsnprintf.c:119)
==4669==    by 0x4E40D1E: _lws_logv (libwebsockets.c:1198)
==4669==    by 0x4E40DF6: _lws_log (libwebsockets.c:1209)
==4669==    by 0x4E4BF36: lws_create_vhost (context.c:381)
==4669==    by 0x4020A7: lejp_vhosts_cb (conf.c:279)
==4669==    by 0x4E59D8E: lejp_parse (lejp.c:589)
==4669==    by 0x402BE0: lwsws_get_config (conf.c:504)
==4669==    by 0x402D8A: lwsws_get_config_d (conf.c:540)
==4669==    by 0x4030F6: lwsws_get_config_vhosts (conf.c:662)
==4669==    by 0x401960: main (main.c:173)
==4669==  Address 0x18 is not stack'd, malloc'd or (recently) free'd
==4669==
==4669==
==4669== Process terminating with default action of signal 11 (SIGSEGV)
==4669==  Access not within mapped region at address 0x18
==4669==    at 0x54F0A03: vfprintf (vfprintf.c:1661)
==4669==    by 0x5517578: vsnprintf (vsnprintf.c:119)
==4669==    by 0x4E40D1E: _lws_logv (libwebsockets.c:1198)
==4669==    by 0x4E40DF6: _lws_log (libwebsockets.c:1209)
==4669==    by 0x4E4BF36: lws_create_vhost (context.c:381)
==4669==    by 0x4020A7: lejp_vhosts_cb (conf.c:279)
==4669==    by 0x4E59D8E: lejp_parse (lejp.c:589)
==4669==    by 0x402BE0: lwsws_get_config (conf.c:504)
==4669==    by 0x402D8A: lwsws_get_config_d (conf.c:540)
==4669==    by 0x4030F6: lwsws_get_config_vhosts (conf.c:662)
==4669==    by 0x401960: main (main.c:173)
==4669==  If you believe this happened as a result of a stack
==4669==  overflow in your program's main thread (unlikely but
==4669==  possible), you can try to increase the size of the
==4669==  main thread stack using the --main-stacksize= flag.
==4669==  The main thread stack size used in this run was 8388608.
==4669==
==4669== HEAP SUMMARY:
==4669==     in use at exit: 281,601 bytes in 3,120 blocks
==4669==   total heap usage: 3,322 allocs, 202 frees, 670,257 bytes
allocated
==4669==
==4669== LEAK SUMMARY:
==4669==    definitely lost: 0 bytes in 0 blocks
==4669==    indirectly lost: 0 bytes in 0 blocks
==4669==      possibly lost: 0 bytes in 0 blocks
==4669==    still reachable: 281,601 bytes in 3,120 blocks
==4669==         suppressed: 0 bytes in 0 blocks
==4669== Rerun with --leak-check=full to see details of leaked memory
==4669==
==4669== For counts of detected and suppressed errors, rerun with: -v
==4669== Use --track-origins=yes to see where uninitialised values come from
==4669== ERROR SUMMARY: 3 errors from 2 contexts (suppressed: 0 from 0)

Best regards,
Thomas



2016-05-17 12:44 GMT+02:00 Andy Green <andy at warmcat.com>:

>
>
> On May 17, 2016 6:20:30 PM GMT+08:00, Thomas Spitz <
> thomas.spitz at hestia-france.com> wrote:
> >Hello Andy,
> >
> >Thanks for the new simplified etc-lwsws-conf.d-localhost-EXAMPLE. For
> >your
> >info, as SSL is commented (I suppose),
> >http://localhost:7681/server-status
> >redirects to the same page but in SSL.. Thus it doesn't work except if
> >we
> >call directly http://localhost:7681/server-status.html (I had to copy
> >server-status.html
> >into share/libwebsockets-test-server/)
>
> I'm not sure what that's about, there's no such redirect in the example
> conf
>
>
> https://github.com/warmcat/libwebsockets/blob/master/lwsws/etc-lwsws-conf.d-localhost-EXAMPLE
>
> I wonder if the problem is previously you had STS enabled, that is sticky
> and causes your browser the subsequently force the connection the the same
> host to be https.
>
> Either that or you have other conf files defining it in /etc/lwsws/conf.d,
> not just the example one.
>
> I think you should first make sure if you just use the example in conf.d
> as they are, everything is correct for the test page, because that is what
> it is supposed to do, and I have the conf so I can also check it.  If you
> can confirm that, you can add your additional stuff.
>
> So let's check just the example stuff alone first.
>
> >I'm also trying to use your cgitest script adding the following line in
> >bold in etc-lwsws-conf.d-localhost-EXAMPLE:
> >
> >> {
> >>
> >>  "vhosts": [ {
> >>      "name": "localhost",
> >>      "port": "7681",
> >>      "interface": "lo",
> >> #     "host-ssl-key":  "/etc/pki/tls/private/libwebsockets.org.key",
> >> #     "host-ssl-cert": "/etc/pki/tls/certs/libwebsockets.org.crt",
> >> #     "host-ssl-ca":   "/etc/pki/tls/certs/libwebsockets.org.cer",
> >>      "access-log": "/var/log/lwsws/test-access-log",
> >> #     "sts": "on",
> >>      "mounts": [{
> >>        "mountpoint": "/",
> >>        "origin":
> >>
>
> >"file:///home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/share/libwebsockets-test-server",
>
> If you are running lwsws as root and telling it to drop privs to 'apache'
> as in the example, you will face a problem 'apache' does not have rights to
> go in /home/thomas.
>
> Apache can go in /usr/share typically, so you might want to install things
> there.
>
> >>        "default": "test.html",
> >>        "cache-max-age": "60",
> >>        "cache-reuse": "1",
> >>        "cache-revalidate": "1",
> >>        "cache-intermediaries": "0"
> >>        }, {
> >> #semble ne pas fonctionner car nécessite SSL
> >>         "mountpoint": "/server-status",
> >>         "origin":
> >>
>
> >"file:///home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/share/libwebsockets-test-server/server-status",
> >>         "default": "server-status.html"
> >>        }, {
> >>         "mountpoint": "/formtest",
> >>         "origin": "callback://protocol-post-demo"
> >>        }
> >>
> >>
> >> *,{        "mountpoint": "/cgitest",        "origin":
> >>
>
> >"cgi:///home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/share/libwebsockets-test-server/lws-cgi-test.sh"
> >>      }*],
> >>      # which protocols are enabled for this vhost, and optional
> >>      # vhost-specific config options for the protocol
> >>      #
> >>      "ws-protocols": [{
> >>        "dumb-increment-protocol": {
> >>          "status": "ok"
> >>        },
> >>        "lws-mirror-protocol": {
> >>          "status": "ok"
> >>        },
> >>        "lws-status": {
> >>          "status": "ok"
> >>        },
> >>        "protocol-post-demo": {
> >>          "status": "ok"
> >>        },
> >>        "lws-server-status": {
> >>          "status": "ok",
> >> "update-ms": "5000"
> >>        }
> >>      }]
> >>     },
> >> # redirect any guys coming in on http:8080 to http:7681
> >>     {
> >>      "name": "localhost",
> >>      "port": "8080",
> >> #     "sts": "on",
> >>      "mounts": [{
> >>        "mountpoint": "/",
> >>        "origin": ">http://localhost:7681"
> >>      }]
> >> }
> >>   ]
> >> }
> >>
> >> But I only get 404 error pae.
> >Here below in bold two stange lines in valgrind lwsws debug (file names
> >seem truncated):
> >
> >> sudo valgrind ./lwsws
> >> ==1678== Memcheck, a memory error detector
> >> ==1678== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et
> >al.
> >> ==1678== Using Valgrind-3.10.1 and LibVEX; rerun with -h for
> >copyright info
> >> ==1678== Command: ./lwsws
> >> ==1678==
> >> lwsws[1678]: lwsws libwebsockets web server - license GPL2.1
> >> lwsws[1678]: (C) Copyright 2010-2016 Andy Green <andy at warmcat.com>
> >> lwsws[1678]: Using config dir: "/etc/lwsws/conf.d"
> >> lwsws[1678]: Initial logging level 7
> >> lwsws[1678]: Libwebsockets version: *2.0.0*
> >> thomas at thomas-laptop-v2.0.0-44-g81a5a12
>
> The -44 here means "44 patches ahead of 2.0.0"
>
> >> lwsws[1678]: IPV6 not compiled in
> >> lwsws[1678]: libev support not compiled in
> >> lwsws[1678]: libuv support compiled in and enabled
> >> lwsws[1678]:  Threads: 1 each 1024 fds
> >> lwsws[1678]:  mem: platform fd map:  8192 bytes
> >> lwsws[1678]:   Plugins:
> >> lwsws[1678]:   Scanning ./share/libwebsockets-test-server/plugins/
> >> lwsws[1678]:    libprotocol_dumb_increment.so
> >> lwsws[1678]:    libprotocol_lws_mirror.so
> >> lwsws[1678]:    libprotocol_lws_server_status.so
> >> lwsws[1678]:    libprotocol_lws_status.so
> >> lwsws[1678]:    libprotocol_post_demo.so
> >> lwsws[1678]:  Compiled with OpenSSL support
> >> lwsws[1678]:  mem: per-conn:          680 bytes + protocol rx buf
> >> lwsws[1678]:  canonical_hostname = thomas-laptop
> >> ==1678== Conditional jump or move depends on uninitialised value(s)
> >> ==1678==    at 0x54E5A03: vfprintf (vfprintf.c:1661)
> >> ==1678==    by 0x550C578: vsnprintf (vsnprintf.c:119)
> >> ==1678==    by 0x54EE531: snprintf (snprintf.c:33)
> >> ==1678==    by 0x401EC2: lejp_vhosts_cb (in
> >> /home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/lwsws)
> >> ==1678==    by 0x4E4FD13: lejp_parse (in
> >>
> >/home/thomas/workspace/libwebsockets/buildPC-lwsws/lib/libwebsockets.so.8)
> >> ==1678==    by 0x402D4C: lwsws_get_config_vhosts (in
> >> /home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/lwsws)
> >> ==1678==    by 0x401677: main (in
> >> /home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/lwsws)
>
> Can you build lws + lwsws in debug mode so I can see the line numbers?
>
> cmake .. -DCMAKE_BUILD_TYPE=DEBUG
>
> I guess what happened is lejp string limit is too small for your
> unexpectedly big filenames.
>
> >> ==1678==
> >> lwsws[1678]: unsupported protocol:// er-status
> >> lwsws[1678]: unsupported protocol:// gi-test.sh
> >> lwsws[1678]:   adding protocol dumb-increment-protocol
> >> lwsws[1678]:   adding protocol lws-mirror-protocol
> >> lwsws[1678]:   adding protocol lws-status
> >> lwsws[1678]:   adding protocol protocol-post-demo
> >> lwsws[1678]:   adding protocol lws-server-status
> >> lwsws[1678]: Creating Vhost 'localhost' port 7681, 6 protocols
> >> lwsws[1678]:    mounting
> >>
>
> >file:///home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/share/libwebsockets-test-server
> >> to /
> >> lwsws[1678]:    mounting callback://protocol-post-demo to /formtest
> >> lwsws[1678]:    mounting server:dumb-increment-protocol to
> >> lwsws[1678]:  Using non-SSL mode
> >> lwsws[1678]: Creating Vhost 'localhost' port 8080, 1 protocols
> >> lwsws[1678]:    mounting >http://localhost:7681 to /
> >> lwsws[1678]:  Using non-SSL mode
> >>
> >> *lwsws[1678]: unsupported protocol:// er-statuslwsws[1678]:
> >unsupported
> >> protocol:// gi-test.sh*
> >> lwsws[1678]:   adding protocol dumb-increment-protocol
> >> lwsws[1678]:   adding protocol lws-mirror-protocol
> >> lwsws[1678]:   adding protocol lws-status
> >> lwsws[1678]:   adding protocol protocol-post-demo
> >> lwsws[1678]:   adding protocol lws-server-status
> >> lwsws[1678]: Creating Vhost 'localhost' port 7681, 6 protocols
> >> lwsws[1678]:    mounting
> >>
>
> >file:///home/thomas/workspace/libwebsockets/buildPC-lwsws/bin/share/libwebsockets-test-server
> >> to /
> >> lwsws[1678]:    mounting callback://protocol-post-demo to /formtest
> >> lwsws[1678]:    mounting http://dumb-increment-protocol to
> >> lwsws[1678]:  Using non-SSL mode
> >> lwsws[1678]:  using listen skt from vhost localhost
> >> lwsws[1678]: Creating Vhost 'localhost' port 8080, 1 protocols
> >> lwsws[1678]:    mounting >http://localhost:7681 to /
> >> lwsws[1678]:  Using non-SSL mode
> >> lwsws[1678]:  using listen skt from vhost localhost
> >> lwsws[1678]: getpwuid: unable to find uid 48
> >> lwsws[1678]: lws_protocol_init
> >> lwsws[1678]:     vh localhost prot protocol-post-demo opt status
> >> lwsws[1678]:     vh localhost prot lws-status opt status
> >> lwsws[1678]:     vh localhost prot lws-server-status opt update-ms
> >> lwsws[1678]:     vh localhost prot lws-server-status opt status
> >> lwsws[1678]:     vh localhost prot lws-mirror-protocol opt status
> >> lwsws[1678]:     vh localhost prot dumb-increment-protocol opt status
> >> lwsws[1678]:     vh localhost prot protocol-post-demo opt status
> >> lwsws[1678]:     vh localhost prot lws-status opt status
> >> lwsws[1678]:     vh localhost prot lws-server-status opt update-ms
> >> lwsws[1678]:     vh localhost prot lws-server-status opt status
> >> lwsws[1678]:     vh localhost prot lws-mirror-protocol opt status
> >> lwsws[1678]:     vh localhost prot dumb-increment-protocol opt status
> >> lwsws[1678]:  permessage-deflate requires the protocol
> >> (dumb-increment-protocol) to have an RX buffer >= 128
> >> lwsws[1678]: ext permessage-deflate failed construction
> >> lwsws[1678]:  Capping pmd rx to 128
> >> lwsws[1678]: cache_len 318
> >> lwsws[1678]:  Capping pmd rx to 128
> >> lwsws[1678]: cache_len 112
> >
> >
> >By the way I am using last git version (2.0.0 should be changed in
> >Cmake ?)
>
> No master branch continues from the last major release.  The release won't
> change until 2.1, because it's in development, not a release.
>
> You can use the other info to track it, -44 if how many patches on top,
> and gxxxxxx is the git hash last time cmake was run.
>
> -Andy
>
> >Best regards,
> >Thomas
> >
> >
> >2016-05-17 3:02 GMT+02:00 Andy Green <andy at warmcat.com>:
> >
> >>
> >>
> >> On 05/16/2016 07:34 PM, Thomas Spitz wrote:
> >>
> >>> Hello Andy,
> >>>
> >>> Even if I think option 1 will better suit my final need (Everything
> >>> compiled in one project), I'm trying to test the second option
> >>> (Replacing my whole server app with lwsws using JSON config files
> >and
> >>> compile my app as plugins).
> >>>
> >>> Therefore I created /etc/lwsws/conf and /etc/lwsws/cond/d/localhost
> >>> files. Do you have a localhost file corresponding to test-server
> >example
> >>> (etc-lwsws-conf.d-localhost-EXAMPLE seems unrelated to test-server)?
> >>>
> >>
> >> Sorry this is a very reasonable question I missed last night.
> >>
> >> I have added a patch on master that changes the example config to
> >match
> >> the old test server, and adds how to set it up in README.lwsws.md
> >>
> >>
> >>
> >
> https://github.com/warmcat/libwebsockets/commit/34b8161e04ffd1f6506bfc9014b649625e8c5212
> >>
> >> That should just work then as before (port 7681, no SSL).
> >>
> >> You can both meddle with that file, and also add cut-and-pastes of it
> >with
> >> different "port" to a different file in
> >/etc/lwsws/conf.d/something-else
> >> that will also exist in lwsws alongside the sample config.
> >>
> >> -Andy
> >>
> >>
> >> I also copied all libprotocol_* files from /build/lib to
> >>> build/bin/share/libwebsockets-test-server/plugins/ but I got the
> >>> following error when launching lwsws
> >>>
> >>>     lwsws[22220]: lwsws libwebsockets web server - license GPL2.1
> >>>     lwsws[22220]: (C) Copyright 2010-2016 Andy Green
> ><andy at warmcat.com
> >>>     <mailto:andy at warmcat.com>>
> >>>     lwsws[22220]: Using config dir: "/etc/lwsws/conf.d"
> >>>     lwsws[22220]: Initial logging level 7
> >>>     lwsws[22220]: Libwebsockets version: 2.0.0 thomas at thomas-laptop-
> >>>     lwsws[22220]: IPV6 not compiled in
> >>>     lwsws[22220]: libev support not compiled in
> >>>     lwsws[22220]: libuv support compiled in and enabled
> >>>     lwsws[22220]:  Threads: 1 each 1024 fds
> >>>     lwsws[22220]:  mem: platform fd map:  8192 bytes# mkdir -p
> >>> /etc/lwsws/conf.d /var/log/lwsws
> >>>
> >> # cp ./lwsws/etc-lwsws-conf-EXAMPLE /etc/lwsws/conf
> >> # cp ./lwsws/etc-lwsws-conf.d-localhost-EXAMPLE
> >> /etc/lwsws/conf.d/test-server
> >> # sudo lwsws
> >>
> >>>     lwsws[22220]:   Plugins:
> >>>     lwsws[22220]:    libprotocol_client_loopback_test.so
> >>>     lwsws[22220]:    libprotocol_dumb_increment.so
> >>>     lwsws[22220]:    libprotocol_lws_mirror.so
> >>>     lwsws[22220]:    libprotocol_lws_server_status.so
> >>>     lwsws[22220]:    libprotocol_lws_status.so
> >>>     lwsws[22220]:    libprotocol_post_demo.so
> >>>     *** Error in `./lwsws': double free or corruption (fasttop):
> >>>     0x0000000001e9a380 ***
> >>>     Aborted (core dumped)
> >>>
> >>> I understand the global philosophy of lwsws 2.0 and plugins but I
> >>> haven't yest understood how to implement it simply.
> >>>
> >>> Best regards,
> >>> Thomas
> >>>
> >>> 2016-04-24 20:20 GMT+02:00 Andy Green <andy at warmcat.com
> >>> <mailto:andy at warmcat.com>>:
> >>>
> >>>
> >>>
> >>>     On April 24, 2016 9:28:32 PM GMT+08:00, Thomas Spitz
> >>>     <thomas.spitz at hestia-france.com
> >>>     <mailto:thomas.spitz at hestia-france.com>> wrote:
> >>>      >Hello Andy, hello everyone,
> >>>
> >>>     (adding back the ml)
> >>>
> >>>     >I have looked at the new features you have introduced and I
> >wonder
> >>>     >whether
> >>>     >this could solve one of the old issue we discussed in the
> >following
> >>>     >posts :
> >>>     >
> >>>
> >
> https://libwebsockets.org/pipermail/libwebsockets/2016-January/002164.html
> >>>     >
> >>>
> >
> https://libwebsockets.org/pipermail/libwebsockets/2014-September/001355.html
> >>>     >
> >>>     >To make it clearer, here is my application :
> >>>     >At the present, I use libwebsocket on an embedded linux (1core
> >450MHz
> >>>     >ARM)
> >>>     >mainly to communicate (two-way communication) in real time
> >through
> >>> one
> >>>     >port
> >>>     >(SSL port 443) with desktop softwares, mobile apps and also
> >browsers
> >>>     >(less
> >>>     >important) using my own protocol over websocket.
> >>>     >
> >>>     >I now also need to retrieve files that are stored on my
> >embedded
> >>> linux
> >>>     >(data log files, pictures, sounds, ....) in a simple way (eg: a
> >bit
> >>>     >like a
> >>>     >ftp) but using the same port 443? Thus, we only need to create
> >one
> >>> NAT
> >>>     >rule
> >>>     >in routers to access our embedded linux server from the WAN.
> >>>
> >>>     Right... you could always do that on one port by choosing what
> >files
> >>>     to serve in the http callback.  For example the test-server
> >serves
> >>>     both his ws connections and the html and png all on one port.
> >But
> >>>     for that you had to write the low-level code.
> >>>
> >>>     Master branch (to be lws v2.0) gives you two additional options
> >>>
> >>>       1) Keep your existing code and attach your own mounts at vhost
> >>>     creation time
> >>>
> >>>
> >>>
> >
> https://github.com/warmcat/libwebsockets/blob/master/README.coding.md#using-lws-v2-vhosts
> >>>
> >>>     Lws will serve the mounted contents automatically from where
> >it's
> >>>     mounted in the server namespace
> >>>
> >>>       2) Replace your whole server app with lwsws, which is how
> >>>     libwebsockets.org <http://libwebsockets.org> is working now.
> >>>
> >>>
> >https://github.com/warmcat/libwebsockets/blob/master/README.lwsws.md
> >>>
> >>>     Then you can configure the vhosts and mounts (and everything
> >else)
> >>>     in JSON instead of writing code.
> >>>
> >>>
> >>>
> >
> https://github.com/warmcat/libwebsockets/blob/master/lwsws/etc-lwsws-conf-EXAMPLE
> >>>
> >>>
> >
> https://github.com/warmcat/libwebsockets/blob/master/lwsws/etc-lwsws-conf.d-localhost-EXAMPLE
> >>>
> >>>     To implement your custom ws protocol part, do it as an lws
> >protocol
> >>>     plugin.  These are much simpler and more selfcontained than 'cut
> >and
> >>>     paste the test server'... eg
> >>>
> >>>
> >>>
> >
> https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_dumb_increment.c
> >>>
> >>>     You can build your plugin against lws headers and libs, and copy
> >to
> >>>     /usr/[local/]share/libwebsockets-test-server/plugins/, lws scans
> >the
> >>>     dir and initializes any plugins found.
> >>>
> >>>     You need to enable the ws protocols you want to offer in each
> >vhost,
> >>>     see how the libwebsockets.org <http://libwebsockets.org> conf
> >above
> >>>     does it.  You can also set per vhost protocol options there to
> >>>     modify or control what yhe protocol plugin does on a per-vhost
> >basis.
> >>>
> >>>     This way you can shed almost all your custom server code and get
> >>>     more featureful and maintainable results.
> >>>
> >>>     -Andy
> >>>
> >>>      >If I am correct, it seems that vhost can help us to have the
> >>> standard
> >>>      >LWS
> >>>      >webserver, the WS server and a kind of "FTP" all running on
> >the same
> >>>      >443
> >>>      >port? If so, do you have an idea of a service that could work
> >with
> >>> LWS
> >>>      >in
> >>>      >order to serve files from an embedded linux file system?
> >Ideally, I
> >>>      >wouldn't like to have to create my own protocol to retrieve
> >files
> >>> from
> >>>      >my
> >>>      >filesystem.
> >>>      >
> >>>      >Thanks in advance for your very nice support and sorry for
> >such
> >>> novice
> >>>      >questions.
> >>>      >
> >>>      >Best regards,
> >>>      >Thomas
> >>>      >
> >>>      >
> >>>      >2016-04-23 14:12 GMT+02:00 Andy Green <andy at warmcat.com
> >>>     <mailto:andy at warmcat.com>>:
> >>>
> >>>      >
> >>>      >> Hi -
> >>>      >>
> >>>      >> In the spirit of eating my own dogfood the last couple of
> >weeks my
> >>>      >own web
> >>>      >> services for https://libwebsockets.org and
> >https://warmcat.com
> >>> have
> >>>      >been
> >>>      >> running using lwsws on master, with real traffic and with
> >real
> >>> CGIs
> >>>      >(cgit +
> >>>      >> mailman).
> >>>      >>
> >>>      >> After tracking down the last CGI related bugs this week, it
> >seems
> >>> to
> >>>      >be
> >>>      >> stable.
> >>>      >>
> >>>      >> It's running 11 vhosts, although a lot of these are
> >redirects for
> >>>      >older
> >>>      >> services.  You can see its current status (via websockets,
> >>>     naturally)
> >>>      >here:
> >>>      >>
> >>>      >> https://libwebsockets.org/server-status/
> >>>      >>
> >>>      >> (This is a ws protocol plugin on lwsws and is included in
> >>> ./plugins)
> >>>      >>
> >>>      >> I've prepared a page listing the new features here
> >>>      >>
> >>>      >> https://libwebsockets.org/lws-2.0-new-features.html
> >>>      >>
> >>>      >> Basically a big advantage is if you are making a server type
> >>>      >application,
> >>>      >> you can just use lwsws and only need to write the ws
> >protocol
> >>> plugin
> >>>      >and
> >>>      >> set up some JSON to deploy it, instead of cut and pasting
> >custom
> >>>      >code.
> >>>      >>
> >>>      >> If you want to deploy more protocols later, they are
> >selfcontained
> >>>      >plugins
> >>>      >> and will play nice together.  The server stack is already
> >much
> >>> more
> >>>      >mature
> >>>      >> than 1.7 (the automated mountpoint serving and http cache
> >control,
> >>>      >> apache-compatible logging amongst other things).  And you
> >can
> >>>     benefit
> >>>      >from
> >>>      >> centralized maintenance of the whole server stack that way.
> >>>      >>
> >>>      >> For example the lws test server on
> >>>      >https://libwebsockets.org/testserver
> >>>      >> has its ws protocols served by lwsws plugins; there's no
> >code at
> >>> all
> >>>      >about
> >>>      >> them in lwsws itself.
> >>>      >>
> >>>      >> If you don't care right now, well it's disabled in cmake by
> >>> default
> >>>      >> currently and everything works as before by default.
> >>>      >>
> >>>      >> There's some docs on lwsws here:
> >>>      >>
> >>>      >>
> >>> https://github.com/warmcat/libwebsockets/blob/master/README.lwsws.md
> >>>      >>
> >>>      >> and you can see the actual lwsws JSON config for
> >>>     libwebsockets.org <http://libwebsockets.org> in
> >>>      >the
> >>>      >> tree as an example
> >>>      >>
> >>>      >>
> >>>      >>
> >>>      >
> >>>
> >
> https://github.com/warmcat/libwebsockets/blob/master/lwsws/etc-lwsws-conf.d-localhost-EXAMPLE
> >>>      >>
> >>>      >> There are two features that will have to wait for a
> >subsequent
> >>>      >version I
> >>>      >> think, one is http proxy, although it works it's not
> >integrated
> >>> into
> >>>      >lwsws
> >>>      >> yet (because I don't have a use for it right now and nobody
> >has
> >>>     asked
> >>>      >for
> >>>      >> it), the other is mbedtls (people asking for it but nobody
> >wants
> >>> it
> >>>      >enough
> >>>      >> to help work on it, even though I have done all the
> >plumbing).
> >>>      >>
> >>>      >> Otherwise it's in good shape AFAICT, it was in Coverity
> >today and
> >>>      >it's
> >>>      >> back at zero defects.
> >>>      >>
> >>>      >> If there's any comments, questions or suggestions, it'd be
> >>>     helpful to
> >>>      >hear
> >>>      >> them before it gets released ^^
> >>>      >>
> >>>      >> -Andy
> >>>      >> _______________________________________________
> >>>      >> Libwebsockets mailing list
> >>>      >> Libwebsockets at ml.libwebsockets.org
> >>>     <mailto:Libwebsockets at ml.libwebsockets.org>
> >>>      >> http://libwebsockets.org/mailman/listinfo/libwebsockets
> >>>      >>
> >>>
> >>>
> >>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20160517/eb978e45/attachment-0001.html>


More information about the Libwebsockets mailing list