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

463 commits

Author SHA1 Message Date
Orgad Shaneh
a74e4bcc78 cmake: gcc: allow build with GCC < 4.4
Prior to 4.4, -Wuninitialized could only be used with -O.
2020-08-30 13:06:07 +01:00
Andy Green
314690f38d openssl: windows: also link with crypt32 in case used by openssl 2020-08-05 12:41:20 +01:00
Andy Green
b9cfc0c567 eventfd: use eventfd_read to check existence since its what we use 2020-07-29 20:36:44 +01:00
Andy Green
d1fa3dcfa8 ws: correctly handle ESTABLISHED rejecting connection
https://github.com/warmcat/libwebsockets/issues/1973
2020-07-14 19:42:19 +01:00
Andy Green
24f08fc5c0 coverity: missing malloc return check
This is only coming at vhost startup, for a server that's before we
go busy with heap.  But still, it should be checked.
2020-07-14 08:00:29 +01:00
Andy Green
ec9e8ab892 mbedtls: only free crt_parse when something came back
Mbedtls mbedtls_x509_crt_parse() returns 0 for success which is good.
But it has a complicated idea about what to return on fail... if it
couldn't make even one cert from the data, then it returns a negative
return indicating the parsing problem and there is nothing to free.

If it managed to parse at least one cert, instead it retuns a positive
number indicating the number of certs it didn't parse successfully,
and there is something to free.

Adapt the code to understand this quirk.
2020-07-09 14:11:46 +01:00
dev31337
1287e5757f lejp: enable negative integers
https://github.com/warmcat/libwebsockets/issues/1957
2020-06-20 17:23:40 +01:00
Andy Green
c09386cfee context_destroy: backport event-lib fixes from master 2020-06-19 20:34:38 +01:00
Andy Green
c930daeaa0 libevent: enforce no event state duplication
https://github.com/warmcat/libwebsockets/issues/1956
2020-06-19 19:56:58 +01:00
Andy Green
9b24e29b9a multipart: quote boundary
https://github.com/warmcat/libwebsockets/issues/1948
2020-06-12 07:26:24 +01:00
Andy Green
7840d455bb clean: additional-lws_intptr_t 2020-06-03 10:37:59 +01:00
Andy Green
d2b3bed3c9 clean: use lws_intptr_t where needed 2020-06-03 06:49:45 +01:00
Andy Green
c47096c20b ss: add api test with ctest integration
Tests via httpbin.org
2020-05-25 13:22:51 +01:00
dev31337
10d59608c0 PEER_LIMITS: make sure to close socketfd on deny 2020-05-24 17:15:56 +01:00
Andy Green
36bcae17ab http: if no content length transaction completes at hangup
If you encounter an h1 transaction with no content length and you
parsed the headers, it actually means a hangup subsequently is an
indication of a correct transaction completion.  So take care to
do the _COMPLETION callback under those circumstances too.
2020-05-19 18:37:53 +01:00
Andy Green
073a59264a unix domain: fix path name length
Unlike any other sockaddr variant it turns out when sockaddr_un reports its
sizeof() to connect() or listen(), it is trimmed to the used length of the
sun_path[] member not including any trailing 0x00.

Until now we worked fine, but our actual UDS paths have a large number of
trailing 0x00 (shown as @ in most tools).  Clients and servers can still
interoperate if they both have this broken name.

This patch fixes it to trim the sockaddr_un to the path length so the name
is as you would expect.
2020-05-15 18:25:12 +01:00
Andy Green
2ad2316d32 libev: fix destroy path and example typo
https://github.com/warmcat/libwebsockets/issues/1913
2020-05-12 19:33:02 +01:00
Andy Green
2a5b54d0a6 ss: make sure to use LWS_WRITE_HTTP_FINAL with SS EOM flag
When most of ss-h2 was combined into ss-h1 during development, the h2 difference
about needing HTTP_FINAL to signal h2 FIN flag was accidentally dropped.  In
many cases the peer can infer it, from, eg, content-length reached.  But we need
to replace explicitly doing it to cover all cases.
2020-05-11 15:11:11 +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
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
Andy Green
59fb0988a6 v4.0.2 2020-04-29 11:34:05 +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
Valentin B
3a6ce18feb CMake: Silence CMP0048 warnings
When libwebsockets is included as a subdirectory in other projects that rely on a minimum CMake version of 3.x, a CMP0048 policy warning will be raised due to the project not specifying a version in the project call.

This patch silences the warning by explicitly setting the policy within libwebsockets to NEW if it has already been forwarded as such, without any further impact on the behavior of CMake.
2020-04-21 08:36:22 +01:00
Andy Green
0824f77142 windows: async dns: fix typo 2020-04-10 16:44:51 +01:00
Andy Green
b1d2bdbe20 h2: take care to retain initial sid 2020-04-06 14:08:01 +01:00
Andy Green
6247f5ea79 wolfssl: build fixes 2020-03-20 09:38:17 +00:00
Andy Green
1acf0b33c7 mbedtls: support older versions without net_sockets.h 2020-03-19 14:36:05 +00:00
Andy Green
6eb39388f4 v4.0.1 2020-03-10 07:57:43 +00:00
Andy Green
1289b0a0ef v4.0.0 2020-03-06 10:18:46 +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
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
Andy Green
ed04a266ea rtos diet: make raw_file role optional 2020-03-04 11:00:04 +00:00
Olivier Langlois
5d74cf668c ev: check for IOURING 2020-03-01 08:14:44 +00:00
Andy Green
6bb116b8d8 socks5: cleanup and add test options
Refactor SOCKS5 client support to be gathered into
lib/core-net/socks5-client.c and make that build
contingent on LWS_WITH_SOCKS5.
2020-03-01 08:14:44 +00:00
Andy Green
1da0096d4d lws_fsmount: overlayfs apis 2020-02-21 17:32:41 +00:00
Andy Green
8a7e0edb7d lws_spawn_piped: break out from cgi
The vfork optimized spawn, stdxxx and terminal handling in the cgi
implementation is quite mature and sophisticated, and useful for
other things unrelated to cgi.  Break it out into its own public
api under LWS_WITH_SPAWN, off by default.

Expand it so the parent wsi is optional, and the role and protocol
bindings for stdxxx pipes can be set.  Allow optional sul timeout
and external lws_dll2 owner for extant children.

Remove inline style from minimal http-server-cgi
2020-02-21 17:32:41 +00:00
Oliver Langlois
a404f5e95a unix plat: use eventfd in place of pipe where possible
From eventfd man page:
Applications can use an eventfd file descriptor instead of a pipe (see
pipe(2)) in all cases where a pipe is used simply to signal events.
The kernel overhead of an eventfd file descriptor is much lower than
that of a pipe, and only one file descriptor is required
(versus the two required for a pipe).
2020-02-21 17:32:41 +00:00
Oliver Langlois
cbc8f0d9c0 ev: log aio backend 2020-02-21 17:32:41 +00:00
Andy Green
af2f1f9a87 event-lib-glib
Adds support for glib event library.
2020-02-21 17:32:41 +00:00
Andy Green
2cb705f71f cmake: make sure libz is at end of link if enabled
https://github.com/warmcat/libwebsockets/issues/1840
2020-02-21 17:32:41 +00:00
Andy Green
4b3801ab6f cmake: old osx clang: suppress check failures sue to -pthread only recognized at compile time 2020-02-21 17:32:41 +00:00
Andy Green
4683ae2596 cmake: fix situation like mingw where toolchain file sets platform defines
https://github.com/warmcat/libwebsockets/issues/1831
2020-02-04 14:16:18 +00:00
Andy Green
068a54a340 openssl: make sure tests have -ldl v2
https://github.com/warmcat/libwebsockets/issues/1662
2020-01-17 12:33:51 +00:00