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

296 commits

Author SHA1 Message Date
Andy Green
350284590c cmake: LWS_WITHOUT_EVENTFD 2021-04-20 14:58:23 +01:00
Andy Green
7f8e2edc3d windows: cancel pipe is in pts not context 2021-04-05 10:55:04 +01:00
Andy Green
51490ae6e6 Fault injection
add lws_xos: xoshiro256 PRNG
2021-04-05 10:55:04 +01:00
Pavel Otchertsov
9453d246d9 unix: fix usage of getpwnam_r and friends
These functions can return 0 code but still store NULL in result, if no matching group or username found.
Also the buffer of 64 size could be too small to store all string fields in result.
2021-03-25 08:40:52 +00:00
Andy Green
b9ee27f3c5 unix: use getpwnam_r and friends
Figure out if the threadsafe versions are available on the platform and
use them if so
2021-03-25 08:40:52 +00:00
Andy Green
e97a61f22b logs: reduce verbosity on plugins probing 2021-03-17 12:23:28 +00:00
Andy Green
b34862bf8a netbsd: follow openbsd use of wait4
Otherwise sai is sometimes failing to get the correct process exit code

spawn: use WEXITSTATUS macro

On openbsd at least, the process retcode isn't in the low 8 bits, but must
be recovered using the official macro.
2021-03-16 08:15:28 +00:00
Andy Green
3ca8625129 adopt: rejection should not loop with listen adoption 2021-03-14 15:05:19 +00:00
Curi0
dbc89c88ec windows: openssl: load certificates from certificate store 2021-03-12 09:25:51 +00:00
Andy Green
3f4623bb36 lws_metrics
There are a few build options that are trying to keep and report
various statistics

 - DETAILED_LATENCY
 - SERVER_STATUS
 - WITH_STATS

remove all those and establish a generic rplacement, lws_metrics.

lws_metrics makes its stats available via an lws_system ops function
pointer that the user code can set.

Openmetrics export is supported, for, eg, prometheus scraping.
2021-03-08 21:47:28 +00:00
Andy Green
d72955cc7f solaris: spawn: vfork is deprecated on solaris 11 2021-03-08 20:43:50 +00:00
Andy Green
e7a96a7175 solaris: socket priority 2021-03-08 20:43:29 +00:00
Curi0
8dbe8507a3 windows-resolv: fix dns resolution
before this patch all i got was 'cant get dns servers' on my laptop running windows 10 1909
2021-03-05 20:08:51 +00:00
Andy Green
dc051fb2ae OpenBSD: various api ports 2021-02-17 11:39:15 +00:00
Andy Green
599691d233 dhcp: clean 2021-02-17 11:39:15 +00:00
Andy Green
eb782bd41e ip tos support 2021-02-04 10:28:02 +00:00
Andy Green
d73c4baab2 options: fixes
sai: add default-noudp and windows plats for noserver
2021-02-01 15:19:38 +00:00
Andy Green
334212ef2e windows: mbedtls: clean warnings 2021-01-29 21:22:35 +00:00
Andy Green
6497220e87 plugins: add LWS_BUILD_HASH to header and require match
Also prioritize LD_LIBRARY_PATH check for plugins first

Iterate through paths in LD_LIBRARY_PATH in order

Warn on failed plugins init but continue protocol init
2021-01-28 05:52:41 +00:00
Andy Green
beacabbdb1 vhost_destroy: refactor 2021-01-22 12:31:15 +00:00
Andy Green
f1e5e573e6 destroy: shuffle for internal 2021-01-22 12:24:58 +00:00
Andy Green
95a545b741 evlib: count extant evlib handles instead of wsi 2021-01-19 17:07:33 +00:00
Andy Green
9ed9a04870 unix-caps: switch to unsigned mode for Wconversion 2021-01-19 06:43:27 +00:00
Andy Green
1062149e9f service: restrict effective wait to platform resolution 2021-01-17 11:32:48 +00:00
Andy Green
c9731c5f17 type comparisons: fixes
This is a huge patch that should be a global NOP.

For unix type platforms it enables -Wconversion to issue warnings (-> error)
for all automatic casts that seem less than ideal but are normally concealed
by the toolchain.

This is things like passing an int to a size_t argument.  Once enabled, I
went through all args on my default build (which build most things) and
tried to make the removed default cast explicit.

With that approach it neither change nor bloat the code, since it compiles
to whatever it was doing before, just with the casts made explicit... in a
few cases I changed some length args from int to size_t but largely left
the causes alone.

From now on, new code that is relying on less than ideal casting
will complain and nudge me to improve it by warnings.
2021-01-05 10:56:38 +00:00
Andy Green
2d6b9a06a7 windows: migrate to WSAPoll
Switch out the guts of the default window platform
wait to use WSAPoll(), switch the lws_cancel_service()
mechanism to use a UDP socket pair.
2021-01-05 10:56:38 +00:00
Andy Green
3ced2a4f90 sys: blob: appended bugflist blob offset by LWS_PRE 2021-01-04 05:40:12 +00:00
Andy Green
0ceba15d9c lws_lifecycle
This adds some new objects and helpers for keeping and logging
info on grouped allocations, a group is, eg, SS handles or client
wsis.

Allocated objects get a context-unique "tag" string intended to replace
%p / wsi pointers etc.  Pointers quickly become confusing when
allocations are freed and reused, the tag string won't repeat
until you produce 2^64 objects in a context.

In addition the tag string documents the object group, with prefixes
like "wsi-" or "vh-" and contain object-specific additional
information like the vhost name, address / port  or the role of the wsi.
At creation time the lws code can use a format string and args
to add whatever group-specific info makes sense, eg, a wsi bound
to a secure stream can also append the guid of the secure stream,
it's copied into the new object tag and so is still available
cleanly after the stream is destroyed if the wsi outlives it.
2021-01-04 05:26:50 +00:00
Andy Green
d330dbd76a wsi: unify base wsi creation function
A few different places want to create wsis and basically repeat their
own versions of the flow.  Let's unify it into one helper in wsi.c

Also require the context lock held (this only impacts LWS_MAX_SMP > 1)
2021-01-04 05:26:50 +00:00
Andy Green
9b42fc6aae NetBSD: also need two-arg setpgid
Enable sai
2020-12-07 11:31:53 +00:00
Andy Green
8b82560014 cmake: netbsd: no libdl 2020-12-06 19:39:35 +00:00
Andy Green
962e9ee345 wip: ss c++ classes
C++ APIs wrapping SS client


These are intended to provide an experimental protocol-independent c++
api even more abstracted than secure streams, along the lines of
"wget -Omyfile https://example.com/thing"

WIP
2020-12-02 10:15:50 +00:00
Andy Green
0ff5a1df75 ctest: sspc proxy minimal
CTest does not directly support daemon spawn as part of the test flow,
we have to specify it as a "fixture" dependency and then hack up daemonization
in a shellscript... this last part unfortunately limits its ability to run to
unix type platforms.

On those though, if the PROXY_API cmake option is enabled, the ctest flow will
spawn the proxy and run lws-minimal-secure-strems-client against it
2020-12-01 15:38:20 +00:00
Andy Green
d9d53395e2 windows: threadpool: add back threadpool processing hook for CANCELLED 2020-12-01 15:38:20 +00:00
Yucong Sun
a72e975613 mingw: libevent build fixes 2020-11-28 10:58:38 +00:00
Andy Green
2bcae2b3b6 context: refactor destroy flow 2020-11-28 10:58:38 +00:00
Andy Green
9eb4c4fac2 client: rfc6724 dns results sorting
RFC6724 defines an ipv6-centric DNS result sorting algorithm, that
takes route and source address route information for the results
given by the DNS resolution, and sorts them in order of preferability,
which defines the order they should be tried in.

If LWS_WITH_NETLINK, then lws takes care about collecting and monitoring
the interface, route and source address information, and uses it to
perform the RFC6724 sorting to re-sort the DNS before trying to make
the connections.
2020-11-28 10:58:07 +00:00
Andy Green
22e6d5212b spawn: in discrete env setting case do it readonly
OSX changed to blow a segfault on write to .rodata, exposing that
we're dropping a NUL in what can be .rodata to set the environment
manually.  We don't do this on Linux typically because we take the
code path where execvpe() is available to do the env for us.

Adapt the code to treat it as const, and underscore it by changing
its type to be const char ** in the info struct.
2020-10-19 16:35:03 +01:00
Andy Green
643a001ed8 roles: netlink
This creates a role for RFC3549 Netlink monitoring.

If the OS supports it (currently, linux) then each pt creates a wsi
with the netlink role and dumps the current routing table at pt init.
It then maintains a cache of the routing table in each pt.

Upon routing table changes an SMD message is issued as an event, and
Captive Portal Detection is triggered.

All of the pt's current connections are reassessed for routability under
the changed routing table, those that no longer have a valid route or
gateway are closed.
2020-10-19 16:35:03 +01:00
Andy Green
44e860642b docs: switch to use main 2020-10-19 16:35:03 +01:00
Andy Green
170a5db028 cgi: support evlib_wsi in stdwsi 2020-10-09 21:30:45 +01:00
casey
e44c8698ca windows: null check wsi before udp check 2020-10-09 06:55:02 +01:00
casey
5d025839c6 windows: fix WSA event destruction
pt->events became an array
2020-10-09 06:53:44 +01:00
Andy Green
04d947b6f7 windows: WSA loop fixes 2020-10-08 14:52:54 +01:00
Andy Green
2ad378095d freertos: have lwip choose the cancel pipe port
Rather than a magic port, let's have lwip pick the port for
the UDP cancel "pipe", so no chance of conflict.
2020-10-08 11:21:45 +01:00
Andy Green
ef8bfb2488 windows: build fixes 2020-09-30 06:42:09 +01:00
小明
c8fc7a6f37 ios: adapt to MSG_NOSIGNAL available in iOS SDK 12+ 2020-09-21 12:47:11 +01:00
Orgad Shaneh
2badaef4fc 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-16 07:07:04 +01:00
Andy Green
008b355166 freertos: fixes for build on atmel xdk 2020-09-03 12:49:54 +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