platform/upstream/libwebsockets.git
7 years agocoverity 181575: check vhost iface non-null if using via bind_iface
Andy Green [Wed, 19 Jul 2017 06:16:32 +0000 (14:16 +0800)]
coverity 181575: check vhost iface non-null if using via bind_iface

7 years agolws-meta
Andy Green [Tue, 18 Jul 2017 20:39:14 +0000 (04:39 +0800)]
lws-meta

7 years agoclose: make close notification go through writable
Andy Green [Mon, 17 Jul 2017 02:11:17 +0000 (10:11 +0800)]
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.

7 years agolws-vhost-destroy
Andy Green [Sat, 15 Jul 2017 06:37:04 +0000 (14:37 +0800)]
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.

7 years agoclean: fixes for appveyor warnings
Andy Green [Sat, 15 Jul 2017 11:02:04 +0000 (19:02 +0800)]
clean: fixes for appveyor warnings

7 years agoah: enforce waiting list detach
Andy Green [Tue, 18 Jul 2017 20:06:15 +0000 (04:06 +0800)]
ah: enforce waiting list detach

7 years agovalgrind: avoid complaints from plugin loading
Andy Green [Sat, 15 Jul 2017 09:57:14 +0000 (17:57 +0800)]
valgrind: avoid complaints from plugin loading

7 years agoexplicit vhosts: only check context for flag
Andy Green [Tue, 18 Jul 2017 03:15:43 +0000 (11:15 +0800)]
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.

7 years agoSubject: Eliminated 'unused variable' compiler warning generated with -DLWS_WITH_NO_L...
Jesse Engle [Mon, 17 Jul 2017 04:16:00 +0000 (04:16 +0000)]
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

7 years agovalgrind: stop openssl still reachable complaints
Andy Green [Sat, 15 Jul 2017 09:51:32 +0000 (17:51 +0800)]
valgrind: stop openssl still reachable complaints

7 years agovalgrind: fix leak in caps handling
Andy Green [Sat, 15 Jul 2017 09:50:24 +0000 (17:50 +0800)]
valgrind: fix leak in caps handling

7 years agolibuv: add helper for clean valgrind with foreign loop
Andy Green [Sat, 15 Jul 2017 09:48:37 +0000 (17:48 +0800)]
libuv: add helper for clean valgrind with foreign loop

7 years agoesp32: increase dir depth for include bodge
Andy Green [Mon, 10 Jul 2017 10:52:27 +0000 (18:52 +0800)]
esp32: increase dir depth for include bodge

7 years agotest-html: unify ws open function
Andy Green [Mon, 10 Jul 2017 02:03:31 +0000 (10:03 +0800)]
test-html: unify ws open function

7 years agolinkedlist helpers
Andy Green [Sun, 9 Jul 2017 02:11:59 +0000 (10:11 +0800)]
linkedlist helpers

7 years agomirror: multiple mirror contexts by mirror= url arg
Andy Green [Sat, 8 Jul 2017 07:58:40 +0000 (15:58 +0800)]
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.

7 years agotest server: only init ssl when --ssl in use
Andy Green [Sat, 8 Jul 2017 08:02:18 +0000 (16:02 +0800)]
test server: only init ssl when --ssl in use

7 years agoclient: reject init_client_ssl more than once
Andy Green [Sat, 8 Jul 2017 08:01:34 +0000 (16:01 +0800)]
client: reject init_client_ssl more than once

7 years agolws_intptr_t
Andy Green [Fri, 7 Jul 2017 00:32:04 +0000 (08:32 +0800)]
lws_intptr_t

7 years agolws_return_http_status: if not in HTTP/2, restrict to a single write
Andy Green [Thu, 29 Jun 2017 03:26:22 +0000 (11:26 +0800)]
lws_return_http_status: if not in HTTP/2, restrict to a single write

7 years agoparsing: if we ended on a set of headers and read a new buffer mark as more_rx_waitin...
Andy Green [Thu, 29 Jun 2017 02:13:29 +0000 (10:13 +0800)]
parsing: if we ended on a set of headers and read a new buffer mark as more_rx_waiting to avoid dropping the ah

7 years agoclient: use right state machine
Boutoukoat [Wed, 28 Jun 2017 14:25:57 +0000 (22:25 +0800)]
client: use right state machine

https://github.com/warmcat/libwebsockets/issues/951

7 years agofile serve: defer transaction completed to HTTP_FILE_COMPLETION
Andy Green [Wed, 28 Jun 2017 06:27:09 +0000 (14:27 +0800)]
file serve: defer transaction completed to HTTP_FILE_COMPLETION

7 years agoah: require parsing complete before detach
Andy Green [Wed, 28 Jun 2017 04:13:13 +0000 (12:13 +0800)]
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.

7 years agotest-server-libev: disable Werror just on server-libev.c to workaround libev dirt
Andy Green [Wed, 28 Jun 2017 03:35:50 +0000 (11:35 +0800)]
test-server-libev: disable Werror just on server-libev.c to workaround libev dirt

7 years agotest-server-libuv: add missing call to lws_context_destroy2()
Andy Green [Wed, 28 Jun 2017 03:21:03 +0000 (11:21 +0800)]
test-server-libuv: add missing call to lws_context_destroy2()

7 years agotest servers: convert to static inclusion of plugins
Andy Green [Wed, 28 Jun 2017 03:16:48 +0000 (11:16 +0800)]
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.

7 years agotest-server-status: increase tx size to avoid WRITEABLE loops
Andy Green [Wed, 28 Jun 2017 02:35:40 +0000 (10:35 +0800)]
test-server-status: increase tx size to avoid WRITEABLE loops

7 years agotransaction_completed: ignore if parsing not complete
Andy Green [Wed, 28 Jun 2017 01:58:44 +0000 (09:58 +0800)]
transaction_completed: ignore if parsing not complete

7 years agotest-server-http: no need to complete transaction early since FILE_COMPLETION will...
Andy Green [Wed, 28 Jun 2017 01:57:15 +0000 (09:57 +0800)]
test-server-http: no need to complete transaction early since FILE_COMPLETION will do it

7 years agoah reset: enforce reset of parsing_complete
Andy Green [Wed, 28 Jun 2017 01:55:34 +0000 (09:55 +0800)]
ah reset: enforce reset of parsing_complete

7 years agoWITH_STATS: remove accidental dependency on ssl
Andy Green [Wed, 28 Jun 2017 01:52:22 +0000 (09:52 +0800)]
WITH_STATS: remove accidental dependency on ssl

7 years agoserving: protect file sending from downgrading to waiting pipelined headers
Andy Green [Tue, 27 Jun 2017 02:07:34 +0000 (10:07 +0800)]
serving: protect file sending from downgrading to waiting pipelined headers

https://github.com/warmcat/libwebsockets/issues/946

7 years agocmake: fix logic for individual test client build disable
Andy Green [Wed, 28 Jun 2017 01:50:54 +0000 (09:50 +0800)]
cmake: fix logic for individual test client build disable

7 years agoclient: add libuv support to lws_client_reset
Andy Green [Fri, 23 Jun 2017 02:27:52 +0000 (10:27 +0800)]
client: add libuv support to lws_client_reset

More direct solution to problem described in

https://github.com/warmcat/libwebsockets/pull/940

7 years agowindows: SO_EXCLUSIVEADDRUSE
Andy Green [Fri, 23 Jun 2017 05:08:46 +0000 (13:08 +0800)]
windows: SO_EXCLUSIVEADDRUSE

https://github.com/warmcat/libwebsockets/issues/942

7 years agoclient ssl: remove now meaningless check for non-server vhost
Andy Green [Wed, 21 Jun 2017 00:24:44 +0000 (08:24 +0800)]
client ssl: remove now meaningless check for non-server vhost

7 years agoclient: getaddrinfo refactor
Andy Green [Tue, 20 Jun 2017 07:56:48 +0000 (15:56 +0800)]
client: getaddrinfo refactor

https://github.com/warmcat/libwebsockets/issues/926

7 years agosupport openssl info callback
Andy Green [Tue, 20 Jun 2017 03:46:49 +0000 (11:46 +0800)]
support openssl info callback

https://github.com/warmcat/libwebsockets/issues/936

7 years agopkgconfig
Andy Green [Mon, 19 Jun 2017 04:29:48 +0000 (12:29 +0800)]
pkgconfig

https://github.com/warmcat/libwebsockets/issues/933

7 years agoSubject: LWS_UNUSED
Sergey Kovalevich [Tue, 13 Jun 2017 13:55:07 +0000 (16:55 +0300)]
Subject: LWS_UNUSED

7 years agoesp32: make button debounce also available in factory
Andy Green [Wed, 14 Jun 2017 23:59:22 +0000 (07:59 +0800)]
esp32: make button debounce also available in factory

7 years agoesp32: add ar ranlib and linker cross paths
Andy Green [Wed, 14 Jun 2017 23:47:18 +0000 (07:47 +0800)]
esp32: add ar ranlib and linker cross paths

7 years agoHTTP_PROXY: make usable
Andy Green [Mon, 12 Jun 2017 05:36:24 +0000 (13:36 +0800)]
HTTP_PROXY: make usable

7 years agoclient: add iface in connection info, dont use vhost iface
Andy Green [Wed, 14 Jun 2017 01:45:30 +0000 (09:45 +0800)]
client: add iface in connection info, dont use vhost iface

7 years agoLWS_WITH_NO_LOGS: take care about unused array for log generation
Andy Green [Fri, 9 Jun 2017 13:46:26 +0000 (21:46 +0800)]
LWS_WITH_NO_LOGS: take care about unused array for log generation

7 years agowin32: enable 64-bit file lengths
WebsocketUser [Fri, 9 Jun 2017 12:20:42 +0000 (20:20 +0800)]
win32: enable 64-bit file lengths

https://github.com/warmcat/libwebsockets/issues/916

AG added more appveyor warning cleaning and stitched in cmake tests

7 years agoSubject: Fix compile error in GCC 4.1.2
Leonardo Maccari Rufino [Wed, 7 Jun 2017 21:14:35 +0000 (18:14 -0300)]
Subject: Fix compile error in GCC 4.1.2

7 years agolarge files: convert content-length to use lws_filepos_t
Andy Green [Tue, 6 Jun 2017 23:57:19 +0000 (07:57 +0800)]
large files: convert content-length to use lws_filepos_t

7 years agocontent-length api: unsigned long to lws_filepos_t
Andy Green [Tue, 6 Jun 2017 23:46:51 +0000 (07:46 +0800)]
content-length api: unsigned long to lws_filepos_t

7 years agoSubject: Support to bind accepted socket to device on Linux
Leonardo Maccari Rufino [Fri, 2 Jun 2017 17:07:35 +0000 (14:07 -0300)]
Subject: Support to bind accepted socket to device on Linux

AG: move new member to end of info,
    allow info member even on nonsupporting platform,
    document requires root,
    apply only to listen skt before we drop root,
    add -k to test server to allow testing

7 years agocapabilities support
Andy Green [Tue, 6 Jun 2017 22:10:02 +0000 (06:10 +0800)]
capabilities support

7 years agoSubject: windows: support to bind to a specific IPv6 address
Leonardo Maccari Rufino [Mon, 5 Jun 2017 16:59:22 +0000 (13:59 -0300)]
Subject: windows: support to bind to a specific IPv6 address

7 years agoSubject: Support to IPv6 on Windows
Leonardo Maccari Rufino [Tue, 30 May 2017 21:31:06 +0000 (18:31 -0300)]
Subject: Support to IPv6 on Windows

7 years agoNULL protocol: make sure vhost same protocol linklist gets correct protocol index
Andy Green [Wed, 31 May 2017 01:45:28 +0000 (09:45 +0800)]
NULL protocol: make sure vhost same protocol linklist gets correct protocol index

7 years agoSubject: lws_stats: fix compile error on VS2013
Andy Ning [Fri, 26 May 2017 13:33:55 +0000 (09:33 -0400)]
Subject: lws_stats: fix compile error on VS2013

Use LWS_INLINE instead of inline in libwebsockets.h to
make it compatible on both Linux and Windows.

Signed-off-by: Andy Ning <andy.ning@windriver.com>
7 years agoesp32: disable LWS_WITH_STATS by default
Andy Green [Tue, 30 May 2017 01:01:32 +0000 (09:01 +0800)]
esp32: disable LWS_WITH_STATS by default

7 years agoSubject: Fixed value of LIBWEBSOCKETS_LIBRARIES_STATIC
Sergey Kovalevich [Mon, 29 May 2017 18:44:01 +0000 (21:44 +0300)]
Subject: Fixed value of LIBWEBSOCKETS_LIBRARIES_STATIC

7 years agoSubject: Fixed build in scope of a project (add_subdirectory)
Sergey Kovalevich [Mon, 29 May 2017 15:48:01 +0000 (18:48 +0300)]
Subject: Fixed build in scope of a project (add_subdirectory)

7 years agoSubject: Direct extension confirmation to the negotiated protocol's callback
emptyVoid [Sat, 27 May 2017 15:51:58 +0000 (22:51 +0700)]
Subject: Direct extension confirmation to the negotiated protocol's callback

Fixes #897

Notice this means if you want to globally ban an extension, you should
no longer include the extension at context creation time.

7 years agoSubject: libuv: Fix closing handle multiple times
Petar Paradzik [Fri, 19 May 2017 12:41:03 +0000 (14:41 +0200)]
Subject: libuv: Fix closing handle multiple times

Sometimes "Assertion failed: !uv__is_closing(handle)" happens because
handle is being closed multiple times. To fix this, "uv_is_closing"
is added before calling "uv_close".

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
7 years agoesp32: otf and use group-role as hostname if present
Andy Green [Mon, 22 May 2017 06:01:08 +0000 (14:01 +0800)]
esp32: otf and use group-role as hostname if present

7 years agoesp32: debounced button events
Andy Green [Sat, 20 May 2017 23:38:49 +0000 (07:38 +0800)]
esp32: debounced button events

7 years agoesp32: led network state helper
Andy Green [Sat, 20 May 2017 23:33:09 +0000 (07:33 +0800)]
esp32: led network state helper

7 years agocgi: close unforked std fds
Andy Green [Sat, 20 May 2017 00:05:27 +0000 (08:05 +0800)]
cgi: close unforked std fds

7 years agoLICENSE: clarify exceptions also apply to LGPL self-refernences
Andy Green [Fri, 19 May 2017 01:25:54 +0000 (09:25 +0800)]
LICENSE: clarify exceptions also apply to LGPL self-refernences

via Mike Atamas, Counsel for Epic Games

7 years agocgi: apply chunked grace period only when explicitly chunked
Andy Green [Fri, 19 May 2017 00:33:33 +0000 (08:33 +0800)]
cgi: apply chunked grace period only when explicitly chunked

7 years agocgi: handle no body to keep events coming
Andy Green [Thu, 18 May 2017 15:20:12 +0000 (23:20 +0800)]
cgi: handle no body to keep events coming

7 years agocgi: allow time travelling headers to decide response code
Andy Green [Thu, 18 May 2017 13:19:57 +0000 (21:19 +0800)]
cgi: allow time travelling headers to decide response code

https://github.com/warmcat/libwebsockets/issues/899

7 years agoclient: added socks5 proxy support
Andy Ning [Fri, 5 May 2017 15:38:34 +0000 (11:38 -0400)]
client: added socks5 proxy support

AG:

 - move creation info members to end of struct
 - add LWS_WITH_SOCKS5 CMake var, defaults to OFF
 - cast away some warnings about signed / unsigned in strncpy

Signed-off-by: Andy Ning <andy.ning@windriver.com>
7 years agoplugins: group
Andy Green [Tue, 16 May 2017 12:21:47 +0000 (20:21 +0800)]
plugins: group

7 years agoesp32: group tracking
Andy Green [Tue, 16 May 2017 11:35:55 +0000 (19:35 +0800)]
esp32: group tracking

7 years agoadoption: close socket manually if fails before add fds
Andy Green [Mon, 15 May 2017 00:10:08 +0000 (08:10 +0800)]
adoption: close socket manually if fails before add fds

7 years agostats: ah and ssl restriction stats
Andy Green [Sun, 14 May 2017 23:30:06 +0000 (07:30 +0800)]
stats: ah and ssl restriction stats

7 years agoesp32: group mdns
Andy Green [Sun, 14 May 2017 06:55:15 +0000 (14:55 +0800)]
esp32: group mdns

7 years agoesp32: multi ap slots
Andy Green [Sat, 13 May 2017 02:26:59 +0000 (10:26 +0800)]
esp32: multi ap slots

7 years agoesp32: multi ap slots plus PEM certs and parallel build fixes
Andy Green [Thu, 11 May 2017 07:02:01 +0000 (15:02 +0800)]
esp32: multi ap slots plus PEM certs and parallel build fixes

7 years agoLWS_WITH_STATS
Andy Green [Sun, 7 May 2017 02:02:03 +0000 (10:02 +0800)]
LWS_WITH_STATS

7 years agolws_write: report and reject suspicious lengths
Andy Green [Mon, 8 May 2017 02:49:10 +0000 (10:49 +0800)]
lws_write: report and reject suspicious lengths

7 years agoesp32: add leds sine fade helper
Andy Green [Sun, 7 May 2017 05:24:48 +0000 (13:24 +0800)]
esp32: add leds sine fade helper

7 years agoesp32: reapply pending count just for esp32
Andy Green [Sun, 7 May 2017 00:19:55 +0000 (08:19 +0800)]
esp32: reapply pending count just for esp32

7 years agoplugin-standalone: refactor cmake part to ease multiple sources
Andy Green [Fri, 5 May 2017 22:38:59 +0000 (06:38 +0800)]
plugin-standalone: refactor cmake part to ease multiple sources

7 years agoesp32: mac build: use gstat if exists
Andy Green [Thu, 4 May 2017 18:17:28 +0000 (02:17 +0800)]
esp32: mac build: use gstat if exists

7 years agonon-ssl: return 0 on pending
Andy Green [Wed, 3 May 2017 13:28:26 +0000 (21:28 +0800)]
non-ssl: return 0 on pending

https://github.com/warmcat/libwebsockets/issues/887

7 years agosnprintf: move contributed ssl patch to lws_snprintf
Andy Green [Wed, 3 May 2017 12:25:16 +0000 (20:25 +0800)]
snprintf: move contributed ssl patch to lws_snprintf

7 years agoesp32: client: SO_SNDBUF not usable
Andy Green [Fri, 28 Apr 2017 16:55:06 +0000 (00:55 +0800)]
esp32: client: SO_SNDBUF not usable

7 years agoesp32: return random length from lws_get_random
Andy Green [Fri, 28 Apr 2017 03:54:27 +0000 (11:54 +0800)]
esp32: return random length from lws_get_random

7 years agoesp32: return random count
Andy Green [Fri, 28 Apr 2017 03:53:28 +0000 (11:53 +0800)]
esp32: return random count

7 years agoSubject: windows: fops write support
Joel Winarske [Wed, 19 Apr 2017 21:55:21 +0000 (14:55 -0700)]
Subject: windows: fops write support

7 years agoSubject: ssl: stop spinning on close
Martin Milata [Thu, 6 Apr 2017 17:37:14 +0000 (19:37 +0200)]
Subject: ssl: stop spinning on close

7 years agowindows: constify first arg of plat fops open
dspname [Wed, 19 Apr 2017 12:28:48 +0000 (20:28 +0800)]
windows: constify first arg of plat fops open

https://github.com/warmcat/libwebsockets/issues/871

7 years agowindows: align choked trunc checking with unix
Andy Green [Tue, 18 Apr 2017 07:17:22 +0000 (15:17 +0800)]
windows: align choked trunc checking with unix

7 years agoesp32: update for soc refactor in esp-idf 9edab21385b6349340d7e3ac27b730e44a127fd3
Andy Green [Sun, 16 Apr 2017 23:38:28 +0000 (07:38 +0800)]
esp32: update for soc refactor in esp-idf 9edab21385b6349340d7e3ac27b730e44a127fd3

7 years agoSubject: Save copy of ah pointer even with WS client so that HTTP
Gecko [Mon, 10 Apr 2017 04:31:50 +0000 (21:31 -0700)]
Subject: Save copy of ah pointer even with WS client so that HTTP
 error can be captured by calling lws_http_client_http_response.

7 years agoclient: allow 201
Andy Green [Sat, 8 Apr 2017 23:56:41 +0000 (07:56 +0800)]
client: allow 201

7 years agossl: only apply restriction if nonzero for vhost
Andy Green [Fri, 7 Apr 2017 12:51:44 +0000 (20:51 +0800)]
ssl: only apply restriction if nonzero for vhost

7 years agobind protocol: fix for NULL names
Silas Parker [Fri, 7 Apr 2017 10:22:54 +0000 (18:22 +0800)]
bind protocol: fix for NULL names

7 years agoesp32-fix-random
Andy Green [Fri, 7 Apr 2017 10:20:21 +0000 (18:20 +0800)]
esp32-fix-random

7 years agoesp32: workaround cant find TLS_client_method
Andy Green [Fri, 7 Apr 2017 03:29:57 +0000 (11:29 +0800)]
esp32: workaround cant find TLS_client_method

7 years agoraw: defer creation callback until after fds inserted
Andy Green [Fri, 7 Apr 2017 03:25:55 +0000 (11:25 +0800)]
raw: defer creation callback until after fds inserted