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
Jaume
2445793d15 windows: client connect: use sockaddr size 2022-06-14 07:40:58 +01:00
Mykola Stryebkov
c92d9f9c5d eventloop: windows: ssl: remove spin 2022-06-14 07:37:19 +01:00
Paul Shark
8fe3950acd http: server: correct plugin name in error 2022-06-14 07:37:11 +01:00
Fabrice Fontaine
c83cf48b90 lib/tls/CMakeLists.txt: fix build without threads
openssl can be built without threads resulting in the following build
failure:

-- Looking for HMAC_CTX_new
-- Looking for HMAC_CTX_new - not found

[...]

In file included from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/include/libwebsockets.h:661,
                 from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/lib/core/./private-lib-core.h:140,
                 from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/lib/plat/unix/unix-misc.c:28:
/home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/include/libwebsockets/lws-genhash.h:85:18: error: field 'ctx' has incomplete type
   85 |         HMAC_CTX ctx;
      |                  ^~~

To fix this build failure, don't unconditionally add pthread if openssl
has been found through pkg-config as openssl.pc will contain the
appropriate dependencies (i.e. -lpthread but also -lz or -latomic)

Fixes:
 - http://autobuild.buildroot.org/results/2ae9e3249b6fcc9e6c30e7783e264fc6599e61df

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-06-14 07:37:03 +01:00
Andy Green
19d9869af6 lejp: increase default complexity limits 2022-06-14 07:36:57 +01:00
Andy Green
281ed171a3 dbus: check cx and vh locks via dbus_ctx 2022-06-14 07:36:51 +01:00
Andy Green
2760c9b0be tls shudown: avoid spin 2022-06-14 07:36:44 +01:00
Andy Green
31ff36e09d minimal: embedded lhp examples
Implements a carousel rendering and displaying remote HTML + JPEG + PNGs
on a variety of display devices, including several EPDs.
2022-05-04 08:43:26 +01:00
Andy Green
4a443c3e2e lhp: add DLO layout support
Add a dlo-based layout callback for use with lhp.

If lhp_dl_render() is used as the Lws Html/CSS parser callback, it
produces a display_list representation of the Html as DLOs, referencing the
appropriate CSS to drive the layout as best it can.

The display list can be rasterized on to an lws_display using the display's
state object

  lds->disp->blit(lds, (uint8_t *)&dl, &box);
2022-05-04 08:43:26 +01:00
Andy Green
3063fe84aa http: lws_http_rel_to_url
URL-level relative-to-absolute converter given a base url
2022-05-04 08:43:26 +01:00
Andy Green
63d2f844db lhp: Lightweight HTML Parser
Introduce a very lightweight html5 + css2.1+ stateful stream parser, along
the same lines as the lws json and cbor ones.

This is interesting primarily because of just how low-resource it is for
modest css + html, it uses an lwsac to hold the entirity of the css in
memory at once but the html is parsed in chunks without any need to keep
previous chunks around (chunks may be as small as 1 byte).

A user callback receives element entry and exit callbacks with payload and
all attributes parsed out, CSS related to the active element stack is
parsed to provide a list of active css attributes, which takes heap for the
duration of the parsing.

In effect this provides rich information about the html and css state to
the callback, which has the job of producing the layout in a user-defined
way.

As such, there is no DOM in memory at one time, there is only a stack of
active elements like <html><body><div>xxx with their associated attributes
(like class).  So as it is, it does not support DOM modification such as
JS changing elements after parsing, although elements with interesting IDs
could be kept around by the callback.  There is a corresponding tiny and
relatively flat heap usage regardless of html size.

Default CSS is specified as recommended in the CSS 2.1 standard.

Inline <style></style> elements are supported, but not pre-html5 style= in
element attributes, since these are incompatible with strict CSP.

What the attributes should mean on your system, eg, font-size, font-family
etc is left for the user callback to decide, along with how to lay out the
items using the CSS attributes, and render them.

Fixed point 32.32 constants are used (fraction expressed at parts in 100M)
instead of floating point.

If you have presentation needs, even on a constrained display on a
constrained microcontroller, this makes it feasible to use standardized
markup and styling instead of roll your own.
2022-05-04 08:43:26 +01:00
Richard Shi
5d56f7651f http: compression: fix selection
https://github.com/warmcat/libwebsockets/issues/2633
2022-05-04 08:43:26 +01:00
Andrii Sevastianov
e86490fc45 validity: fix bad pointer access
We cannot access wsi after __lws_close_free_wsi.
2022-05-04 08:43:26 +01:00
Nick
2dc148e3a3 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-04 08:43:26 +01:00
Andy Green
43ba912b2b 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-04 08:43:14 +01:00
Andy Green
1d5c865410 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-04 08:42:43 +01:00
Chunho Lee
93d66b8301 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-04 08:42:43 +01:00
Andy Green
247cf01935 coverity: reorder NULL check 2022-05-04 08:42:32 +01:00
Andy Green
5f749bb796 ss: add get_metadata example 2022-04-29 10:47:59 +01:00
Andy Green
198a85b53c async dns: handle late udp creation
We may have to retry the UDP socket creation to the DNS servers until
network is up.
2022-04-24 06:48:50 +01:00
Andy Green
ab7937f2bc mbedtls: some versions need x509 overallocation 2022-04-23 07:39:43 +01:00
Harshit Malpani
ce49f1d0e5 plat: esp32: Remove esp_attr.h file 2022-04-23 07:39:43 +01:00
Nikita Zlobin
3ba037df3d doc: update doxygen 2022-04-23 07:39:35 +01:00
dcpng
609d0b82d8 windows: plugins uv fixes
https://github.com/warmcat/libwebsockets/issues/2617
2022-04-22 07:41:16 +01:00
Andy Green
01765df1ff gcc12: extend test-client buffer for dumb increment 2022-04-22 07:41:15 +01:00
Fabrice Fontaine
079726c4b2 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-04-22 07:41:11 +01:00
Andy Green
06229deb8c async_dns: protocols init: make sure we add vhost once 2022-04-13 20:13:47 +01:00
Fabrice Fontaine
a04aaad7f0 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-04-13 20:10:44 +01:00
Chunho Lee
584dcfae79 minimal: ss: policy2c: update MQTT fields 2022-04-11 09:31:14 +01:00
Chunho Lee
81e6c69481 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-04-11 09:31:06 +01:00
Chunho Lee
49f505304e 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-04-11 09:30:57 +01:00
Chunho Lee
4975000aa2 mqtt: fix wrong awsiot field set on SUBSCRIBE 2022-04-11 09:30:49 +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
615a08b216 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-04-11 06:53:47 +01:00
orefkov
edf670a3e6 acme: update for v2
https://github.com/warmcat/libwebsockets/issues/2609

AG: api logging updates
2022-04-11 06:39:55 +01:00
Per Bothner
93aaaf371c docs: fix typo 2022-04-10 09:56:27 +01:00
Andy Green
f5ae2bc657 clean: remove public apis for removed functions
https://github.com/warmcat/libwebsockets/issues/2605
2022-04-10 06:56:12 +01:00
wayneonway
61880e15ff netlink: route handling checks for SRC when it means DST
https://github.com/warmcat/libwebsockets/issues/2603
2022-04-10 06:56:12 +01:00
Scott Rankin
9c5fc9f3e4 cmake: msvc: avoid having to use both preprocessor flags
https://github.com/warmcat/libwebsockets/issues/2600
2022-04-10 06:56:12 +01:00
Andy Green
b43866ffeb asyncdns: also consult system hosts file
We should also consult any system hosts file if available as part of the
async dns prep, same as we check for numeric IPs.
2022-04-10 06:56:12 +01:00
Andy Green
047fb7bb21 tokenize: enhance to support chunked parsing
Add EXPECT_MORE flag to indicate that running out of input is not (yet)
indicating the end of the document.  The caller should remove this flag
when it identifies that it does not have the chunk with the end of the
document: the last chunk may be zero length.

Track line numbers so the caller can infer CR, absorb CRLF -> CR.

Also add COLON_NONTERM needed for ipv6 literal addresses.
2022-04-10 06:56:12 +01:00
Felipe Gasper
76a5a9e2f2 client: connect report actual socket error to user callback rather than EINPROGRESS
https://github.com/warmcat/libwebsockets/pull/2452
2022-04-10 06:56:12 +01:00
Andy Green
6d88669b69 logs: use finegrained level test on unix-sockets.c 2022-04-10 06:56:12 +01:00
apcui
730c954b42 windows: avoid NULL addr on connect check
https://github.com/warmcat/libwebsockets/issues/2596
2022-04-10 06:56:12 +01:00
Andy Green
76d8840c5f coverity: fixes 2022-04-10 06:56:12 +01:00
Andy Green
b0041b32e6 raw: tls conns
Raw + tls needs a little extra handling during connect.
2022-04-10 06:56:12 +01:00
Andy Green
a54480ba93 lws_display: SSD1675B 2022-04-10 06:56:12 +01:00
Andy Green
c7ebe639be lws-display: UC8176 EPD driver 2022-04-10 06:56:02 +01:00
Andy Green
9b47b768f4 lws_display: SPD1656 driver
Add SPD1656 SPI driver as used in 5.65 inch 7-colour waveshare panel.
2022-03-25 08:18:30 +00:00
Andy Green
d6c4e606e7 ssd1306: adapt blit for DMA 2022-03-25 08:18:30 +00:00