Commit graph

2159 commits

Author SHA1 Message Date
Andy Green
1690581cd2 coverity 181574: confirm uri_ptr non-null before deref 2017-07-19 14:19:03 +08:00
Andy Green
3c360d5192 coverity 181579: check result of malloc as intended 2017-07-19 14:17:39 +08:00
Andy Green
8a4881a142 coverity 181575: check vhost iface non-null if using via bind_iface 2017-07-19 14:16:32 +08:00
Andy Green
6f11c1361a lws-meta 2017-07-19 08:59:42 +08:00
Andy Green
3b0066cb3f close: make close notification go through writable
Until now we took the approach if just writing the close notification
broke something, we didn't care because we were closing the connection
anyway.

But with lws_meta, breaking stuff in the parent connection would be a
sticky problem outliving the closing child connection.

So this adds a new wsi state LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION
and makes the send go via the writable callback mechanism.
2017-07-19 08:55:57 +08:00
Andy Green
faa1526b39 lws-vhost-destroy
Adds a new api lws_vhost_destroy(struct lws_vhost *) which allows dynamic removal of vhosts.

The external api calls two parts of internal helpers that get reused for context destroy.

The second part is called deferred by 5s... this is to ensure that event library objects
composed into structs owned by the vhost all have a chance to complete their close
asynchronously.  That should happen immediately, but it requires us to return to the
event loop first.

The vhost being removed is deleted from the context vhost list by the first part, and does
not block further removals or creation during the delay for the deferred freeing of the
vhost memory.

Part 1:

 - if the vhost owned a listen socket needed by other vhosts listening on same iface + port, the listen
   socket is first handed off to another vhost so it stays alive

 - all wsi still open on the vhost are forcibly closed (including any listen socket still attached)

 - inform all active protocols on the vhost they should destroy themselves

 - remove vhost from context vhost list (can no longer be found by incoming connections)

 - add to a "being destroyed" context list and schedule the second part to be called in 5s

Part 2:

 - remove us from the being destroyed list

 - free all allocations owned by the vhost

 - zero down the vhost and free the vhost itself


In libwebsockets-test-server, you can send it a SIGUSR1 to have it toggle the creation and destruction of
a second vhost on port + 1.
2017-07-19 08:51:43 +08:00
Andy Green
632a0acc99 clean: fixes for appveyor warnings 2017-07-19 04:25:20 +08:00
Andy Green
dbd9262ac5 ah: enforce waiting list detach 2017-07-19 04:19:25 +08:00
Andy Green
d5f960f14b valgrind: avoid complaints from plugin loading 2017-07-19 04:18:11 +08:00
Andy Green
5106e9141f explicit vhosts: only check context for flag
Although the test apps reuse the context info directly and so inherit the
flag state there when creating vhosts, users might generate a fresh info
without the flag for vhost creation.  So just go by what was given at
context creation time.
2017-07-19 04:12:26 +08:00
Jesse Engle
61cc61817e Subject: Eliminated 'unused variable' compiler warning generated with -DLWS_WITH_NO_LOGS=ON.
The unused variable was only declared for use in a log macro that's
compiled out with the above compiler switch. I removed the declaration
and casted the variable at each use in the block.

AG: convert to void case reference irrespective of logging enabled.
AG: travis.yml: add -DLWS_WITH_NO_LOGS=ON that also enables lwsws + cgi code
2017-07-19 04:11:57 +08:00
Andy Green
3077b7776e valgrind: stop openssl still reachable complaints 2017-07-19 04:11:30 +08:00
Andy Green
81d5899c89 valgrind: fix leak in caps handling 2017-07-19 04:10:36 +08:00
Andy Green
a15007269e libuv: add helper for clean valgrind with foreign loop 2017-07-19 04:10:07 +08:00
Andy Green
ffa5898afe esp32: increase dir depth for include bodge 2017-07-14 10:26:39 +08:00
Andy Green
6f2a470ee2 test-html: unify ws open function 2017-07-14 10:26:39 +08:00
Andy Green
e2a926de2f linkedlist helpers 2017-07-09 10:11:59 +08:00
Andy Green
05d74e45dc mirror: multiple mirror contexts by mirror= url arg
By default mirror acts the same as before.

However if you access the test server with a url containing "?mirror=<name>", the session will bind to
a mirror instance private to "?mirror=<name>".  Only sessions that used the same 'mirror=' name can
share the drawings, mirror instances with a different name (including the default "" name) are unaffected.
2017-07-08 16:03:40 +08:00
Andy Green
1b41322c28 test server: only init ssl when --ssl in use 2017-07-08 16:03:39 +08:00
Andy Green
9b4fa24909 client: reject init_client_ssl more than once 2017-07-08 16:03:38 +08:00
Andy Green
7262e14dc1 lws_intptr_t 2017-07-07 08:32:04 +08:00
Andy Green
6a89c7e931 lws_return_http_status: if not in HTTP/2, restrict to a single write 2017-06-29 11:26:22 +08:00
Andy Green
ff9a24de1c parsing: if we ended on a set of headers and read a new buffer mark as more_rx_waiting to avoid dropping the ah 2017-06-29 10:13:29 +08:00
Boutoukoat
e4d8acc85a client: use right state machine
https://github.com/warmcat/libwebsockets/issues/951
2017-06-28 22:25:57 +08:00
Andy Green
a637d8f41f file serve: defer transaction completed to HTTP_FILE_COMPLETION 2017-06-28 14:27:09 +08:00
Andy Green
8f4f692945 ah: require parsing complete before detach
Introduce helpers to force to detachable state and to test the ah is
in a detachable state.

Require not only the ah rx buffer is all used, but that the
wsi has completed a full set of headers.
2017-06-28 12:13:13 +08:00
Andy Green
0b629d4037 test-server-libev: disable Werror just on server-libev.c to workaround libev dirt 2017-06-28 11:37:15 +08:00
Andy Green
0e222ab084 test-server-libuv: add missing call to lws_context_destroy2() 2017-06-28 11:37:15 +08:00
Andy Green
5939d3a961 test servers: convert to static inclusion of plugins
This eliminates the duplicated implementations of the test protocols,
except dumb-increment (which requires libuv).

This has various advantages, including bringing all the test servers
up to the same set of protocols support.

Triggered by finding a bug in server status protocol that was long
ago fixed in the plugins version.
2017-06-28 11:16:48 +08:00
Andy Green
55d9037c32 test-server-status: increase tx size to avoid WRITEABLE loops 2017-06-28 10:35:40 +08:00
Andy Green
bd23a401f6 transaction_completed: ignore if parsing not complete 2017-06-28 10:04:57 +08:00
Andy Green
47da96664f test-server-http: no need to complete transaction early since FILE_COMPLETION will do it 2017-06-28 10:04:57 +08:00
Andy Green
04830cceef ah reset: enforce reset of parsing_complete 2017-06-28 10:04:57 +08:00
Andy Green
eb7233ae97 WITH_STATS: remove accidental dependency on ssl 2017-06-28 10:04:57 +08:00
Andy Green
34ef9743d2 serving: protect file sending from downgrading to waiting pipelined headers
https://github.com/warmcat/libwebsockets/issues/946
2017-06-28 10:04:57 +08:00
Andy Green
12a9592426 cmake: fix logic for individual test client build disable 2017-06-28 09:50:54 +08:00
Andy Green
ede9ad2b13 client: add libuv support to lws_client_reset
More direct solution to problem described in

https://github.com/warmcat/libwebsockets/pull/940
2017-06-26 08:36:49 +08:00
Andy Green
abc2a5cd2e windows: SO_EXCLUSIVEADDRUSE
https://github.com/warmcat/libwebsockets/issues/942
2017-06-26 08:36:49 +08:00
Andy Green
d6394b6dba client ssl: remove now meaningless check for non-server vhost 2017-06-21 08:24:44 +08:00
Andy Green
c70f6692f8 client: getaddrinfo refactor
https://github.com/warmcat/libwebsockets/issues/926
2017-06-20 15:56:48 +08:00
Andy Green
3ff720ff66 support openssl info callback
https://github.com/warmcat/libwebsockets/issues/936
2017-06-20 11:46:49 +08:00
Andy Green
1725332d47 pkgconfig
https://github.com/warmcat/libwebsockets/issues/933
2017-06-19 12:29:48 +08:00
Sergey Kovalevich
be4efcfe58 Subject: LWS_UNUSED 2017-06-19 10:57:39 +08:00
Andy Green
31e26a4fab esp32: make button debounce also available in factory 2017-06-15 07:59:22 +08:00
Andy Green
1e762dcde4 esp32: add ar ranlib and linker cross paths 2017-06-15 07:47:18 +08:00
Andy Green
581b86efd0 HTTP_PROXY: make usable 2017-06-14 09:53:09 +08:00
Andy Green
449eec9b54 client: add iface in connection info, dont use vhost iface 2017-06-14 09:45:30 +08:00
Andy Green
af718ff5c2 LWS_WITH_NO_LOGS: take care about unused array for log generation 2017-06-09 21:46:26 +08:00
WebsocketUser
0be9e98aae win32: enable 64-bit file lengths
https://github.com/warmcat/libwebsockets/issues/916

AG added more appveyor warning cleaning and stitched in cmake tests
2017-06-09 20:20:42 +08:00
Leonardo Maccari Rufino
568aae9c2d Subject: Fix compile error in GCC 4.1.2 2017-06-08 05:41:00 +08:00