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
77055c4fd7 noserver: set tag_prefix for SERVER 2021-01-11 08:12:46 +00:00
Jed Lu
780a165a76 ss: http: mime parsing with unusual section boundaries 2021-01-11 08:12:46 +00:00
Andy Green
c86e1c5b56 cpd: lws_system_cpd_start_defer 2021-01-11 08:12:46 +00:00
Andy Green
60b5ca649e server_status: adapt for tags 2021-01-11 08:12:46 +00:00
Andy Green
d5178f477f client: HUP: defer POLLUP handling while buffered rx
If the server is very close in rtt to the client, the server
hangup may get processed before buffered rx.

Make sure we clear buffered rx before dealing with the HUP.
2021-01-11 08:12:46 +00:00
Andy Green
aa45de9e2a ss: enforce only valid state transitions
The various stream transitions for direct ss, SSPC, smd, and
different protocols are all handled in different code, let's
stop hoping for the best and add a state transition validation
function that is used everywhere we pass a state change to a
user callback, and knows what is valid for the user state()
callback to see next, given the last state it was shown.

Let's assert if lws manages to violate that so we can find
where the problem is and provide a stricter guarantee about
what user state handler will see, no matter if ss or sspc
or other cases.

To facilitate that, move the states to start from 1, where
0 indicates the state unset.
2021-01-11 08:12:43 +00:00
Andy Green
47905401fa sspc: clear proxy conn timeout on ack
Remember to clear the 3s timeout set at sspc -> client connection, covering
the case that the SS serialization initial handshake doesn't take place
2021-01-05 10:56:38 +00:00
Andy Green
a82be3bd39 sspc: allow NULL rx and state in ssi
Sometimes there's no need for .tx or even .state... make sure we are OK with
that in the ssi by checking before sspc callthrus
2021-01-05 10:56:38 +00:00
Andy Green
629ccd4db8 sspc: ssv1: return policy about client dsh allocation
Let's allow the proxy to pass back what the policy says about
the size of dsh buffer the client side of this streamtype
should have.

Defer clientsize dsh generation until we got the info back
from the proxy in the response to the initial packet.  If
it's zero / unset in the policy, just go with 32KB.
2021-01-05 10:56:38 +00:00
Andy Green
1033e1d4c8 sspc: ssv1: pass client PID into proxy for tagging
Let's have the client processes pass in their pid, and tag the related proxy SS
with that pid, so we can see on whose behalf the proxy is acting.
2021-01-05 10:56:38 +00:00
Andy Green
4fc4c671fa sspc: ssv1: add serialization protocol versioning
Let's add a byte on the first message that sspc clients send,
indicating the version of the serialization protocol that the
client was built with.

Start the version at 1, we will add some more changes in other
patches and call v1 (now it has the versioning baked in)
the first real supported serialization version, this patch must
be applied with the next patches to actually represent v1
protocol changes.

This doesn't require user setting, the client is told what version
it supports in LWS_SSS_CLIENT_PROTOCOL_VERSION.  The proxy knows
what version(s) it can support and loudly hangs up on the client
if it doesn't understand its protocol version.
2021-01-05 10:56:38 +00:00
Jed Lu
c82910d30c ss: auth: sigv4
Add SS pieces for Sigv4 auth support
2021-01-05 10:56:38 +00:00
Andy Green
a8d6ac8923 netbsdBE: enable ctest and fix test cert generation
NetBSD test server cert gen lacked a CN, add it for localhost

Enable Sai -j6 from -j4 for netbsdBE... it's slow but it is SMP

Add build in sai for secure-streams-proxy scenario
2021-01-05 10:56:38 +00:00
Andy Green
abc60c755a smd: add more scenarios to tests
Let's have 4 x forked clients all intercommunicate via the SS proxy,
and add it to ctest.
2021-01-05 10:56:38 +00:00
Andy Green
8ff35b819a smd-add-ss-rx-forwarder-helper
Add a helper to simplify passing smd ss rx traffic into the local
smd participants, excluding the rx that received it externally to
avoid looping.

Make the smd readme clearer with three diagrams and more explanation
of how the ss proxying works.
2021-01-05 10:56:38 +00:00
Andy Green
962993fd24 smd: add ss tx helper 2021-01-05 10:56:38 +00:00
Andy Green
42accd576a smd: make ss smd follow normal state flow 2021-01-05 10:56:38 +00:00
Andy Green
619ef5eb17 smd: add use class base index
In addition to the well-known classes, add a user class base bit offset
so distributed user applications can cleanly send messages using SMD
2021-01-05 10:56:38 +00:00
Andy Green
4b2c0fdc1d smd: lock when removing messages 2021-01-05 10:56:38 +00:00
Andy Green
940abe557a ss: policy: add auth mapping section 2021-01-05 10:56:38 +00:00
Andy Green
ce3b99cd8f clean: reduce logging and add some conditional debug helpers 2021-01-05 10:56:38 +00:00
Andy Green
c48bebc9ae h2: post: http_action: issue _HTTP and consume deferred body when resuming
When we have to defer http_action for a stream because we may not have
any writeability, we stash any incoming body on the rx buflist for the wsi
which is good.

But when we resume under some conditions, we don't issue the _HTTP cb and
don't drain the stashed body.  It's cleaned out in the close flow, but it's
broken.

This makes the deferred resume flow do the right thing under those conditions.
2021-01-05 10:56:38 +00:00
Andy Green
5af65114c9 cgi: modernize sul usage 2021-01-05 10:56:38 +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
cef8ce81f7 client: dns-sort: classify on no source if dest ads 2021-01-05 10:56:38 +00:00
Andy Green
cb1e893e2d client: connect: use memmove due to possible overlap 2021-01-05 10:56:38 +00:00
Andy Green
815b9074fc lws-struct: json and sqlite on 32-bit OS
Test that we can handle int -1 correctly on sqlite and
greater than 32-bit unsigned on json with ull
2021-01-05 10:56:26 +00:00
Andy Green
1422b23899 dll2: explicitly confim detached dll2 has no linkage 2021-01-04 05:40:12 +00:00
Andy Green
b2898b5bfc lejp: allow for no cb on unprepared lejp on destroy
On an error path, we might not have a valid spa / lejp to destroy.
In that case, don't hurl ourselves into calling a
function pointer that can be NULL for the destroy cb.
2021-01-04 05:40:12 +00:00
Andy Green
3ced2a4f90 sys: blob: appended bugflist blob offset by LWS_PRE 2021-01-04 05:40:12 +00:00
Andy Green
454d173aea sys vh: set NO_LISTEN 2021-01-04 05:40:12 +00:00
Andy Green
38496b9184 smp: connect3: hold pt lock when removing failed connect attempt 2021-01-04 05:40:12 +00:00
Andy Green
0d720082fb ss: smd: make sure to cancel write sul 2021-01-04 05:40:12 +00:00
Andy Green
a13b34db1c smd: add warning for queue depth 2021-01-04 05:40:12 +00:00
Andy Green
e11d78dc5e sspc: cleanup bridged wsi 2021-01-04 05:40:12 +00:00
Andy Green
905e5373c6 ss: proxy_buflen in policy sets proxy max dsh alloc per streamtype 2021-01-04 05:39:06 +00:00
Andy Green
93f54c61c5 ss: enforce balanced CONNECT vs DISCONNECT 2021-01-04 05:26:50 +00:00
Andy Green
b5d656058f tags: prefix tags with pid if SS_PROXY_API
Make the logs a bit easier to understand when dealing with tagged objects,
when multiple client processes active, including at the proxy
2021-01-04 05:26:50 +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
ac6a582254 protocol_init: ensure its happening without client 2020-12-27 08:42:02 +00:00
Andy Green
3234201531 lws_struct: sqlite: use incoming ac ptr as well as set on exit 2020-12-27 08:42:02 +00:00
Andy Green
54e909a126 mbedtls: tls flow for mqtt 2020-12-27 08:42:02 +00:00
Andy Green
d98c9310e1 ss: UNREACHABLE: set ordinal in state cb b0 if due to DNS server reachability issue
For LWSSSCS_UNREACHABLE state, the additional ord arg has b0 set if the
reason for the unreachability is because the DNS server itself was not
reachable (implying either DNS server is wrongly set, or is not reachable
due to not having connectivity through to it)
2020-12-27 08:42:02 +00:00
Andy Green
556154c3c9 cpd: trigger if getaddrinfo failed
If getaddrinfo() is not able to reach the server, there may be
a connectivity problem downstream of the device that has not
been recognized by the Captive Portal Detect pieces yet.

If it looks like that might have happened, used the getaddrinfo()
return to provoke a new CPD scan.
2020-12-27 08:42:02 +00:00
Andy Green
094bfc4e99 ss-hx: make sure hanging_some handled once 2020-12-27 08:41:58 +00:00
Andy Green
097bbbd1eb ss: client_connect and request_tx also return dispositions
Since client_connect and request_tx can be called from code that expects
the ss handle to be in scope, these calls can't deal with destroying the
ss handle and must pass the lws_ss_state_return_t disposition back to
the caller to handle.
2020-12-24 16:14:36 +00:00
Andy Green
747ea560a0 ss: cpd: ignore new requests while ongoing up to timeout 2020-12-24 16:14:36 +00:00
Andy Green
19e7bc106e sspc: allocate dsh once per stream 2020-12-24 16:14:36 +00:00