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

4250 commits

Author SHA1 Message Date
Andy Green
b156268521 sse: server: handle close found as HUP 2021-05-23 17:17:33 +01:00
Or Lupovitz
a0bfc98edf mbedtls: server: enforce client cert check when vhost requires 2021-05-23 17:16:32 +01:00
Andy Green
6c39ba15c7 mbedtls: prepare for v3 changes 2021-05-23 17:16:20 +01:00
Andy Green
8a540be959 smd_queue_depth: cast around toolchain int16_t conv warning 2021-05-23 17:16:06 +01:00
Jin Wang
eef783631f sspc: handle DESTROY_ME at proxy link close cb
It's open to user state callback to respond to the DISCONNECT we issue on
the proxy link closure by escalating it to a DESTROY_ME... we have to deal
with that if it comes.
2021-05-20 15:31:36 +01:00
Yichen Gu
6c011f0530 lwip: handle ECONNABORTED on tls read 2021-05-20 14:07:35 +01:00
Andy Green
531f998cf8 smp: fix client tsi detection 2021-05-20 14:07:25 +01:00
Andy Green
fda7294bd0 ss: h2: leave the ss bound to its affiliated wsi until close clears it
In sai, on Xenial (only...) noticed that the wsi is still bound to the ss
handle, and can reference it even after the ss has been destroyed on
ss-testsfail sometimes.

Leave the handle knowing its wsi and able to detach it later during close.
2021-05-20 14:07:11 +01:00
Andy Green
edcf346f9f h2: migration: migrate for_ss
The attribute indicating that a wsi belongs to an SS object also must be
migrated when we split out the original transaction wsi into a new nwsi, if we're
not going to lose track of its affiliation.

Likewise if the affiliated SS object points to the original wsi, we have to
migrate his pointer when we migrate the wsi.

Taking care of this book-keeping is necessary to get correct behaviours at
close-time.
2021-05-20 14:07:01 +01:00
Andy Green
74b96f831a ss: avs: let multipart handle content-type
We added the neccessary return check on set_metadata which is good, but it
doesn't take into account that for LWA, we will normally use the multipart
stuff, that provides its own conflicting content-type.

Currently the lwa streamtype policy doesn't even provide ctype metadata
type, let's just comment it out.
2021-05-20 14:06:51 +01:00
Andy Green
9cd1f4d78b listen: ip bind: force ipv4 if given ipv4 numeric iface 2021-05-20 14:06:39 +01:00
Jed Lu
0a71e0716c cpd: remove scheduled recheck on dns fail 2021-05-20 14:06:29 +01:00
ycyang1229
3fa6b23a08 mbedtls: privkey from file: fix off-by-one 2021-05-20 13:33:00 +01:00
Andy Green
d12e79b8d8 license: fix two old headers from pre-MIT change
These two headers managed to avoid the global switch from
LGPL2.1 -> MIT back in the day, correct them to be aligned
with the rest of lws' own license, ie, MIT.
2021-05-04 18:35:00 +01:00
Andy Green
281931b753 LICENSE: copy secondary license texts into LICENSE as a convenience 2021-05-04 15:54:42 +01:00
Catalin Raceanu
3ae611cdca tls: client: session cache synthetic cb 2021-05-04 15:54:32 +01:00
Yury Is
f1ff43ddea netlink: fix RTM_NEWLINK handling
https://github.com/warmcat/libwebsockets/issues/2287
2021-04-29 12:29:35 +01:00
Yucong Sun
a27cff4c11 cmake: Allow OPENSSL_INCLUDE_DIR to be empty
on some system the include dir is empty, and the detection will miss a lot of functions and fail to compile.
2021-04-29 05:42:38 +01:00
Catalin
2fac32543a tls-sessions: Use OpenSSL API to test if a session was reused 2021-04-27 15:43:36 +01:00
Catalin
dccb61dae7 tls-sessions: Assign loaded TLS session to its intended pointer 2021-04-27 14:50:02 +01:00
Catalin
d9e044b91f Remove incorrect session ref count increment 2021-04-27 14:49:57 +01:00
Marco Gratzke
61a94f5f83 spa: parser should tolerate additional headers 2021-04-27 11:56:40 +01:00
Yichen Gu
112480b570 ss: policy2c: type error on respmap 2021-04-21 19:32:16 +01:00
Andy Green
afb77240ad h2: just log nwsi close and pass thru
User reports problems with the close / retry flow not happening if we don't
pass thru the nwsi close... it may be happening before the sid1 migration.

Just log it and don't end the handling before the passthru.  Logging it
because there was a reason for the change to not passing it through...
2021-04-21 19:32:03 +01:00
Andy Green
a0bebb9f67 ss: proxy: fix conn deref on onward
Trying to use the opaque pointer in the handle to point to the conn isn't
going to work when we need it to point to the ss handle.

Move it to have its on place in the handle.
2021-04-21 19:31:45 +01:00
Andy Green
b746a2c75a netlink: make failure to bind nonfatal 2021-04-20 16:05:46 +01:00
Andy Green
4844ff872b cmake: LWS_WITHOUT_EVENTFD 2021-04-20 16:05:36 +01:00
Andreas Weigel
1a7f5be468 cmake: also set LWS_BUILD_HASH to unknown if no git is found 2021-04-20 16:05:27 +01:00
Andy Green
6bb28ef93c cmake: set unknown as LWS_BUILD_HASH if no git repo 2021-04-19 06:43:55 +01:00
Jin Wang
c3b1254747 client: make sure we get CCE if timeout on server reply
If facing a captive portal, we may seem to get a tcp level connection okay
but find that communication is silently dropped, leading to us timing out
in LRS_WAITING_SERVER_REPLY.

If so, we need to handle it as a connection fail in order to satisfy at
least Captive Portal detection.
2021-04-17 05:43:35 +01:00
Andy Green
9dbc9b9ace README.md decruft 2021-04-15 19:17:04 +01:00
Andy Green
935894f1f7 client: tls: simplify validation fail reporting at CCE
We have access to a simplified report of the problem name for tls
validation inside the validation cb, let's bring it out and
use it for OpenSSL CCE reporting.
2021-04-15 18:45:35 +01:00
Andy Green
5e7617ae9e ss: add test for OS trust store mdoe
It's already the case that leaving off the "tls_trust_store" member of the
streamtype definition in the policy causes the streamtype to validate its
tls connections via the OS trust store, usually a bundle OpenSSL has been
configured to load at init automagically, but also literally the OS trust
store in windows case.

Add tests to confirm that.
2021-04-15 18:43:52 +01:00
Andy Green
1367c11e1e v4.2.0 release 2021-04-15 17:44:02 +01:00
kokke
2850de1afa drivers: spi: avoid leaking uninitialized bits
Before this commit, line 84 read 'u' before it had a value, on 1st for-loop iteration. See comment on line 84 below:

82		for (n = 0; n < 8; n++) {
83			ctx->gpio->set(ctx->clk, inv);
84			u = (u << 1) | !!ctx->gpio->read(ctx->miso); /* <-- u is used uninitialized here */
85			ctx->gpio->set(ctx->mosi, !!(u & 0x80));
86			ctx->gpio->set(ctx->clk, !inv);
87		}
2021-04-15 17:41:53 +01:00
Sergey
0a8f64ad5f cmake: enable user cmake to use FetchContent on lws
export include directories for target `websockets` and `websockets_shared`, see github #2272
2021-04-15 17:41:34 +01:00
Andy Green
4b52d7598c docs: lws_write: decruftify 2021-04-15 17:41:17 +01:00
Chunho Lee
0276f3e635 ss: mqtt: Avoid CONNECTING to DISCONNECTED transition
Check previous states with 'ss_dangling_connected'.
If it did not visit CONNECTED, transit to UNREACHABLE
instead of DISCONNECTED.
2021-04-15 17:34:01 +01:00
Chunho Lee
8c26063828 mqtt: log correct subscribe packet id 2021-04-15 17:33:50 +01:00
Per Bothner
018d443863 http: mimetypes: add mjs as builtin 2021-04-12 06:36:24 +01:00
syldrathecat
aa84d928d8 cmake: export include directory 2021-04-11 12:28:41 +01:00
Andy Green
24abd699f6 http: parser: straighten out %00 legality
https://github.com/warmcat/libwebsockets/issues/2262

This adds a README explaining what can be expected if your URLs contain
%00, and adds a safe helper for urlargs-by-name that is length-based.

Contains fix for extra NUL on some headers

https://github.com/warmcat/libwebsockets/issues/2267
2021-04-10 09:21:33 +01:00
Andy Green
354b29c747 http: redirect: dont try from h2 at the moment
h1->h1, h1->h2 are OK, but h2->anything needs more work.
Just fail it early at the moment.
2021-04-10 09:20:33 +01:00
Andy Green
b28b03eee1 smp: hold pt lock for lws_client_reset removing fds
https://github.com/warmcat/libwebsockets/issues/2268
2021-04-10 06:14:12 +01:00
Mykola Stryebkov
eeed0c07d0 smp: openssl: disallow trying to clean up mutexes twice 2021-04-08 13:02:57 +01:00
Andy Green
402e97a679 ss: metrics: http: just report at wsi close
Defer recording the ss metrics histogram until wsi close, so it has a
chance to collect all the tags that apply.

Defer dumping metrics until the FINALIZE phase of context destroy, so we
had a chance to get any metrics recorded.
2021-04-08 06:47:54 +01:00
Haopeng
2a7ded310f ss: metrics: add result tag reflecting ss txn disposition
For http ss, add a tag result=SS_ACK_REMOTE or SS_NACK_REMOTE
2021-04-08 06:37:35 +01:00
Andy Green
42dc817d8f ss: proxy: get rx flow control working
This fixes the proxy rx flow by adding an lws_dsh helper to hide the
off-by-one in the "kind" array (kind 0 is reserved for tracking the
unallocated dsh blocks).

For testing, it adds a --blob option on minimal-secure-streams[-client]
which uses a streamtype "bulkproxflow" from here

https://warmcat.com/policy/minimal-proxy-v4.2-v2.json

		"bulkproxflow": {
			"endpoint": "warmcat.com",
			"port": 443,
			"protocol": "h1",
			"http_method": "GET",
			"http_url": "blob.bin",
			"proxy_buflen": 32768,
			"proxy_buflen_rxflow_on_above": 24576,
			"proxy_buflen_rxflow_off_below": 8192,
			"tls": true,
			"retry": "default",
			"tls_trust_store": "le_via_dst"
		}

This downloads a 51MB blob of random data with the SHA256sum

ed5720c16830810e5829dfb9b66c96b2e24efc4f93aa5e38c7ff4150d31cfbbf

The minimal-secure-streams --blob example client delays the download by
50ms every 10KiB it sees to force rx flow usage at the proxy.

It downloads the whole thing and checks the SHA256 is as expected.

Logs about rxflow status are available at LLL_INFO log level.
2021-04-07 15:54:26 +01:00
Andy Green
fdc1e1e9a5 sspc: states for proxy failure 2021-04-07 14:48:52 +01:00
Andy Green
877fcc3e4d ss: policy: atoll needed for 32-bit machines
On 32-bit Linux compilers, long int == int == 32-bit.  So even atol() cannot
handle ints above 0x7fffffff and clips any it finds at that.

There's only one instance in policy-json.c, use atoll() cast to uint64_t
to allow values up to 64-bit INT_MAX even on 32-bit machines.
2021-04-07 09:52:04 +01:00