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

2631 commits

Author SHA1 Message Date
Sakthi Kannan
da38af3b2d mqtt: avoid LRS_H1C_ISSUE_HANDSHAKE
Otherwise we can get the client connection stalling since H1C has no meaning on mqtt.
2020-05-11 14:52:31 +01:00
Andy Green
8221450b20 ss: support no tls in policy 2020-05-06 15:27:59 +01:00
Andy Green
8021ab54f0 h2: client: do not apply host header if h2 negotiated by alpn
If client negotiated over alpn, it will have done SNI.  Some
peers like youtube.com reject with 400 if you sent a host: as
well.
2020-05-05 12:48:08 +01:00
Jed Lu
70ba29d568 ss auth: dont attempt auth if necessary blob unavailable 2020-05-04 17:03:08 +01:00
Andy Green
51ad2f2d9e h2: client sid: must be allocated at header send
There is no way to allocate a client wsi mux sid before the headers are
send, because we don't know the order in which new wsi headers will be sent
and so seen by the peer.

The peer inisists that sid indexes only increase... we cannot allocat sids
monotonically at the client and then send them disordered...
2020-05-04 14:37:37 +01:00
Andy Green
85dc0883a2 ss: handle rx and tx return values properly
You can disconnect the stream by returning -1 from tx().  You can
give up your chance to send anything by returning 1 from tx().
Returning 0 sends `*len` amount of the provided buffer.

Returning <0 from rx() also disconnects the stream.
2020-05-04 14:36:39 +01:00
Andy Green
a59aaf6af9 strexp: reset out offset each time
A second strexp mustn't inherit the offset of the first, completed one
2020-04-30 20:32:30 +01:00
Steve Kyoungwon Kim
5dd57715dd BoringSSL: provide X509_VERYFY_PARAM_Set1_host length
X509_VERYFY_PARAM_Set1_host of openSSL allows the third argument, which
is the length of the hostname string, to be 0. Then, it assumes hostname
is a null-terminated C string. BoringSSL enforces the actual length to
be specified, and the hostname string should end with a null char.

Just provide the length, making both OpenSSL and BoringSSL happy.
2020-04-30 05:23:12 +01:00
Sakthi Kannan Ramabadran
af9b4d0c66 mqtt: some toolchains object to typedef
Use struct type instead of typedef to avoid it.
2020-04-27 19:46:13 +01:00
Adam Duskett
182b5121d0 dhcpclient: Fix unused-variable error in release
dhcp_entry_names is only used when _DEBUG is defined, so wrap the array in

Signed-off-by: Adam Duskett <Aduskett@gmail.com>
2020-04-23 20:04:01 +01:00
Andy Green
4e68e3b4bc logs: allow giving log bitfields from cmake to force build or exclusion
By default this doesn't change any existing logging behaviour at all.

But it allows you to define cmake options to force or force-disable the
build of individual log levels using new cmake option bitfields
LWS_LOGGING_BITFIELD_SET and LWS_LOGGING_BITFIELD_CLEAR.

Eg, -DLWS_LOGGING_BITFIELD_SET="(LLL_INFO)" can force INFO log level
built even in release mode.  -DLWS_LOGGING_BITFIELD_CLEAR="(LLL_NOTICE)"
will likewise remove NOTICE logging from the build regardless of
DEBUG or RELEASE mode.
2020-04-23 06:36:54 +01:00
huangkaicheng
e7b3cd7ec1 iOS: detect and avoid net/route.h
LWS builds OK on iOS SDK as unix type plat, except it
doesn't have net/route.h.

Detect we're building on iOS at CMake and export a
preprocessor define we can use to snip out the missing
include.
2020-04-23 06:22:00 +01:00
Octavia93
dc3a1123fc alloc.c: add license header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Is this file also licensed under MIT license, I don’t see a license header like the other files in this repo?
2020-04-13 16:17:30 +01:00
Andy Green
4114b610aa glib: remove unused watcher to align with master 2020-04-12 14:59:25 +01:00
Andy Green
d13f0444f3 lws_struct: sqlite3: avoid chown for windows 2020-04-11 16:56:13 +01:00
Andy Green
0824f77142 windows: async dns: fix typo 2020-04-10 16:44:51 +01:00
Andy Green
a147fb81dc windows: ipv6 compile fix
Via turtiain

https://github.com/warmcat/libwebsockets/issues/1880
2020-04-07 10:17:48 +01:00
Jaco Kroon
a9caff5b37 vhost: Fix unused var warning with some SOCKS5
after 6bb116b8d8 the variable p could be
declared without being used.

https://bugs.gentoo.org/716386 refers.

This just fixes that.
2020-04-06 17:40:40 +01:00
Andy Green
b1d2bdbe20 h2: take care to retain initial sid 2020-04-06 14:08:01 +01:00
Andy Green
092e8f6614 h1: handle LRS_FLUSHING_BEFORE_CLOSE at ops read
read has a tight leash on the states it's happy to turn up there,
it's good to be like that but it turns out LRS_FLUSHING_BEFORE_CLOSE
should be whitelisted since it can happen under some transient
conditions and is valid.

https://github.com/warmcat/libwebsockets/issues/1872
2020-03-26 18:09:49 +00:00
Karl Rupp
bb439e766a http server: Using default filename also for subdirectories.
If a user sets a default filename for a http mount (.def in lws_http_mount),
eg. 'default.html', then a GET request for '/' correctly forwards to
 '/default.html'.
However, without this commit the default filename is not taken into account for subdirectories. Thus,
 GET subdir/
will forward to
 'subdir/index.html'
instead of the expected
 'subdir/default.html'

This commit changes the behavior such that the user-provided default filename is also used for subdirectories.
2020-03-23 21:03:54 +00:00
Akira Tsukamoto
b00e6949e6 jws: lws_gencrypto_jws_alg_to_definition needs sentinel
Otherwise segfault when end of array reached.
2020-03-21 07:01:58 +00:00
Andy Green
6247f5ea79 wolfssl: build fixes 2020-03-20 09:38:17 +00:00
Andy Green
77a1b4e058 lws_set_wsi_user: allow setting to override existing internal allocation 2020-03-19 17:03:11 +00:00
Andy Green
8aef4cc330 lws_dir: uv: clean up temp loop on fail 2020-03-19 14:38:01 +00:00
Andy Green
457bc20d1b ss: reduce logging of unknown streamtypes
There are a few automatic things that look for streamtypes that may or
may not exist now

 - captive_portal_detect
 - fetch_policy
 - api_amazon_com_auth

logging them as notice every startup is pretty intrusive, change to info.
2020-03-19 14:37:22 +00:00
Andy Green
1acf0b33c7 mbedtls: support older versions without net_sockets.h 2020-03-19 14:36:05 +00:00
Andy Green
cf2ed9f758 ss: use system trust store if none given in policy
For general OpenSSL case, we leave connection validity to system trust
store bundle to decide; even for mbedtls it may have been passed a
bundle externally and we don't want to have to list the x.509 stack
explicitly for a server we don't have any control over.

Instead of erroring out, allow the case no trust store is specified,
just use vhost[0] and let the system trust store decide if it likes
the server's cert or not.


No ABI change.
2020-03-16 16:59:17 +00:00
Andy Green
84f8bdc3d8 ss: support metadata string expansion in endpoint string
This lets you set metadata symbols exposed by the streamtype policy
into the endpoint address.

No ABI change
2020-03-16 16:56:11 +00:00
Andy Green
a746dc767a lws_spa: avoid reading past table
Didn't check the lenghts of the NUL-terminated header
table properly.

https://github.com/warmcat/libwebsockets/issues/1859
2020-03-14 07:55:58 +00:00
Andy Green
6bca0d048f build: release mode compile fixes 2020-03-10 06:46:35 +00:00
Andy Green
28c0e51cd6 client: unify post tls accept handling 2020-03-07 20:20:07 +00:00
Andy Green
28f04b5ebd minilex: fix ROLE_WS=0 case 2020-03-06 15:23:27 +00:00
Andy Green
7efe93bb34 fallback: dont check after first ssl accept attempt 2020-03-06 10:18:43 +00:00
Andy Green
8dff5b7342 logs: don't print junk if no timestamp 2020-03-06 07:55:05 +00:00
Andy Green
1c6735e1a0 mux: disable already optimization
This leads to problems at the moment with sticky mux.requested_POLLOUT
causing writeable to not be sent.

Remove it and always set writeable on parents for now.
2020-03-06 07:55:05 +00:00
Andy Green
993c7c3192 fsmount: delete session dir on mount 2020-03-05 14:12:24 +00:00
Andy Green
765d393f82 clean: reduce some log level 2020-03-05 12:34:07 +00:00
Terry Zhang
eb9c01ae5c ws: make sure we understand frame finished when buflist_out flushed
When lws_write as many bytes as user can until function returns not all sent,
the next user`s lws_write call will write wrong frame to the other end. This
will cause connection be close by the other side.
2020-03-04 12:17:49 +00:00
Andy Green
0e94683897 freertos: forward-port lwip version adaptations 2020-03-04 12:17:49 +00:00
Andy Green
c25c37febd client: make sure all paths after connect go via tls if set 2020-03-04 12:17:49 +00:00
Andy Green
9695e23c00 ss: mqtt: add will and other sundries to policy
Replace the hacked-in constants with policy entries for sundry
MQTT features, and add to the policy readme.
2020-03-04 12:17:49 +00:00
Andy Green
28ce32af64 client: secure streams
Secure Streams is an optional layer on top of lws that separates policy
like endpoint selection and tls cert validation into a device JSON
policy document.

Code that wants to open a client connection just specifies a streamtype name,
and no longer deals with details like the endpoint, the protocol (!) or anything
else other than payloads and optionally generic metadata; the JSON policy
contains all the details for each streamtype.  h1, h2, ws and mqtt client
connections are supported.

Logical secure streams outlive any particular connection and supports "nailed-up"
connectivity regardless of underlying connection stability.
2020-03-04 12:17:49 +00:00
Sakthi Kannan
9d099ba7be client: MQTT
Adds client support for MQTT QoS0 and QoS1, compatible with AWS IoT

Supports stream binding where independent client connections to the
same endpoint can mux on a single tcp + tls connection with topic
routing managed internally.
2020-03-04 12:17:49 +00:00
Andy Green
d88d41090e cleaning: windows 2020-03-04 12:17:49 +00:00
Karl Vogel
7b50dc8830 event lib: fix LWS_WITH_GLIB typo 2020-03-04 12:17:49 +00:00
Andy Green
55ea791a77 lws_struct: store which toplevel schema matched
We can give the lws_struct parser a table of toplevel schemas, record
which one we chose so the caller can know how to interpret the result
2020-03-04 12:17:48 +00:00
Andy Green
30fc8e9caf lws_struct sqlite3
Continue with lws_struct, add sqlite support for one
level of lws_dll2_t lists of structs serialization and
deserialization, plus the matching api-test.
2020-03-04 11:00:04 +00:00
Andy Green
9a1f184915 rtos diet: http: remove headers at buildtime according to config
Headers related to ws or h2 are now elided if the ws or h2 role
is not enabled for build.  In addition, a new build-time option
LWS_WITH_HTTP_UNCOMMON_HEADERS on by default allows removal of
less-common http headers to shrink the parser footprint.

Minilex is adapted to produce 8 different versions of the lex
table, chosen at build-time according to which headers are
included in the build.

If you don't need the unusual headers, or aren't using h2 or ws,
this chops down the size of the ah and the rodata needed to hold
the parsing table from 87 strings / pointers to 49, and the
parsing table from 1177 to 696 bytes.
2020-03-04 11:00:04 +00:00
Andy Green
bb1a8d37fb rtos diet: make basic auth support a config option on by default
Remove wrapper content for < tls v1.2
2020-03-04 11:00:04 +00:00