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

4776 commits

Author SHA1 Message Date
Andy Green
d080ab3585 ws: client: fail server link if masked 2021-11-17 10:14:43 +00:00
Chunho Lee
e2e020f954 ss: mqtt: add ss mqtt minimal example
Adds an example for Secure Stream MQTT.
2021-11-17 09:54:12 +00:00
Chunho Lee
afe61d3828 mqtt: always init wildcard and shadow 2021-11-17 06:53:10 +00:00
Ilya Smelykh
d425691d9f client: flag defeating default cache-control headers added 2021-11-11 16:55:20 +00:00
calvin2021y
c8811bfe48 android: fix extra warnings on android-resolv 2021-11-11 11:52:48 +00:00
Andy Green
3ede7bae26 http: remove stray debug log 2021-11-11 11:52:48 +00:00
Andy Green
53d195022f cmake: Enable WITH_MINIMAL_EXAMPLES by default
Although many of the examples must be run from the example directory as
cwd, everyone getting started probably wants to try the examples, cmake
knows how to do it, so let's enable it by default.
2021-11-11 11:52:46 +00:00
Andy Green
80e06d2175 ss: revert make ss timeout handle underlying wsi gone 2021-11-11 08:34:53 +00:00
Andy Green
8ddcb16ef1 freertos-service: remove cruft
This can't be reached currently, so remove it and simplify the setting of c
to the exact equivalent.
2021-11-11 08:34:51 +00:00
Andy Green
591d42ff67 windows: mingw file type is int 2021-11-11 08:34:02 +00:00
Yichen Gu
87dd9283e1 wsimux: immortal: only process immortality once per stream
We can call mark immortal multiple times for a child stream, make sure it
is only processed (and increments the nwsi refcount) the once.
2021-11-09 07:45:58 +00:00
Andy Green
a335958923 sspc: proxy: coverity: handle unknown metadata name 2021-11-09 07:45:58 +00:00
Andy Green
81b481ef2f h2: coverity: check for OOM on dynamic table alloc
It can fail, we should check it.
2021-11-09 07:45:58 +00:00
Andy Green
3709d80f3d ss-deserialize: add pointless h NULL check
h cannot be NULL since it's set by address offset earlier.
Help coverity understand that.
2021-11-09 07:45:58 +00:00
Andy Green
f8d74d058e adopt: coverity: add pointless vh NULL check
The wsi is always created on a valid vhost.  Add a needless NULL check on
it to satisfy coverity.
2021-11-09 07:45:48 +00:00
Andy Green
a53eb4d4fe ss-h1: coverity: add needless header NULL check
Coverity does not understand that once we checked that  the header has
a non-zero length, the associated pointer can never be NULL.  Add a
pointless check to make it happy.
2021-11-08 13:44:45 +00:00
Andy Green
7b34626a22 mbedtls-x509: coverity: remove needless check
ip can't be NULL, it's set to the address of another object.
2021-11-08 13:44:45 +00:00
Andy Green
d1f6101bad unix-sockets: NOP for coverity
continue here makes no difference than using break, but continue gets us a
pointless complaint "statement continue does not have any effect" and break
does not.
2021-11-08 13:44:45 +00:00
Andy Green
d3783f0c71 client: connect: confirm we have a protocol
Coverity gets antsy that we were checking wsi->a.protocol for NULL earlier
then start using it... explicitly bail if it's NULL before we start using
it.
2021-11-08 13:44:45 +00:00
Andy Green
f3a1263bc1 jit-trust: SAN_RFC822_NAME needs other_name union member
->san is a union, in this case we set the type to indicate we use
SAN_OTHER_NAME member, but set the unstructured_name union member, that is
smaller.

This doesn't cause any problem, since the union has space for it.  But
Coverity noticed, it is wrong, so fix it.
2021-11-08 13:44:45 +00:00
Andy Green
81a69d10e9 jit-trust: show coverity we handle NULL attribute source
Coverity doesn't understand that since we already handled
akid.keyIdentifier.MBEDTLS_PRIVATE(len) being zero, we don't need to
check for akid.keyIdentifier.MBEDTLS_PRIVATE(p) being NULL.

So explicitly check it, even though it is a NOP.
2021-11-08 13:44:45 +00:00
Andy Green
7de0d88ac3 jit-trust: clean after failed mbedtls_x509_get_name
mbedtls_x509_get_name() does not clean up properly after itself in the case
of OOM on multi-segment name.  We have to add extra handling and cleaning.
2021-11-08 13:44:45 +00:00
PW Hu
fe31dcd8ac docs: audit api return information
https://github.com/warmcat/libwebsockets/issues/2481
2021-11-07 10:08:00 +00:00
Andy Green
c19dc963c9 cgi: issue CGI_TERMINATED also on reap
We also need to report CGI_TERMINATED when reaping children that closed by
themselves.  Keep an extra copy of the pid outside of the lws_spawn object
so it's still around by then.
2021-11-07 07:04:09 +00:00
Andy Green
270a14813f sshd: fix leak on disconnect
Disconnect wants to keep a copy of the description string, but it is never
freed.  Make it ephemeral just for the ->disconnect_reason() op so it is
cleaned out correctly.
2021-11-07 07:04:09 +00:00
Andy Green
095798d5d9 sshd: plugin: work with _BUILTIN
The sshd example has gotten crufted a few different ways.

Adapt the test-sshd protocol and callbacks to not collide with the plugin
ssh-demo exports, for BUILTIN case.

Do not build a static copy of ssh-base for test-sshd if PLUGINS_BUILTIN is
going to provide it via lws import.

Add pvo for ssh-base to enable it on to the test-sshd vhost.

Banner staging in buf[] shared some of source and dest when it was copied
in, move it up a bit to avoid this.

Add note about rsa key disable workaround on Fedora.

test-sshd uses CGI (and requires it enabled to build) because it predates
lws_spawn... lws cgi was migrated to lws_spawn, really the test=sshd needs
rewriting to use lws_spawn directly instead of cgi.
2021-11-07 07:04:09 +00:00
Andy Green
7c9f1ca0a6 plugins: iterate builtin plugins as if loaded
For plugins that handle PROTOCOL_INIT, we have to iterate any PLUGINS_BUILTIN
plugins as if we had just discovered and loaded them from plugin files, so
they bind to vhosts appropriately.

Add some private helpers to keep the guts from duplication in plat.
2021-11-07 07:04:09 +00:00
Andy Green
12a3e09f40 lejp: use string path matches in test app 2021-11-07 05:33:47 +00:00
Andy Green
555503b202 lejp: allow leading wildcard
This lets us have path matches like "*[]"
2021-11-07 05:33:44 +00:00
Andy Green
c935df1e7e lejp: object indexes
This adds an optional feature LEJP_FLAG_FEAT_OBJECT_INDEXES that changes
lejp to treat { } items as indexable in ctx->i[] / ctx->ipos, since they
also can take commas.

This may break existing uses so it requires the default-off feature flag to
enable it.  The flags context field is zeroed by lejp_construct(), so any
flags should be set on ctx->flags after alling that.

There's also a flag LEJP_FLAG_LATEST available as an alias to enable any
desirable but not-backwards-compatible behaviour, including this.

Add the info to the README and adapt the unit test to do it both with and
without the FEAT_OBJECT_INDEXES flag.
2021-11-07 05:33:43 +00:00
Andy Green
9734cadf11 lejp: tighten api tests 2021-11-07 05:32:08 +00:00
Andy Green
a81c7cccd0 retry: handle empty retry table 2021-11-06 09:09:35 +00:00
Jakov Smolić
252890d19c plugins: sshd: eg musl needs sys/types if available
https://github.com/warmcat/libwebsockets/issues/2477
2021-11-04 07:12:37 +00:00
Hannes Achleitner
1b7d6c80ff examples-lowlevel: ws client: add -n to README table 2021-11-02 07:12:47 +00:00
Andy Green
3755f56d5e examples-lowlevel: ws-server: pvo for WITH_PLUGINS 2021-11-02 07:11:59 +00:00
Ron Frederick
b5b7e793d4 server: SO_REUSEPORT: enable with LWS_MAX_SMP > 1
Either explicit option selection, or multiple SMP service threads, should
enable SO_REUSEPORT

https://github.com/warmcat/libwebsockets/issues/2470
2021-10-30 06:19:37 +01:00
Andy Green
37b930a6ae openssl: remove lws_ssl_get_error_string as cruft
It's not exported, it seems nothing wants it any more
2021-10-29 20:10:55 +01:00
Andy Green
3f4800b88f log: cherrypick common errno to be strings
Pick some common errno constants for the platform and provide strings for
them.  Replace numeric errno logging with the new api for client.

Replace any usage of strerror() in network code with the new api.  For
constrained devices, this should give a small saving on .rodata.

Leave some usages in daemonize.c and unix plat where the size isn't going
to matter.
2021-10-29 20:10:52 +01:00
Andy Green
c2ac541f43 client: connect3: show what we are trying to connect to
Make it visible what we are currently attempting to connect to as a numeric
ipv4/ipv6 address.
2021-10-29 15:41:52 +01:00
Andy Green
c1e6906fc8 minimal: client: hello_world: polish a bit more
This is the ur-template for the new examples, try to make it as good an
exemplar as possible
2021-10-29 15:41:52 +01: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
Andy Green
310e576cdc esp32-c3dev: remove stray ssd1306 copy 2021-10-29 15:41:52 +01:00
Andy Green
2ce2447397 minimal: ss: handle usleep in win32
AG: also take care of additional requirements for tests that need h2
2021-10-28 16:50:28 +01:00
Misaka Mikoto
5ae132a7b6 cmake: fix SS on by default 2021-10-28 14:42:22 +01:00
Andy Green
67f532a8c6 cmake: bring tls include requirement out as PUBLIC
There's no problem for library build, also with LWS_WITH_MINIMAL_EXAMPLES,
but after install at least on OSX, there are problems finding the installed
lws include dir (concealed on most platforms by the path being in the
default search list for the toolchain), and the references in the lws
includes to the tls includes meaning that explicit paths for that must be
available at consuming cmakes.

This patch enhances the cmake config installed by lws to deal with adding
the lws include paths to CMAKE_REQUIRED_INCLUDES and include_directories,
so it can be found before the target is introduced.

The tls include is passed back up the CMakeLists layers and the lws targets
marked with target_include_directories(PUBLIC) with them, so they are
understood as needed by consumers.

More boilerplate is moved out of the example consuming cmakes.

After this, on machines with previous installs of older lws, you may have to
clean out the cmake install path, that is usually something like

/usr/local/lib/cmake/libwebsockets/*

before make installing lws and putting the latest content in there.
2021-10-28 08:12:48 +01:00
Chunho Lee
8e4336838a mqtt: allow indicating username and password are not on heap
Fix minimal-mqtt-client and minimal-mqtt-client-multi from crashes
by allowing indicating username and password are not on heap.
2021-10-27 16:52:38 +01:00
Chunho Lee
41c88959d2 plat: freertos: selectively use old service looping 2021-10-26 09:55:09 +01:00
Felipe Gasper
b954aa8c21 docs: client: Add UNIX socket connection notes for clients 2021-10-26 06:54:02 +01:00
Andy Green
2761badd0f minimal: ss: embedded: RT595S ACM transport
Adds an example for NXP RT595S eval board, using serialized SS over CDC /
ACM USB composite device, one ttyACM for logs and the other for the SSS
link.
2021-10-24 16:50:39 +01:00
Andy Green
99f7e572ca raw-file: clear POLLOUT before handling 2021-10-24 16:48:03 +01:00