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

4583 commits

Author SHA1 Message Date
Andy Green
1c3b7a2653 cgi: also use explicit env setting for OSX
...if no execvpe...
2020-07-17 13:49:14 +01:00
Andy Green
886e93265a struct-lejp: handle no path match
For some patterns of JSON we return to parse at the outermost level and
meet a situation path_match is 0.  In some places we're looking at things
from perspective of path_match - 1... that does not seem to cause trouble on
x86_64 but can on aarch64, which is how it got noticed.

This logically protects those accesses by checking !!path_match.
2020-07-15 16:18:00 +01:00
Andy Green
30761e760a sul: LWS_WITH_SUL_DEBUGGING 2020-07-15 16:18:00 +01:00
Andy Green
f63b10d725 ss: auth: update LWA plugin to use state return enums 2020-07-15 16:18:00 +01:00
Andy Green
e936c5e84d changelog: prepare for v4.1
Having an -rc1 this time
2020-07-15 16:18:00 +01:00
Andy Green
006eeaa6a0 ws: correctly handle ESTABLISHED rejecting connection
https://github.com/warmcat/libwebsockets/issues/1973
2020-07-15 16:18:00 +01:00
Andy Green
abf9a7664f esp32: ctest: increase timeout for linkup and test to 60s 2020-07-15 16:18:00 +01:00
Andy Green
f21226ca3e mqtt: remove fcntl.h
These aren't needed and can make trouble in lwip case
2020-07-15 16:18:00 +01:00
Jed Lu
677d79cc08 ss: rideshare: fix length can be wrong 2020-07-15 16:18:00 +01:00
Andy Green
dfa9423983 coverity: missing malloc return check
This is only coming at vhost startup, for a server that's before we
go busy with heap.  But still, it should be checked.
2020-07-15 16:18:00 +01:00
Andy Green
6762c7367f remove: old esp32 helper pieces
The old esp32 -factory stuff along with the lws support doesn't have a
future in its old form.  It has users but the ratio of effort to
contribution is really especially bad.  I haven't updated it for more
than a year since esp-idf changes broke the original stuff.

Freertos plat is alive and well and getting a lot of new use, ESP-32 is
supported both there and by modern lws_drivers pieces, including in CI
on real hardware, any further effort will be invested in that direction
instead of more vendor api-specific code (outside of wrapper
implementation).

lws_drivers wraps any SDK apis in generic lws apis such that your code
just uses those, enabling it to become SDK / SoC / vendor independent.
Its first implementation is on esp-idf, the low and mid-level features
that were in the old -factory are already available using that and
new technologies like lws_struct and Secure Streams.
2020-07-15 16:18:00 +01:00
Andy Green
599625be34 remove: generic sessions
As far as I know there are no users of this, although it worked
it's basically unmaintainable due to handling the sql and JSON
manually.

Gradually better capabilities have appeared in lws, like
lws_struct abstracting out the sql and JSON, and now generic
JWT... these have been used in Sai to great effect and displaced
the only organic would-be user of this.

There is a better path to do this stuff now and no point keeping
this around.
2020-07-15 16:18:00 +01:00
Andy Green
634a97ad79 lws_jwt_token_sanity 2020-07-15 16:18:00 +01:00
Andy Green
08b9a31e20 lws_json_simple: allow running into end
If the arg is unquoted, it's normal to run into the
end finding its extent.
2020-07-15 16:18:00 +01:00
Andy Green
77530f8ccb jwt: sign and create jws helper 2020-07-15 16:17:59 +01:00
Andy Green
5b3ea74b77 jwt: validate jws helper
Introduce a signed JWT validation helper
2020-07-15 16:17:59 +01:00
Andy Green
0bcfe88381 lws_http_cookie_get 2020-07-15 16:17:59 +01:00
Andy Green
cf41c3e793 jws: compact representation helper must use dots 2020-07-15 16:17:59 +01:00
Andy Green
4a5f1d83c2 ss: proxy: make sure state is always available in ssi 2020-07-15 16:17:59 +01:00
Andy Green
1ae6ce37d3 lws_dll2: add helper for typed object name from owner list
There's a good pattern that's encouraged by using lws_struct pieces, that
we have an lws_dll2 owner with an array of objects listed in it that exist
in an lwsac.  And because it came from JSON, there is tending to be a
logical name for the objects.

This adds a typed helper and wrapper to scan the owner list looking for
a specific name (of a specified length, not NUL terminated) in a specific
member of the listed objects, which must be a NUL-terminated const char *.
Again this is a good pattern that's encouraged by use of lws_tokenize
to recover the name we're looking for.

So it leads to the helper that can cleanly search for a listed object of the
right name from an owner, and return the typed object pointer or NULL, from a
length-specified string.
2020-07-09 15:30:34 +01:00
Andy Green
6b3221ffc1 mbedtls: only free crt_parse when something came back
Mbedtls mbedtls_x509_crt_parse() returns 0 for success which is good.
But it has a complicated idea about what to return on fail... if it
couldn't make even one cert from the data, then it returns a negative
return indicating the parsing problem and there is nothing to free.

If it managed to parse at least one cert, instead it retuns a positive
number indicating the number of certs it didn't parse successfully,
and there is something to free.

Adapt the code to understand this quirk.
2020-07-09 15:30:34 +01:00
Andy Green
73424ae66a ss: proxy: smd: use correct zombie vs message check 2020-07-08 19:47:55 +01:00
Andy Green
650a8781e9 ss: client: clear timeout when connection acknowledged 2020-07-08 19:20:03 +01:00
Andy Green
6b639e6a81 coverity: force amount to 0 before read call 2020-07-08 18:27:47 +01:00
Andy Green
4939b87e66 lws_netdev: use lws_settings
Perform the AP selection using lws_settings and a generic scan state machine
2020-07-07 15:23:19 +01:00
Jed Lu
ed528b59f7 ss: client: add sspc_to_user_obj
Helper api exists in direct lws_ss_ apis but not in lws_sspc_, align it.
2020-07-07 15:23:19 +01:00
Andy Green
e09430c48d ss: smd: no need to log msg alloc rejection 2020-07-07 15:23:19 +01:00
Andy Green
c410956a31 ss: event_helper handles destroy requests itself
Callbacks can ask the caller to, eg, destroy the ss handle now.  But some
callback returns are handled and produced inside other helper apis, eg
lws_ss_backoff() may have to had fulfilled the callback request to destroy
the ss... therefore it has to signal to its caller, and its callers have
to check and exit their flow accordingly.
2020-07-07 11:28:36 +01:00
Andy Green
1a756ca178 ss-h1: close bound wsi when state handler requests ss destroy 2020-07-07 11:28:28 +01:00
Andy Green
2e1969187d sul: lws_sul_nonmonotonic_adjust
FreeRTOS only supports nonmonotonic time, when we correct it by, eg,
ntpclient, we offset all the existing sul timeouts.  This adds an
internal helper function to correct existing sul timeouts by the
step amount, and call it in lws ntpclient implementation when
adjusting the gettimeofday() time.
2020-07-07 11:28:28 +01:00
Andy Green
f902873634 ss: add timeout 2020-07-07 11:28:28 +01:00
Andy Green
0f3b45bc20 ss: h1: completed transaction needs to leave ss wsi intact for close 2020-07-07 11:28:28 +01:00
Andy Green
dfed547529 glib: stop leaking idle and hrtimer source
This gives a valgrind result for lws-minimal-http-server-event-lib-foreign
that's clean for lws pieces, although glib is always dirty wrt thread local
storage and hashtable.
2020-07-07 11:28:28 +01:00
Andy Green
b72ab32c17 lws_netdev 2020-07-02 10:36:31 +01:00
Andy Green
65545d2d21 lws-settings 2020-07-02 10:20:17 +01:00
Andy Green
63c1e8ba00 esp32-wrover-kit
Add lws_display and minimal example support for esp32-wrover to match wsp32-heltec-wb32

Since no usable buttons that don't affect something else on wrover kit, assumes
a button to 0V on GPIO14.
2020-06-30 19:35:41 +01:00
Andy Green
57bfaa9ccb sai: disable opensslv3 check until after release 2020-06-30 19:35:41 +01:00
Andy Green
4bcc446bf6 docs: ss: document ss state flow 2020-06-30 19:35:41 +01:00
Andy Green
64aee81ba7 ss: reset retry count for explicit connection request
This differentiates between client connections for retry / writeable requests
and explicit lws_ss_client_connect() api calls.  The former effectively uses
retry / backoff, and the latter resets the retry / backoff.

If you receive ALL_RETRIES_FAILED due to the retry policy, you can do whatever
you need to do there and call lws_ss_client_connect() to try to connect again
with a fresh, reset retry / backoff state.
2020-06-30 19:35:41 +01:00
Yichen Gu
2ba3b7b72b ss: rideshare fix for when h2 not available 2020-06-30 19:35:41 +01:00
Andy Green
0fb8504b20 client: suppress CONNECTION_ERROR if still in client_connect_via_info
If the client connection attempt fails early, we report it will a NULL
return from the client connection api.  If it fails later, perhaps after
more times around the event loop, we report it as a CONNECTION_ERROR.

This patch makes sure we don't do CONNECTION_ERROR flow if in fact we
are still in the client_connect_via_info() and in a position to report
the failure by returning NULL from there, without it under some
conditions we will do both a CONNECTION_ERROR and return NULL.
2020-06-30 19:35:41 +01:00
Andy Green
04c20d7460 ah: workaround for broken routers with no http header delimiter
There's a type of router in the wild issuing malformed http when
in captive portal mode... there's no \x0a\x0d but just \x0a
2020-06-30 17:52:10 +01:00
Jed Lu
84f8137fa6 ah-un_pos-cleanup-fix-other-path 2020-06-30 17:49:14 +01:00
Andy Green
a75a476026 ah: use unk_pos to clean up unknown header starts even without CUSTOM_HEADERS 2020-06-27 07:57:22 +01:00
Andy Green
8eca7e17f2 lws_smd: system message distribution
- Add low level system message distibution framework
 - Add support for local Secure Streams to participate using _lws_smd streamtype
 - Add apit test and minimal example
 - Add SS proxy support for _lws_smd

See minimal-secure-streams-smd README.md
2020-06-27 07:57:22 +01:00
Andy Green
30f3606b0e context: option to disable system state management 2020-06-27 07:57:22 +01:00
Andy Green
ceb4e53174 lws_button: classification
Now there's an abstract button class regardless of the underlying
connection, we can add more sophicsticated analysis on top of it
for processing its usually noisy events and classifying them into
smd-ready click, long-click or double-click events.

A "regime" defines the timing limits for different press recognition
and can be specified per-button, if not given a default regime is
applied.
2020-06-27 07:57:22 +01:00
Andy Green
33f1003305 lws_pwm 2020-06-27 07:57:22 +01:00
Andy Green
366333adba lejp: docs: clarify LEJPCB_VAL_STR_CHUNK 2020-06-22 08:14:56 +01:00
dev31337
81bff78c86 lejp: enable negative integers
https://github.com/warmcat/libwebsockets/issues/1957
2020-06-22 08:14:56 +01:00