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

4583 commits

Author SHA1 Message Date
Andy Green
a7c9af5ac5 ss: server: dont allow client request_tx path even if disconnected 2020-09-13 14:37:15 +01:00
Andy Green
6a32db56bc 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-13 14:37:15 +01:00
Andy Green
5c7b5af92a cmake: disable export visibility when building lws static
This is complicated by the fact extern on a function declaration implies
visibility... we have to make LWS_EXTERN empty when building static.

And, setting target_compile_definitions() doesn't work inside macros,
so it has to be set explicitly for the plugins.

Checking the symbol status needs nm -C -D as per

https://stackoverflow.com/questions/37934388/symbol-visibility-not-working-as-expected

after this patch, libwebsockets.a shows no symbols when checked like that and
the static-linked minimal examples only show -U for their other dynamic
imports.

In a handful of cases we use LWS_EXTERN on extern data declarations,
those then need to change to explicit extern.
2020-09-06 11:46:25 +01:00
Andy Green
3be4725388 cmake: set version v4.1.99 for development 2020-09-04 14:12:39 +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
Yucong Sun
8584c973fa adopt: disable ssl flags if ssl not enabled
https://github.com/warmcat/libwebsockets/issues/2011
2020-08-31 16:51:36 +01:00
Andy Green
2330f69082 add braces around possibly preprocesssor removed helper 2020-08-31 16:51:36 +01:00
Andy Green
1ebe27e38f cmake: mark all the subprojects as explicitly C
We don't need a C++ compiler but if we don't spell it out, cmake
assumes it C + C++ compiler needed.
2020-08-31 16:51:36 +01:00
Andy Green
692f269045 coverity: 62140: if newer mbedtls apis available use and check returns
mbedtls has older and newer hashing apis, if we detected the newer ones
we use them like the older ones since generally, hashing doesn't have a
way to fail for sha and md5 update etc.

Coverity objects... change it to dumbly check the retcode.
2020-08-19 07:46:21 +01:00
Andy Green
c21467a8f0 coverity: 50976: check fsync return for cert write 2020-08-19 07:23:19 +01:00
Andy Green
e2dcbdc81a coverity: 49785: confirm initgroups worked 2020-08-19 07:21:55 +01:00
Andy Green
258ee1886f coverity: 37468: confirm gethostname worked 2020-08-19 07:19:48 +01:00
Andy Green
d69b91d2d9 coverity: 62123: explicitly check things to guide coverity
Coverity sees we sometimes check if header length is 0 and extrapolates
from that not checking header length return is a violation.  But often
we are OK if the header length is 0 and there is no error return to
check from that.

It also doesn't understand that if we saw a nonzero length for a header,
then we are going to get a non-null simple_ptr() return for sure.  Just
give up and explicitly, unneccessarily check everything so coverity can
stop telling us about it.
2020-08-19 07:11:59 +01:00
Andy Green
944ef24e67 coverity: 10600: make sure vhosts get off the pending destruction list if on it 2020-08-19 06:52:47 +01:00
Andy Green
a8315807e7 coverity: 10417: move goto inside preprocessor conditional that needs it
Otherwise coverity sees it with !defined(LWS_ROLE_WS) sitting there doing nothing
2020-08-19 06:46:19 +01:00
Andy Green
7ff64b3c42 coverity: 10117: help coverity understand simple_ptr cannot be NULL 2020-08-19 06:40:13 +01:00
Andy Green
a743a2b234 coverity: 62207: we only need to compute the flag if LWS_WITH_SYS_ASYNC_DNS 2020-08-18 14:00:54 +01:00
Andy Green
a6b4bd8bfc coverity: 62374: no need to init n 2020-08-18 14:00:54 +01:00
Andy Green
9679222070 coverity: 62147: setting retcode var is cruft 2020-08-18 14:00:54 +01:00