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

4581 commits

Author SHA1 Message Date
Andy Green
4343182002 logging: reduce serving logs 2020-12-01 15:38:20 +00:00
Andy Green
7d355912c3 h2: fix ignoring unknown frame payloads 2020-12-01 15:38:09 +00:00
Andy Green
10714c58e9 h2: ignore unknown frame types a bit earlier
Chrome has started being able to issue frame type 0x42, we drop the connection
before we realize we wanted to ignore it.

This explicitly ignores it a bit earlier.
2020-11-28 10:58:38 +00:00
Jed Lu
e815ad2920 ss: handle nonzero content-length set by metadata correctly 2020-11-28 10:58:38 +00:00
Andy Green
426623433a ss-srv: destroy accepted clients on ws close 2020-11-28 10:58:38 +00:00
Andy Green
b4af4bf025 docs: lwsac doxygen 2020-11-28 10:58:38 +00:00
Yucong Sun
a72e975613 mingw: libevent build fixes 2020-11-28 10:58:38 +00:00
Andy Green
acfd3491b9 http: REDIRECT_HTTP_TO_HTTPS apply the original path to redirect
Let's regenerate the path and urlargs part on the redirect, for the case we
are forcing clients to redirectto the same place but with tls


https://github.com/warmcat/libwebsockets/issues/2112
2020-11-28 10:58:38 +00:00
Andy Green
d1958ee2ea sspc: check for client handle use before CREATING
When ss is proxied, the handle CREATING state is deferred until the handle links up
to the proxy.  So user code should only start using it when it sees CREATING.  If it
tries to use it before then, we won'tget anywhere but we should make sure not to crash
on the NULL proxy link cwsi.
2020-11-28 10:58:38 +00:00
Andy Green
922b939521 h1only: fix assumption about h2 and add sai
Fix an assumption about h2 being around if h1 is that crept in.

Add a sai scenario to catch this kind of problem, only needs one
build since testing lws' own consistency... add WITH_MINIMAL_EXAMPLES
as well
2020-11-28 10:58:38 +00:00
Mykola Stryebkov
a03181301d smp: minimal client with several active connections 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
3549a94ce6 roles: compress role ops structs
role ops are usually only sparsely filled, there are currently 20
function pointers but several roles only fill in two.  No single
role has more than 14 of the ops.  On a 32/64 bit build this part
of the ops struct takes a fixed 80 / 160 bytes then.

First reduce the type of the callback reason part from uint16_t to
uint8_t, this saves 12 bytes unconditionally.

Change to a separate function pointer array with a nybble index
array, it costs 10 bytes for the index and a pointer to the
separate array, for 32-bit the cost is

2 + (4 x ops_used)

and for 64-bit

6 + (8 x ops_used)

for 2 x ops_used it means 32-bit: 10 vs 80 / 64-bit: 22 vs 160

For a typical system with h1 (9), h2 (14), listen (2), netlink (2),
pipe (1), raw_skt (3), ws (12), == 43 ops_used out of 140, it means
the .rodata for this reduced from 32-bit: 560 -> 174 (386 byte
saving) and 64-bit: 1120 -> 350 (770 byte saving)

This doesn't account for the changed function ops calling code, two
ways were tried, a preprocessor macro and explicit functions

For an x86_64 gcc 10 build with most options, release mode,
.text + .rodata

before patch:          553282
accessor macro:        552714 (568 byte saving)
accessor functions:    553674 (392 bytes worse than without patch)

therefore we went with the macros
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
d38d1176ca clean: client connect 2020-11-26 09:23:30 +00:00
Andy Green
1b7c0a08fc udp: convert to sa46
Let's stop using sockaddr and migrate to lws_sockaddr46 so the udp path
works more the same as the tcp / uds client connect path.
2020-11-26 09:23:30 +00:00
Andy Green
495a966302 mqtt: lws_system blobs for password username 2020-11-26 09:23:30 +00:00
Jed Lu
0f98972ab5 ss: skip null metadata 2020-11-26 09:23:30 +00:00
Andy Green
cab63090e6 osx: work around some big sur machines getting MAX_LONG ulimit -n 2020-11-26 09:23:30 +00:00
Michael Johanssen
bd45526af3 cmake: windows: update FindOpenSSLbins.cmake 2020-11-26 09:23:24 +00:00
Yichen Gu
544b668605 sspc: lws_sspc_handle_t pointer in wsi used after free 2020-11-12 19:54:27 +00:00
Andy Green
3216d4d087 ss: server: add foreach client cb api
Server SS maintains a list of accepted client ss, add an api allowing
iterating through the clients via a user callback.
2020-11-11 06:58:20 +00:00
Andy Green
0d31b7a154 buflist: additional helpers 2020-11-09 07:40:40 +00:00
gaoshan
4189d80e95 cmake: support iOS armv7 build 2020-11-09 07:40:40 +00:00
Andy Green
1476e60e75 ss: server: support unix sockets 2020-11-09 07:40:40 +00:00
Andy Green
6bc5c0ffac reduce debug logging 2020-11-09 07:40:35 +00:00
Yichen Gu
3bfa00de19 ss: h2: ACK/NACK missing in H2 state flow 2020-11-02 12:03:16 +00:00
Pino Toscano
c623ebfe87 context: properly check for sys/resource.h
Instead of hardcoding where sys/resource.h is available, check for it
using cmake.
2020-11-01 12:14:19 +00:00
Andy Green
b4e3bc381c sai: win10 no pthreads and debian buster 32-bit 2020-10-29 19:48:34 +00:00
Andy Green
de2fa67478 ss: policy: cast uint32 lwsl_err arg to unsigned int
Some toolchains typedef uint32_t to unsigned long
2020-10-29 19:46:00 +00:00
Andy Green
c674181136 ss: fix without server 2020-10-29 19:41:08 +00:00
Andy Green
5c988d7714 plugins: more explicit header inclusion
32-bit Debian doesn't have these included by other includes
already and needs them explicitly.
2020-10-26 11:24:21 +00:00
Andy Green
664992aea5 sai: plugins 2020-10-26 11:16:56 +00:00
Andy Green
0ba400ce81 sai: debian 2020-10-26 09:05:46 +00:00
Andy Green
942f46b7d4 lwsws: add -n to allow skipping lws plugins dir 2020-10-20 11:06:12 +01:00
Andy Green
c2271b4ec6 sai: tls: test openssl 3 without gencrypto
Gencrypto needs work to adapt against deprecated openssl 3 apis (about
100 apis).  But we can still test it without gencrypto, for use with
socket connections generally, where it is working.
2020-10-19 16:35:03 +01:00
bbqz007
b168fa4157 libevent: fix typo in signal handler
https://github.com/warmcat/libwebsockets/issues/2095
2020-10-19 16:35:03 +01: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
8eef15f3aa docs: ss: update client state lifecycle with destroy api note 2020-10-19 16:35:03 +01:00
krismattheus
b011a915ed cmake: add windows version resources to library
Signed-off-by: krismattheus <kris.mattheus@visionbms.com>
2020-10-19 16:35:03 +01:00
owent
dddc68ec2d netlink: check for RTA_PREF before use
Old kernels like v3.10 don't have it

 [#2079](https://github.com/warmcat/libwebsockets/issues/2079)
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
915f888f3e sa46: network check
This adds a helper to test if an sa46 is on an sa46-based subnet.

The compare helper is adapted to say that non INET/INET6 addresses with
the same AF match.
2020-10-19 16:35:03 +01:00
Andy Green
21719898e8 wsi: store peer lws_sockaddr46
If we connect out to an IP address, or we adopt a connected socket,
from now on we want to hold the peer sockaddr in the wsi.

Adapt ACCESS_LOG to use this new copy rather than keep the
stringified version.
2020-10-19 16:35:03 +01:00
Andy Green
67d24d7c00 cleaning 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
1ee190304e README.md: master to main transition 2020-10-19 16:35:02 +01:00
Andy Green
4e973c3cc5 ss: metadata: rename value to add reminder about heap 2020-10-19 16:34:54 +01:00
Andy Green
657cadf7c6 http: bind PUT and friends to mounts 2020-10-10 06:52:42 +01:00
casey
eddecea3c8 fix zombie sul detection
The cmake define isn't exported, and msvc objects to void * comparision to
non void *.

Also dump the callback pointer with any errors, since after looking it up
in your mapfile this is usually enough to understand which sul and when it
was set.
2020-10-10 06:43:32 +01:00