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

180 commits

Author SHA1 Message Date
Andy Green
fb6a7c8131 coverity 472861: http2: deal with zero length data without overflow 2025-01-22 08:43:45 +00:00
Andy Green
aff5bb43e4 coverity 472860: ops-h2: let coverity see all err enums covered
x
2025-01-22 08:43:45 +00:00
Andy Green
b71a6621b0 h2: file upload: avoid feeling too much POST
https://github.com/warmcat/libwebsockets/issues/3070
2024-02-17 12:34:14 +00:00
Andy Green
24c37d1ea1 h2: reply with selected extension 2023-11-23 09:45:12 +00:00
Carsten Schuette
52597bf012 clean: gcc13 false positive uninitialized
https://github.com/warmcat/libwebsockets/issues/3004
2023-11-23 09:45:11 +00:00
Philippe Coval
a6a7fa646e fix: l/r/h/http2.c: Fix spelling mistake
Fix spelling mistake it was found while packaging mosquito for debian:

I: mosquitto: spelling-error-in-binary Inital Initial [usr/sbin/mosquitto]
I: mosquitto: spelling-error-in-binary witholding withholding [usr/sbin/mosquitto]

Forwarded: https://github.com/warmcat/libwebsockets/pull/2927
Signed-off-by: Philippe Coval <rzr@users.sf.net>
2023-09-21 13:08:11 +01:00
Orefkov
6e3221cd1a h2: access log: POST: prepare log
https://github.com/warmcat/libwebsockets/issues/2608
2022-04-11 08:33:29 +01:00
Andy Green
67931757f8 alloc: compressed backtrace instrumentation support
This adds apis that enable usage of compressed backtraces in heap
instrumentation.

A decompressor tool is also provided that emits a textual
call stack suitable for use with addr2line.
2022-03-15 10:28:09 +00:00
Andy Green
4bf39f55d4 h2: improve logging for zero length DATA with EOS 2022-03-15 10:28:09 +00:00
Andy Green
0ca97586d6 mbedtls: improve api detection
mbedtls cmake api detection was not able to work on esp-idf well.

Improve diagnostics and reaction if we ever see that again.
2022-02-01 11:09:48 +00:00
Andy Green
ac5bb1c47f h2: post: do not try to bind origin for files 2021-11-17 14:50:05 +00:00
Andy Green
0993543ac8 adopt: improve wsi tags for listen
async-dns has to keep a listener on udp:53, but its tag doesn't really give
a clue what it is

[1534033|wsisrv|0|adopted]

this patch improves it and moves the decision about putting the server wsi
in SERVER or MUX group to the caller instead of guessing from the desc
name.

[1549684|wsisrv|0|system|asyncdns]
2021-10-29 15:41:52 +01:00
oaleshina
17199959aa h2: ping pong: separate payloads
https://github.com/warmcat/libwebsockets/pull/2413
2021-10-05 07:09:37 +01:00
Andy Green
3892a9d21c h2: bulk rx: deal with window
We don't always keep updating the rxflow window on bulk rx, and just run
down the initial.  This keeps us going with 64K in flight
2021-08-31 05:45:40 +01:00
Yichen Gu
b31c5d6ffe http: cookies: support cookie jar in and out 2021-08-21 17:44:40 +01:00
Gopi Rao
1348632d14 h2: plat: fix plat SETTINGS override
The FREERTOS plat has its own h2 SETTINGS, but although they are used, they
get overridden with the lws default SETTINGS during pt init.

Let's not do that if someone else has already touched the context set.
2021-08-19 05:31:15 +01:00
Andy Green
5f31ff8383 h2: data: frame header already parsed out 2021-08-09 17:31:16 +01:00
Andy Green
fabe78d222 Wextra
Add -Wextra (with -Wno-unused-parameter) to unix builds in addition to
-Wall -Werror.

This can successfully build everything in Sai without warnings / errors.
2021-07-04 10:29:54 +01:00
Andy Green
272dba8307 http: redo redirects to follow close flow
Until now although we can follow redirects, and they can promote the
protocol from h1->h2, we couldn't handle h2 wsi reuse since there are many
states in the wsi affected by being h2.

This wipes the related states in lws_wsi_reset() and follows the generic
wsi close flow before deviating into the redirect really close to the end,
ensuring we cleaned out evidence of our previous life properly.

h2->h2 redirects work properly after this.

The max number of redirects is increased from 3 -> 4 since this was seen in
the wild with www and then geographic-based redirects.
2021-06-22 15:55:29 +01:00
Andy Green
614c1e0ff6 coverity: report problem in hpack_dynamic_size() to parent 2021-06-04 14:52:01 +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
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
7d8f742594 smp: more lock assertions 2021-04-05 10:55:04 +01:00
Andy Green
51490ae6e6 Fault injection
add lws_xos: xoshiro256 PRNG
2021-04-05 10:55:04 +01:00
Andy Green
ffb49e2612 http: post: defer body pending end until no more buffered out 2021-03-25 08:40:52 +00:00
Andy Green
50e1f1ed13 h2: dont try to get ahead of POST if its a cgi mount or proxied 2021-03-25 08:40:52 +00:00
Andy Green
06509e287d lws_conmon: connection monitoring and stats generation
This provides a build option LWS_WITH_CONMON that lets user code recover
detailed connection stats on client connections with the LCCSCF_CONMON
flag.

In addition to latencies for dns, socket connection, tls and first protocol
response where possible, it also provides the user code an unfiltered list
of DNS responses that the client received, and the peer it actually
succeded to connect to.
2021-03-17 07:31:49 +00:00
Andy Green
3f4623bb36 lws_metrics
There are a few build options that are trying to keep and report
various statistics

 - DETAILED_LATENCY
 - SERVER_STATUS
 - WITH_STATS

remove all those and establish a generic rplacement, lws_metrics.

lws_metrics makes its stats available via an lws_system ops function
pointer that the user code can set.

Openmetrics export is supported, for, eg, prometheus scraping.
2021-03-08 21:47:28 +00:00
Andy Green
ede7f8b0f3 ss: support huge urls 2021-03-05 14:13:26 +00:00
Andy Green
09b9ac6e33 minimal-http-client: set option to fix broken server window update 2021-02-28 12:10:26 +00:00
Andy Green
f42c97baa9 route: on change also check source address still extant 2021-02-17 11:39:12 +00:00
Andy Green
611e6477fd h2: post: handle lws_h2_bind_for_post_before_action error 2021-02-01 19:12:54 +00:00
Andy Green
d73c4baab2 options: fixes
sai: add default-noudp and windows plats for noserver
2021-02-01 15:19:38 +00:00
Yichen Gu
403a6591e1 h2: client: handle END_STREAM and END_HEADERS togther on all paths 2021-01-29 21:22:35 +00:00
Andy Green
1236114303 h2: client: action END_STREAM and END_HEADERS immediately 2021-01-23 20:58:39 +00:00
Andy Green
bf9c517b39 set-cookie: force semicolon for concatenation 2021-01-22 12:25:03 +00:00
Andy Green
95a545b741 evlib: count extant evlib handles instead of wsi 2021-01-19 17:07:33 +00:00
Andy Green
46c925e3b7 h2: post: adapt in on _HTTP to be after mountpoint 2021-01-18 19:49:04 +00:00
Andy Green
e5b191be35 h2: post buflist: track rx_content_length
On h2 server POST, there's a race to see if the POST body is going to be
received coalesced with the headers.

The problem is on h2, we can't action the stream http request or body until
the stream is writeable, since we may start issuing the response right away;
there's already DEFERRING_ACTION state to manage this.  And indeed, the
coalesced, not-immediately-actionable POST body is buflisted properly.

However when we come to action the POST using buflisted data, we don't follow
the same pattern as dealing with the incoming data immediately.

This patch aligns the pattern dumping the buflist content to track
expected rx_content_length and handle BODY_COMPLETION if we got to
the end of it, along with removal from the pt list of wsi with pending
buflists if we used it up.
2021-01-18 19:49:02 +00:00
Andy Green
9be508bdd7 h2: make sure we see END_STREAM with END_HEADERS on client 2021-01-15 19:54:14 +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
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
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
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
eb5f437578 h2: post: add states to wait for body 2020-12-24 16:14:36 +00:00
Andy Green
677b6e370c h2: remove length tracking just use pointer arithmetic 2020-12-24 16:14:36 +00:00
Andy Green
e560d2c049 h2: stay a client if a client 2020-12-24 16:14:36 +00:00
Andy Green
587f24f71d clean: remove h2 debug spew 2020-12-06 19:06:05 +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