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

3778 commits

Author SHA1 Message Date
Andy Green
614c1e0ff6 coverity: report problem in hpack_dynamic_size() to parent 2021-06-04 14:52:01 +01:00
Andy Green
436bb70919 coverity: h->cwsi must be valid if we are handling rx on it 2021-06-04 14:17:13 +01:00
Jed Lu
5b1a260881 ss: sspc: handle destroy for client_connect and request_tx 2021-05-28 09:41:39 +01:00
Andy Green
f96f2a88de windows: mbedtls: use recv / send 2021-05-27 11:40:44 +01:00
Chunho Lee
c5484c0232 ss-mqtt: Add support for MQTT UNSUBSCRIBE and DISCONNECT
Send UNSUBSCRIBE and DISCONNECT when LWSSSSRET_DISCONNECT_ME is
returned.
2021-05-27 11:37:44 +01:00
Chunho Lee
85cec16f95 mqtt: Add support for QoS 2
Add support for QoS 2.
2021-05-27 11:36:54 +01:00
Jed Lu
ae8b11aa83 ss: do not restrict close handling to WITH_SERVER 2021-05-26 14:07:27 +01:00
Andrey Grafin
4341d756ae netlink: fix UB on RTM_NEWADDR/RTM_DELADDR
this patch makes ubsan (-fsanitize-undefined-trap-on-error) happy.

let's look at the following scenario:
1. netlink sends RTM_NEWADDR/RTM_DELADDR message
2. rops_handle_POLLIN_netlink() handles message attributes as RTA_*
3. rops_handle_POLLIN_netlink() finds RTA_PRIORITY attribute and
handles it as u32 value, but it's IFA_CACHEINFO attribute in reality
and payload holds another type
4. ubsan throws SIGTRAP

so, don't handle RTM_NEWADDR/RTM_DELADDR attributes as RTA_*
2021-05-26 14:07:27 +01:00
Andy Green
c70c4bac89 coverity: ss: handle NULL omd 2021-05-26 14:07:02 +01:00
Andy Green
632ffa1eca ss: deal with missing handle metadata 2021-05-25 14:57:57 +01:00
Andy Green
ad3aa5339e TCP_FASTOPEN 2021-05-25 08:13:13 +01:00
Andy Green
f9ae34c320 sse: server: handle close found as HUP 2021-05-23 14:59:42 +01:00
Or Lupovitz
16328b1918 mbedtls: server: enforce client cert check when vhost requires 2021-05-23 14:58:07 +01:00
Andy Green
8ebe1d9323 mbedtls: prepare for v3 changes 2021-05-23 10:55:52 +01:00
Andy Green
212690fb23 smd_queue_depth: cast around toolchain int16_t conv warning 2021-05-23 10:29:51 +01:00
Jin Wang
2197c2eafc 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:24:42 +01:00
Andy Green
7b315e394f smp: give PROTOCOL_INIT a privake fakewsi
At init-time, PROTOCOL_INIT needs to be sent to each vhost-protocol
combination to give them a chance to instantiate themselves.

PROTOCOL_INIT can be deferred a bit, and since its subject is per vhost,
which has no tsi affinity, in SMP case, its current use of context->pt[0]
fakewsi can clash with other stuff happening simultaneously, eg,
CANCEL_SERVICE broadcast, which happens on each pt.

Solve this by changing PROTOCOL_INIT to use an on-stack fakewsi that cannot
clash with any other service loop use of them.

Take care about using a full fake wsi or an lws_a fakewsi if PLAT_FREERTOS.
2021-05-20 11:29:12 +01:00
ycyang1229
e76ee9cb91 mbedtls: privkey from file: fix off-by-one 2021-05-20 11:28:47 +01:00
Andy Green
ecacbfbbbd mqtt: coverity: help coverity see we wont have an mqtt role wsi without mqtt member allocated 2021-05-17 11:34:30 +01:00
Yichen Gu
febca16a0b lwip: handle ECONNABORTED on tls read 2021-05-17 11:34:28 +01:00
Andy Green
9c6e2ffb65 smp: fix client tsi detection 2021-05-12 09:06:11 +01:00
Andy Green
a3765d118c 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-07 11:12:51 +01:00
Andy Green
3016385671 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-07 10:24:30 +01:00
Andy Green
88c824b89d 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-07 10:15:05 +01:00
Andy Green
19d59f9977 listen: ip bind: force ipv4 if given ipv4 numeric iface 2021-05-06 20:51:43 +01:00
Jed Lu
6595d3da72 cpd: remove scheduled recheck on dns fail 2021-05-06 17:11:27 +01:00
Andy Green
c58532803e 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:33:36 +01:00
Catalin Raceanu
cf867faa46 tls: client: session cache synthetic cb 2021-04-29 20:03:41 +01:00
Yury Is
7247205e40 netlink: fix RTM_NEWLINK handling
https://github.com/warmcat/libwebsockets/issues/2287
2021-04-29 12:28:39 +01:00
Yucong Sun
abada11fe1 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:29:58 +01:00
Catalin
373b50d7d1 tls-sessions: Use OpenSSL API to test if a session was reused 2021-04-27 15:42:53 +01:00
Catalin
d2a40a119e tls-sessions: Assign loaded TLS session to its intended pointer 2021-04-27 14:45:17 +01:00
Catalin
80ca71d598 Remove incorrect session ref count increment 2021-04-27 14:45:14 +01:00
Marco Gratzke
32c4d2cb29 spa: parser should tolerate additional headers 2021-04-27 11:54:06 +01:00
Andy Green
2dba500d4f 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 16:05:24 +01:00
Andy Green
891f28b43e 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 10:02:00 +01:00
Andy Green
ff8912ba96 netlink: make failure to bind nonfatal 2021-04-20 16:05:01 +01:00
Andy Green
350284590c cmake: LWS_WITHOUT_EVENTFD 2021-04-20 14:58:23 +01:00
Jin Wang
af1a79c3e5 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:42:10 +01:00
Andy Green
1a6c2a634e 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 19:10:54 +01:00
Andy Green
aa6b3f418e mbedtls: allow central trust store preload
Mbedtls does not have the same concept as openssl about preloading the
system trust store into every SSL_CTX.

This patch allows you to simulate the behaviour by passing in a context
creation-time filepath that all client SSL_CTX will be initialized from.
2021-04-15 19:10:54 +01:00
Andy Green
68d9f3a7f2 ss: wire up EVENT_WAIT_CANCELLED
Currently the lws_cancel_service() api only manifests itself at lws level.
This adds a state LWSSSCS_EVENT_WAIT_CANCELLED that is broadcast to all
SS in the event loop getting the cancel service api call, and allows
SS-level user code to pick up handling events from other threads.

There's a new example minimal-secure-streams-threads which shows the
pattern for other threads to communicate with and trigger the event in the
lws service thread.
2021-04-15 19:10:54 +01:00
Andy Green
5b6a89f79d 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 19:10:54 +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
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