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

4404 commits

Author SHA1 Message Date
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
Jin Wang
312bb56385 ss: policy: adaptations for dynamic policy 2021-10-21 14:51:21 +01:00
Jin Wang
2670a971b9 metrics: ss: skip tagging if no ss streamtypename 2021-10-19 15:40:00 +01:00
Orefkov Aleksander
d1248188e0 pugins: sshd: handle window-change request
Added processing of window-change request, according to RFC 4254 6.7
https://datatracker.ietf.org/doc/html/rfc4254#section-6.7
For processing called callback pty_req with empty terminal and modes.
2021-10-19 15:39:53 +01:00
Orefkov Aleksander
2504eba456 plugins: sshd: channel fixes
In responses  with channel numbers, the sender's channel number is sent instead of the recipient's channel number.
See for example https://datatracker.ietf.org/doc/html/rfc4254#section-5.1
Putty uses channel 256 for session, and existing code break it with "Received SSH2_MSG_CHANNEL_OPEN_CONFIRMATION for nonexistent channel 0" error.
2021-10-19 10:50:09 +01:00
Orefkov Aleksander
4c5e7a37df plugins: sshd: mbedtls 3 extra adaptation
In fresh mbedtls rsa public decrypt is deprecated and not work on public keys.
Replaced by lws_genrsa_hash_sig_verify.
2021-10-19 10:50:01 +01:00
Orefkov Aleksander
e34e6fe263 plugins: sshd: sc25519 must handle last bit
This was originally commented because Coverity objected to it.
2021-10-19 06:38:45 +01:00
Andy Green
9127bcde7f client: connect_check fail just log once 2021-10-19 06:32:19 +01:00
Andy Green
a3592cbe4f adns: api-test: add synthetic result parsing
Add some exports so the api test can inject results into the parser for
live queries, suppressing asking the server but otherwise following the
flow.

Provide two new suspect responses for injection and parsing in ctest.

Add a --cos option to minimal-http-client to force a close after the
connection has started the async dns.
2021-10-18 09:58:16 +01:00
Andy Green
a51def06a1 coverity: adns: check length against 1500 2021-10-17 12:03:07 +01:00
Andy Green
66afd3da78 coverity: client_reset: no longer any way to get NULL *pwsi
Coverity belatedly noticed that client_reset no longer changes *pwsi
2021-10-17 12:03:07 +01:00
Andy Green
8f05195368 readme: add news about Felipe Gasper's perl binding 2021-10-17 12:03:07 +01:00
Andy Green
d730351fa3 adns: fix label limit check 2021-10-17 12:02:26 +01:00
Andy Green
28e5d41d9e http: sse: check POLLIN during DOING_TRANSACTION
When the client goes away, on some platforms all we get is POLLIN revent
stuck on... we have to read it to find out a zero length result and
understand it's gone.

Add SSE mode's DOING_TRANSACTION to the list of states we will read for.
2021-10-16 08:23:21 +01:00
Andy Green
cb7dd8c765 bind: use vhost log ctx since wsi optional 2021-10-16 08:23:18 +01:00
Andy Green
52e192ba4a cmake: add inclusion of CheckIncludeFile in req 2021-10-16 08:23:14 +01:00
Felipe Gasper
9c718e47e2 logs: log context: async_dns
Of note: A single use of lwsl_debug() remains because the function in
question is documented as a public API, but the passed-in parameter
doesn’t offer a path to a logging context.
2021-10-16 08:23:09 +01:00
Andy Green
7e09e42472 freertos: no need to freak out if service_adjust_to is 0
If lws_s_a_t() is zero, there's a path where n stays -1 from its
declaration and we return -1.
2021-10-15 19:07:33 +01:00
Felipe Gasper
81830a3979 logs: migrate more to log context 2021-10-15 14:11:41 +01:00
Felipe Gasper
80b0c59ad6 client: fix nxdomain CCE 2021-10-15 14:11:41 +01:00
Orefkov Aleksander
abef9ba252 http: spa: fetch any params
Added the ability to get additional form parameters with unknown names in the form parameters parser lws_spa. The example of using the form parameters parser has been updated. Fixed bug of double freeing memory in the example.
2021-10-15 08:47:52 +01:00
Yichen Gu
43c4b79960 ss: static policy generator: fix filepath detection 2021-10-13 15:56:29 +01:00
Yichen Gu
c3515cd6d9 mqtt: protect printing debug only vars 2021-10-13 15:56:22 +01:00