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

4581 commits

Author SHA1 Message Date
Andy Green
b0a749c8e7 v4.3.2 2022-05-17 17:53:27 +01:00
Richard Shi
5a008cf282 http: compression: fix selection
https://github.com/warmcat/libwebsockets/issues/2633
2022-05-17 15:53:53 +01:00
Andrii Sevastianov
6d8a798742 validity: fix bad pointer access
We cannot access wsi after __lws_close_free_wsi.
2022-05-17 15:53:53 +01:00
Nick
bfd921df9c clean: remove needless LWS_PRE
Several examples trim their buffer with an extra LWS_PRE from the end...
actually end should point to end the end of buf without a second LWS_PRE
reservation.

https://github.com/warmcat/libwebsockets/issues/2629
2022-05-17 15:53:53 +01:00
Andy Green
310abddf5e coverity: ss: mqtt: remove needless wsi check
881     	case LWS_CALLBACK_MQTT_UNSUBSCRIBE_TIMEOUT:
>>>     CID 392688:    (REVERSE_INULL)
>>>     Null-checking "wsi" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
882     		if (!wsi || !wsi->mqtt)
883     			return -1;

wsi can't be NULL for a callback specific to a wsi.
2022-05-17 15:53:53 +01:00
Andy Green
71db363fe4 ss: mqtt: remove c99isms and fix types
Blows on Centos 7 / 8 in Sai with

/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c: In function âexpand_metadataâ:
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:304:2: error: missing braces around initializer [-Werror=missing-braces]
lws_strexp_t exp = {0};
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:304:2: error: (near initialization for âexp.nameâ) [-Werror=missing-braces]
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:304:2: error: missing initializer for field âcbâ of âlws_strexp_tâ [-Werror=missing-field-initializers]
In file included from /home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/include/libwebsockets.h:737:0,
from /home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/core/./private-lib-core.h:146,
from /home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:25:
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/include/libwebsockets/lws-tokenize.h:196:23: note: âcbâ declared here
lws_strexp_expand_cb cb;
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c: In function âsecstream_mqtt_shadow_subscribeâ:
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:441:2: error: âforâ loop initial declarations are only allowed in C99 mode
for (unsigned int i = 0; i < suffixes_len; i++) {
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:441:2: note: use option -std=c99 or -std=gnu99 to compile your code
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c: In function âsecstream_mqttâ:
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:481:2: error: missing braces around initializer [-Werror=missing-braces]
lws_strexp_t exp = {0};
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:481:2: error: (near initialization for âexp.nameâ) [-Werror=missing-braces]
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:481:2: error: missing initializer for field âcbâ of âlws_strexp_tâ [-Werror=missing-field-initializers]
In file included from /home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/include/libwebsockets.h:737:0,
from /home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/core/./private-lib-core.h:146,
from /home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:25:
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/include/libwebsockets/lws-tokenize.h:196:23: note: âcbâ declared here
lws_strexp_expand_cb cb;
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:677:27: error: conversion to âuint32_tâ from âsize_tâ may alter its value [-Werror=conversion]
uint32_t acc_n = strlen(LWS_MQTT_SHADOW_RESP_ACCEPTED_STR);
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:678:27: error: conversion to âuint32_tâ from âsize_tâ may alter its value [-Werror=conversion]
uint32_t rej_n = strlen(LWS_MQTT_SHADOW_RESP_REJECTED_STR);
^
/home/sai/big-long-dir-to-make-rpm-happy-o/jobs/0-0.0/libwebsockets/lib/secure-streams/protocols/ss-mqtt.c:680:4: error: âforâ loop initial declarations are only allowed in C99 mode
for (uint32_t i = 0; i < h->u.mqtt.shadow_sub.num_topics; i++) {

little additional cleaning and conversion to modern lwsl_xxx_yyy(xxx, ...)
2022-05-17 15:53:53 +01:00
Chunho Lee
8b1693a05e ss: mqtt: add support for AWS IoT Shadow topic
This introduces AWS IoT Shadow topic support. This subscribes and
unsubscribes shadow response topics before and after shadow topic
is transmitted.
2022-05-17 15:53:53 +01:00
Andy Green
c398dd546b coverity: reorder NULL check 2022-05-17 15:53:53 +01:00
Andy Green
2d48f559f0 mbedtls: some versions need x509 overallocation 2022-05-17 15:37:16 +01:00
Harshit Malpani
cf7862dd3c plat: esp32: Remove esp_attr.h file 2022-05-17 15:37:16 +01:00
dcpng
65870ebce3 windows: plugins uv fixes
https://github.com/warmcat/libwebsockets/issues/2617
2022-05-17 15:37:16 +01:00
Andy Green
e02aaff34c gcc12: extend test-client buffer for dumb increment 2022-05-17 15:37:16 +01:00
Fabrice Fontaine
6e997a9e70 tls: cmake: add wolfssl pkg-config support
Use pkg-config to search for wolfssl.pc which is available since version
3.3.3 and
a50af85e95

This will avoid setting manually LWS_WOLFSSL_{INCLUDE_DIRS,LIBRARIES}

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-05-17 15:37:16 +01:00
Fabrice Fontaine
fe762e586d CMakeLists.txt: fix build without C++
Fix the following build failure without C++ raised since version 4.2.0
and
962e9ee345:

CMake Error at /nvmedata/autobuild/instance-11/output-1/per-package/libwebsockets/host/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message):
  The C++ compiler

    "/usr/bin/clang++"

  is not able to compile a simple test program.

Fixes:
 - http://autobuild.buildroot.org/results/550e7f7d54adf74f8cc078be5b91b3567d622ede

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-05-17 15:37:16 +01:00
Chunho Lee
8eb6cbf5ac minimal: ss: policy2c: update MQTT fields 2022-05-17 15:37:16 +01:00
Chunho Lee
21baf47aed ss: mqtt: add QOS_NACK_REMOTE state on PUBLISH failure
This adds setting QOS_NACK_REMOTE state when QoS 1/2 PUBLISH
transmissions and all retries are unacked and failed. Also this
allows state transitions between QOS_ACK_REMOTE and QOS_NACK_REMOTE.
2022-05-17 15:37:16 +01:00
Chunho Lee
a51d3564a2 ss: mqtt: set the CONNECTED state after Birth
This sets the CONNECTED state after Birth topic is processed if
the stream has defined a Birth topic to avoid any confict when
the connection is not stable and the Birth is delayed.
2022-05-17 15:37:16 +01:00
Chunho Lee
fe0a5b8bb9 mqtt: fix wrong awsiot field set on SUBSCRIBE 2022-05-17 15:37:16 +01:00
Orefkov
6108d681ca h2: access log: POST: prepare log
https://github.com/warmcat/libwebsockets/issues/2608
2022-05-17 15:37:16 +01:00
Andy Green
9e658fa996 threadpool: improve relationship with LWS_HAVE_PTHREAD_H
Make it clear in more places that threadpool is only built if pthreads
available.

https://github.com/warmcat/libwebsockets/issues/2607
2022-05-17 15:37:16 +01:00
orefkov
cad13a8864 acme: update for v2
https://github.com/warmcat/libwebsockets/issues/2609

AG: api logging updates
2022-05-17 15:37:16 +01:00
Per Bothner
88a400515f docs: fix typo 2022-05-17 15:37:16 +01:00
wayneonway
ec81f538be netlink: route handling checks for SRC when it means DST
https://github.com/warmcat/libwebsockets/issues/2603
2022-05-17 15:37:16 +01:00
Scott Rankin
3268db0ae8 cmake: msvc: avoid having to use both preprocessor flags
https://github.com/warmcat/libwebsockets/issues/2600
2022-05-17 15:37:16 +01:00
Felipe Gasper
a7f2e29881 client: connect report actual socket error to user callback rather than EINPROGRESS
https://github.com/warmcat/libwebsockets/pull/2452
2022-05-17 15:37:15 +01:00
Andy Green
10044198c5 logs: use finegrained level test on unix-sockets.c 2022-05-17 15:34:30 +01:00
apcui
e5d73be53d windows: avoid NULL addr on connect check
https://github.com/warmcat/libwebsockets/issues/2596
2022-05-17 15:34:30 +01:00
Andy Green
3d98e29518 raw: tls conns
Raw + tls needs a little extra handling during connect.
2022-05-17 15:34:30 +01:00
Andy Green
02f7e06776 sul: add clear advice for zombie suls 2022-05-17 15:34:30 +01:00
Andy Green
995a759184 h1: remove assert on unexpected POLLIN state just hangup 2022-05-17 15:34:30 +01:00
Max Lehn
f8e3d09113 cmake: fix FindOpenSSLbins error when no OpenSSL executable found
This fixes CMake error "mode MATCH needs at least 5 arguments total to
command" while configuring when no OpenSSL executable was found.
Tested under Windows using VS2019.
2022-05-17 15:34:30 +01:00
Andy Green
69e1507c8c logs: freertos adds free heap to all logs 2022-05-17 15:34:30 +01:00
Andy Green
db5f574b03 nsc: fall back to internal headers when no stash 2022-05-17 15:34:30 +01:00
Andy Green
b92391050d esp32: heltec: change delay
Newer esp-idf has lost ets-delay-us
2022-05-17 15:34:30 +01:00
Andy Green
8782a47a05 gcc12: fix potential test app string overflow 2022-05-17 15:34:30 +01:00
Andy Green
2cf7e0f4ec coverity: 2021-12-1 uplevel fixes 2022-05-17 15:34:22 +01:00
Andy Green
49af3742c6 mbedtls: v3.1 reverts privacy of mbedtls_net_context fd
mbedtls seemed to realize that they went overboard with the privacy stuff
on v3.0 and removed some of it.  Introduce support for those members that
are only private on exactly v3.0 and unprotected before and after.
2022-05-17 15:09:20 +01:00
Andy Green
15db074b70 context_destroy: clean up early fail path 2022-05-17 15:09:09 +01:00
Andy Green
89f489f15c plugins: openmetrics_export: graceful fail if unconfigured 2022-05-17 15:08:23 +01:00
Andy Green
8b6f2d5dba gcc4: conceal typedef in public header
Modern toolchains are fine with giving a typedef as a forward reference,
but gcc 4.3 can't cope with that and then seeing the real definition in the
.c later.

Just conceal the typedef and use the struct form for the forward reference
resolution type in the public header so even senior toolchains are happy.
2022-05-17 15:07:29 +01:00
Andy Green
058f97e687 netlink: always delete route if it exists
https://github.com/warmcat/libwebsockets/issues/2567
2022-05-17 15:07:19 +01:00
Andy Green
1f2912d383 pkgconfig: use appropriate static lib name 2022-02-21 11:10:05 +00:00
wayneonway
4fb9a535db route: extend lws_route_uidx_t from 1 byte to 2 bytes 2022-02-21 11:08:21 +00:00
Andy Green
fcde566fc6 cgi: gracefully handle missing wsi->http.cgi 2022-02-21 11:08:19 +00:00
Andy Green
027fe42cec h1: deal with WAITING_CONNECT in ops-h1
We don't normally see events on the wsi in this state, but it is possible
since warmcat.com lwsws asserted on it in WAITING_CONNECT.

Explicitly handle it so we don't blow up.
2022-02-21 11:08:12 +00:00
Luciano Iam
28b1e1f463 mingw: correct winsock recv() and send() buffer ptr type
This allows to build libwebsockets on MinGW. Winsock recv() and send()
expect non unsigned char* while lws uses uint_8*.

https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send
https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv
2022-02-21 11:08:01 +00:00
Andy Green
0033accb83 lejp-conf: provide matches for block start paths
Also valgrind shows we should zero down the lejp context to avoid problems
with the wildcard stack
2022-02-11 08:43:16 +00:00
Andy Green
8d560a562f ss: POLL to all retries failed is possible
It's possible we started POLL, but no connection could happen for some
reason, and we end in the window between POLL and trying the connection.
2022-02-10 08:10:25 +00:00
Andy Green
890766083d ss: avoid POLL-POLL transition 2022-02-10 06:11:50 +00:00
Poppy
ca3f639edd tls: libressl: refactor set_options to work with macro implementations
Libressl uses macros for set_options(), causing compilation failure.
Refactor the related code to work well with macro definitions for
these apis.

https://github.com/warmcat/libwebsockets/issues/2554
2022-02-09 20:12:31 +00:00