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

3618 commits

Author SHA1 Message Date
Andy Green
e560d2c049 h2: stay a client if a client 2020-12-24 16:14:36 +00:00
Jed Lu
3c661ede9e ss: http: make sure we dont duplicate leading path slash if already present 2020-12-24 16:14:36 +00:00
Andy Green
68afe5b492 ss: minimal example: testsfail
A minimal example aimed at various SS failure paths.
2020-12-24 16:14:36 +00:00
Andy Green
36de3d8300 ss: h2: dont report nwsi close
SS protocol doesn't want to hear about the nwsi closing after
any streams on the protocol closed.
2020-12-24 16:14:36 +00:00
Andy Green
cdbd50a2e6 dns-sort: reduce logging to info 2020-12-24 16:14:36 +00:00
Andy Green
3cd5492a15 client: reject mux same endpoint conn on h1 if no h1 alpn
With synthetic tests, we can have an h1 connection open to a server
and ask for an h2-specific connection to the same thing... lws will
bind it to the idle h1 connection since the endpoint and tls matches.

This also makes it check that the alpn filtering matches h1 before
allowing that.
2020-12-24 16:14:36 +00:00
Andy Green
828b5cae24 ss: h2: set alpn
In order to force h2, we need to specify the client acceptable alpn as h2
2020-12-24 16:14:36 +00:00
Andy Green
8312ff499e ss: clean up wsi when handling DESTROY_ME 2020-12-24 16:14:36 +00:00
Andy Green
e8420f31e8 ss: h1: also handle 429 same as 503 2020-12-24 16:14:36 +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
587f24f71d clean: remove h2 debug spew 2020-12-06 19:06:05 +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
3952c2598d zip-fops: example: add concompressed mount too 2020-12-01 16:30:19 +00:00
Andy Green
2329dc6968 zip-fops: example: correct zipfile serving path 2020-12-01 15:38:20 +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
a1d86d89fa async-dns: fix error path 2020-12-01 15:38:20 +00:00
Andy Green
b3ddd3db17 libuv: context creation fails via destroy
When using a foreign libuv loop, context creation may fail after adding
handles to the foreign loop... if so, it can no longer deal with the
fatal error by unpicking the created context and returning NULL... it
has to brazen it out with a half-baked context that has already started
the destroy flow and allow the foreign loop to close out the handles
the usual way for libuv.

https://github.com/warmcat/libwebsockets/issues/2129
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
Andy Green
5f3cb5ad77 ss: ss timeout also handle DISCONNECT_ME 2020-12-01 15:38:20 +00:00
Andy Green
02f414bbe2 sspc: log client tx not implementing destroy 2020-12-01 15:38:20 +00:00
Yichen Gu
76fd7319be sspc: double free + rx ret not checked
Change-Id: I81b67cbb28591a20842fc7d6e09b78375845aae4
2020-12-01 15:38:20 +00:00
Andy Green
ba062ee9e3 eventlibs: add cwd and LD_LIBRARY_PATH to dirs
If not found in the cwd or the LIB_INSTALL path, then go through
the paths in LD_LIBRARY_PATH as well looking for the event lib
plugin
2020-12-01 15:38:20 +00:00
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
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
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
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
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
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
bbqz007
b168fa4157 libevent: fix typo in signal handler
https://github.com/warmcat/libwebsockets/issues/2095
2020-10-19 16:35:03 +01:00