1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
Commit graph

3747 commits

Author SHA1 Message Date
小明
7b2ef3b19e ios: adapt to MSG_NOSIGNAL available in iOS SDK 12+ 2020-09-20 19:30:36 +01:00
Andy Green
16963f0430 sspc: extend RXPRE_CONNSTATE to handle 8 or 32-bit states
Currently only the low 8 bits of an SS state are proxied in a total packet
length of 8 octets.  Keep that format and behaviour since all the defined
states fit in 8 bits, but also allow for 32-bit states using a packet length
of 11 octets with the same command.

This lets us proxy user states (from http mapping) which start at a user
base of 1000.
2020-09-20 07:09:41 +01:00
Andy Green
e69d2edaea h2: mark :protocol as an h2 psuedoheader 2020-09-19 16:29:23 +01:00
Andy Green
be1be1f342 testapp: extpoll: add back missing EXTERNAL_POLL pieces
EXTERNAL_POLL is not recommended for use for a while, it's a hack to allow
integration of lws with random application poll() loops.

While lws is very happy to do that secondary job for any event lib using the
foreign loop support (for uv, event, glib, and ev), for random roll-your-
own poll() waits there's no api because there's no event lib.  The solution
with a future is upgrade your application to use an event loop.

The test app that supports EXTERNAL_POLL was broken in Apr 2018, so it's
apparently good news nobody has been using it in new implementations
since then.  This patch adds in the missing pieces so we can test it until
it is formally deprecated.
2020-09-18 09:31:29 +01:00
Orgad Shaneh
2cf260a0a3 cmake: remove dead code
Since 425da070e3 LWS_PTHR_FLAGS is no longer
used, so just remove it.
2020-09-17 14:28:45 +01:00
Orgad Shaneh
3118c66590 cmake: mingw: fix build with default options
afunix.h doesn't exist on mingw.
2020-09-17 14:28:42 +01:00
Orgad Shaneh
ba721d7e2a cmake: mingw: fix openssl linkage
ws32 and friends must come after the openssl libs,
and pthread is required for openssl.
2020-09-17 14:28:39 +01:00
Orgad Shaneh
221acdde6a cmake: use -Wuninitialized only for GCC >= 4.4
It doesn't work with 4.3.3
2020-09-15 13:45:02 +01:00
Orgad Shaneh
8736a03e79 smd: fix strict-aliasing warning on gcc 4.4 2020-09-15 11:46:11 +01:00
Orgad Shaneh
442e148bb7 lws_dir: do not compare enums using the preprocessor
It is invalid on some platforms.

Fixes #2003
2020-09-15 11:30:00 +01:00
Orgad Shaneh
1f2da5cdd5 Subject: core-net: initialize some variables
Amends 286cf4357a.
2020-09-15 11:30:00 +01:00
Sakthi Kannan
fcc7429983 mbedtls: use lws helper for PEM DER import 2020-09-15 07:18:33 +01:00
Andy Green
0b884065cc event-libs: update README.md in the main dir for plugin capable flow 2020-09-14 16:13:54 +01:00
Orgad Shaneh
55c92237b6 unix plat: avoid strict aliasing complaint from a toolchain
The type of the fields in rtentry is sockaddr, and it is
casted to sockaddr_in. Size-wise it is ok, they should both
be the same size. But casting a pointer breaks build with
optimizations with the following error:

unix-sockets.c:434: error: dereferencing pointer 'addr' does break strict-aliasing rules

Amends commit 3c95483518.
2020-09-14 16:13:03 +01:00
Andy Green
39f21dc701 ss: server: make sure failures after adopt invalidate ss copy of wsi
For server, if the adoption of the incoming connection proceeds but then
fails early on, eg, tls alert due to hostname mismatch with cert, the
wsi close happens but it doesn't clean up the invalidated reference to
itself in the server ss object... if it became established, that's handled
by the ss protocol callback.

This patch helps the close path to understand there is a related ss object
and to clean up after itself.
2020-09-13 11:16:09 +01:00
Andy Green
04ddc644d9 ss: server: dont allow client request_tx path even if disconnected 2020-09-13 11:15:53 +01:00
Andy Green
9fc6716af4 libuv: fix pt derivation from ptpr in callbacks
The per-pt priv for event libs ended up overallocated at the context,
and pointed-to by a single pointer composed into each pt.  That means
we can't do pointer arithmetic on it any more.

Update a couple of stragglers in libuv event lib to use a pointer in
the pt-priv for the event lib back to the pt instead.

Also in foreign case if we start idle, there may not be anything
happening to trigger the initial idle.  So let each pt start with
its idle active.
2020-09-10 08:19:43 +01:00
Andy Green
11576a754f README.md: fix typo in release annouce 2020-09-06 15:54:33 +01:00
Andy Green
63e9699bda v4.1.0 2020-09-04 13:42:57 +01:00
Andy Green
936e1c71ce sspc: client: call CREATING on linkup to proxy
Before this we simply proxy the CREATING state from the proxy
version of the stream to the client version of the stream.

However this can result in disordering of onward connection
attempt request happening before the client has called back its
CREATING (*state()), meaning that any metadata set in the
state handler is missed for the onward connection.

This patch suppresses the CREATING forwarded from the proxy
and instead does its own local CREATING state callback at the
time the proxy indicates that the remote stream creation
(ie, with the requested policy streamtype) succeeded.

This then guarantees that the client has seen CREATING, and
had a chance to set metadata there, before the onward connection
request goes out.  Since metadata has higher priority at the
writeable than the onward connection request it also means
any metadata set in client CREATING gets sync'd to the proxy
before the onward connection.
2020-09-04 12:59:34 +01:00
Andy Green
008b355166 freertos: fixes for build on atmel xdk 2020-09-03 12:49:54 +01:00
SCRockz
ad7b17f437 cmake: qnx adaptations
https://github.com/warmcat/libwebsockets/issues/2034
2020-09-03 08:18:52 +01:00
Andy Green
186b2ce777 evlib-plugins: set MACOS_RPATH 2020-09-03 07:42:35 +01:00
Andy Green
86409e9f62 evlib plugins: revert to building in if no LWS_WITH_SHARED
https://github.com/warmcat/libwebsockets/issues/2033
2020-09-01 08:18:45 +01:00
Andy Green
c3dee88156 static build: lwsws 2020-09-01 08:10:06 +01:00
Andy Green
4ae3ef51c1 ss: improve callback return consistency
Formalize the LWSSSSRET_ enums into a type "lws_ss_state_return_t"
returned by the rx, tx and state callbacks, and some private helpers
lws_ss_backoff() and lws_ss_event_helper().

Remove LWSSSSRET_SS_HANDLE_DESTROYED concept... the two helpers that could
have destroyed the ss and returned that, now return LWSSSSRET_DESTROY_ME
to the caller to perform or pass up to their caller instead.

Handle helper returns in all the ss protocols and update the rx / tx
calls to have their returns from rx / tx / event helper and ss backoff
all handled by unified code.
2020-08-31 16:51:37 +01:00
Andy Green
e3e177a7d6 smp: add pt lock on client connect path 2020-08-31 16:51:37 +01:00
Andy Green
16e8fc2042 cmake: plugins: make sure about dl 2020-08-31 16:51:37 +01:00
Andy Green
095b76853e smp: lws_mutex_refcount: add assert held helper
also additional pt locks shown as needed by that
2020-08-31 16:51:37 +01:00
Andy Green
8235db7726 smp: additional vhost locks 2020-08-31 16:51:37 +01:00
Andy Green
b49a1460e9 smp: unable to check for fd reuse since another thread can accept it 2020-08-31 16:51:37 +01:00
Andy Green
1e0da366be sul: export schedule helpers as functions so easier to add pt lock 2020-08-31 16:51:37 +01:00
Orgad Shaneh
edb7d6ffc1 openssl: allow build with old glibc headers
strnlen requires _GNU_SOURCE prior to glibc 2.10.
2020-08-31 16:51:37 +01:00
Orgad Shaneh
0938607af8 cmake: gcc: allow build with GCC < 4.4
Prior to 4.4, -Wuninitialized could only be used with -O.
2020-08-31 16:51:37 +01:00
Andy Green
1d05f429dc lws_plugins 2020-08-31 16:51:37 +01:00
Andy Green
f53db84117 coverity: plugins fixes 2020-08-31 16:51:37 +01:00
Andy Green
40f7b84ff4 ws-client-binance: mbedtls wolfssl: trust ca cert explicitly 2020-08-31 16:51:37 +01:00
Andy Green
c6c7ab2b44 event libs: default to building as dynamically loaded plugins
Event lib support as it has been isn't scaling well, at the low level
libevent and libev headers have a namespace conflict so they can't
both be built into the same image, and at the distro level, binding
all the event libs to libwebsockets.so makes a bloaty situation for
packaging, lws will drag in all the event libs every time.

This patch implements the plan discussed here

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

and refactors the event lib support so they are built into isolated
plugins and bound at runtime according to what the application says
it wants to use.  The event lib plugins can be packaged individually
so that only the needed sets of support are installed (perhaps none
of them if the user code is OK with the default poll() loop).  And
dependent user code can mark the specific event loop plugin package
as required so pieces are added as needed.

The eventlib-foreign example is also refactored to build the selected
lib support isolated.

A readme is added detailing the changes and how to use them.

https://libwebsockets.org/git/libwebsockets/tree/READMEs/README.event-libs.md
2020-08-31 16:51:37 +01:00
Andy Green
d98101d1e3 plugins: generalize and provide public api
Move the common plugin scanning dir stuff to be based on lws_dir, which
already builds for windows.  Previously this was done via dirent for unix
and libuv for windows.

Reduce the dl plat stuff to just wrap instantiation and destruction of
dynlibs, establish common code in lib/misc/dir.c for plugin scanning
itself.

Migrate the libuv windows dl stuff to windows-plugins.c, so that he's
available even if later libuv loop support becomes and event lib plugin.

Remove the existing api exports scheme for plugins, just export a const struct
now which has a fixed header type but then whatever you want afterwards depending
on the class / purpose of the plugin.  Place a "class" string in the header so
there can be different kinds of plugins implying different types exported.

Make the plugin apis public and add support for filter by class string, and
per instantation / destruction callbacks so the subclassed header type can
do its thing for the plugin class.  The user provides a linked-list base
for his class of plugins, so he can manage them completely separately and
in user code / user export types.

Rip out some last hangers-on from generic sessions / tables.

This is all aimed at making the plugins support general enough so it can
provide event lib plugins later.
2020-08-31 16:51:37 +01:00
Jed Lu
3b9e468516 ss: protect against reentry in lws_destroy 2020-08-31 16:51:37 +01:00
Andy Green
c54a35e1a9 h2: allow empty SETTINGS
https://libwebsockets.org/pipermail/libwebsockets/2020-August/008676.html
2020-08-31 16:51:37 +01:00
Andy Green
43311f3289 minimal-ws-client-binance
Add a minimal example showing how to write a binance client using
permessage_deflate and LCCSF_PRIORITIZE_READS to minimize latency.

This is partly informed by kutoga's example on
https://github.com/warmcat/libwebsockets/issues/2019 which was in
turn based on the existing ws client minimal example.
2020-08-31 16:51:37 +01:00
Andy Green
fa78129f73 ws: LCCSCF_PRIORITIZE_READS 2020-08-31 16:51:37 +01:00
Andy Green
fe7fdef9be clean: SSL_accept failure just needs info logging 2020-08-31 16:51:37 +01:00
21stcaveman
8ca839dfb0 Subject: plugins: lwsws will not iterate all plugin directories
Apply the same logic to both libuv and the generic unix plugin implementations
2020-08-31 16:51:37 +01:00
Andy Green
72b245ea38 h2: fix breakage with LWS_WITH_HTTP2=0 2020-08-31 16:51:37 +01:00
Andy Green
d735d96b99 sspc: extend assert length check to explicit code 2020-08-31 16:51:37 +01:00
Andy Green
21a22d20ca test-apps: dont build extension support if LWS_WITHOUT_EXTENSIONS 2020-08-31 16:51:37 +01:00
Andy Green
28f4aae555 listen: network filter: provide a struct with client info to the FILTER cb
For backwards compatibility, keep the cast fd on in and pass an info struct
to the callback by overloading user_data.
2020-08-31 16:51:37 +01:00
Andy Green
62c328244c cmake: fix things ignoring LWS_WITH_TLS 2020-08-31 16:51:36 +01:00