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

4777 commits

Author SHA1 Message Date
Andy Green
280c81278d ws: remove now unused ws_ping_pong_interval
https://github.com/warmcat/libwebsockets/issues/1915
2020-05-27 08:40:12 +01:00
Andy Green
2d7be680de android: modernize toolchain file and add build README
Add builder to .sai.json for just lws + mbedtls on aarch64
2020-05-27 08:40:12 +01:00
Andy Green
71f2333e8f ios: import toolchain file
This (BSD 3-clause) came from here
https://raw.githubusercontent.com/cristeab/ios-cmake/master/toolchain/iOS.cmake

and is necessary to build cmake projects properly using xcode / iOS SDK

Add Sai build for iOS on mac, currently without tls
2020-05-27 08:40:12 +01:00
Andy Green
5623380803 libev: fix destroy path and example typo
https://github.com/warmcat/libwebsockets/issues/1913
2020-05-27 08:40:12 +01:00
Andy Green
b3576e7205 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-27 08:40:12 +01:00
Sakthi Kannan
ee3b4a4b81 mqtt: avoid LRS_H1C_ISSUE_HANDSHAKE
Otherwise we can get the client connection stalling since H1C has no meaning on mqtt.
2020-05-27 08:40:12 +01:00
Andy Green
71f6f9a1f9 win: deal with FD_CONNECT better
POSIX connect() specifies it will signal POLLOUT available when
the connect result is available.  But windows has some non-posix
nonsense.

Improve the plat support to simulate the missing POLLOUT.
2020-05-27 08:40:12 +01:00
Andy Green
36ec353dac client: allow setting overall connect timeout from vh init
Add a member to the vh init struct allowing control of the overall
connection wait introduced in an earlier patch.  Set it to 20s
by default.


The timeout_secs member controls the individual DNS result
connect timeout and is reduced to 5s by default.
2020-05-26 17:05:39 +01:00
Andy Green
c97b68272c connect: enforce timeout for connect async wait
This patch allows client connections to recover from a nonresponsive
(ie, does not complete connect()) peer and continue to try subsequent
DNS results.
2020-05-11 21:21:01 +01:00
Andy Green
e4a9307b11 lejp: support outer element is array 2020-05-11 21:20:29 +01:00
Andy Green
9f1d019352 CTest: migrate and deprecate existing selftest scripts
Replace the bash selftest plumbing with CTest.

To use the selftests, build with -DLWS_WITH_MINIMAL_EXAMPLES=1
and `CTEST_OUTPUT_ON_FAILURE=1 make test` or just
`make test`.

To disable tests that require internet access, also give
-DLWS_CTEST_INTERNET_AVAILABLE=0

Remove travis and appveyor scripts on master.

Remove travis and appveyor decals on README.md.
2020-05-11 15:40:13 +01:00
Andy Green
af26f0c765 lejp: correct return temp type to int
lejp_parse() return type is an int... but in the function, the temp
for it is a char.  This leads to badness that is currently worked
around by casting the return through a signed char type.

But that leads to more badness since if there's >127 bytes of buffer
left after the end of the JSON object, we misreport it.

Bite the bullet and fix the temp type, and fix up all the guys
who were working around it at the caller return casting to use the
resulting straight int.

If you are using this api, remove any casting you may have cut-
and-pasted like this

n = (int)(signed char)lejp_parse(...);

... to just be like this...

n = lejp_parse(...);
2020-05-11 15:17:14 +01:00
Kyle Greenwell
bebd3f71a6 h2: add prior knowledge support 2020-05-08 18:56:17 +01:00
Andy Green
c3a8387afd ss: support no tls in policy
If there's no trust store in use, create a default vhost so everything
can continue normally
2020-05-06 15:21:12 +01:00
Andy Green
43b83c333b client: allow setting keep warm time
Until now if the generic transaction completes and the connection is idle,
there's a fixed 5s grace period to keep the connection up in case something
else wants it.

This allows setting it in the client creation info struct .keep_warm_secs.
If left at 0, then it maintains the backward-compatible 5s wait.
2020-05-06 09:06:24 +01:00
Andy Green
641831b3c5 context: if linux and fd_limit_per_thread set try to configure by setrlimit 2020-05-06 09:06:24 +01:00
Jed Lu
f1f27562a0 ss: auth: lwa reacquire 2020-05-05 17:00:32 +01:00
Andy Green
401d6951da 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:25:51 +01:00
Jed Lu
54e63cf75d ss auth: dont attempt auth if necessary blob unavailable 2020-05-05 06:36:50 +01:00
Andy Green
2cc0a7f6f6 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-05 06:36:39 +01:00
Andy Green
3d995cf7c5 fds: add sanity checks 2020-05-05 06:34:58 +01:00
Andy Green
2d3e62b112 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-05 06:34:48 +01:00
Andy Green
cced12822b lws_dir: add rm -rf and glob filter callbacks
Bring over two general-purpose callbacks for lws_dir from Sai
2020-05-03 14:16:48 +01:00
Andy Green
cb0ea63ef1 Refresh of ctest-migrate-and-deprecate 2020-05-03 14:16:48 +01:00
Andy Green
71e4b4118e strexp: reset out offset each time
A second strexp mustn't inherit the offset of the first, completed one
2020-05-03 14:16:48 +01:00
Andy Green
fa7c86951c lws_struct: blob
Add support for blob type in sqlite3... it's unusual in that it
is created into the table schema as a column of blob type, but is
not serialized or deserialized into or from JSON or sqlite.

Because the size of blobs is open-ended, accessing them in one
hit may not be possible, eg, exceed the size of available heap.
As binary, they would have to be base64-encoded in JSON
representation and that bloating may be excessive, with, eg,
a 500MB blob.  So while they can be defined using lws_struct
schema, and coexist inside a column of a table managed by
lws_struct, they must be read and written separately.
2020-05-03 13:04:15 +01:00
Steve Kyoungwon Kim
a9275d8dea 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:20:29 +01:00
Sakthi Kannan Ramabadran
abf3875d78 mqtt: some toolchains object to typedef
Use struct type instead of typedef to avoid it.
2020-04-27 19:45:32 +01:00
huangkaicheng
79ef48e33c cmake: remove unicode quote from lws_config_private template
Apparently some toolchains / platforms / locales don't handle UTF-8 well
2020-04-27 14:01:33 +01:00
Andy Green
f2d5d4274b client: change default connect timeout to 30s 2020-04-26 06:34:00 +01:00
Andy Green
9660245108 linkit-force-mbedtls-options 2020-04-25 15:11:21 +01:00
Andy Green
2d5662a4f9 CMake: no pthreads in LWS_PLAT_FREERTOS 2020-04-25 15:11:21 +01:00
Andy Green
c95706a17f ntpclient: add plat-specific init with env var LWS_NTP_SERVER able to set it on unix and windows
Trying to use a remote pool is very variable with CI, the builder can
force a local ntpd this way cleanly.

When enabled all the test apps use ntpclient, so this lets us tell them all to
go to the local ntpd in one hit.
2020-04-25 15:11:21 +01:00
Adam Duskett
ee40b52c62 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:03:31 +01:00
Andy Green
99e778ac08 http: add cmake option for header reduction defeat
Lws now strips out http headers releated to h2, ws and unusual headers
based on cmake config settings for those features... it saves some heap
for the ah and reduces the table size in .rodata.

It's possible code might have some external dependency on the original
header indexes, but, eg, you don't enable h2 so those indexes are
optimized with the h2 ones taken out.

This introduces a cmake option "LWS_HTTP_HEADERS_ALL", default-OFF, that
defeats the header table optimization for compatibility with older
versions in the case the client software can't be adapted to use the
lws-exported matching header enums.

You probably don't need this.
2020-04-23 17:08:57 +01:00
Andy Green
e72fe1bc4d unix: try to work around externally closed fds 2020-04-23 08:27:12 +01:00
huangkaicheng
974b65a2f0 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:30:11 +01:00
Andy Green
d9f793ae12 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-22 06:59:01 +01:00
Andy Green
beb49292d4 client: fix bad state after early tls connection
If we are slow and we can complete the tls connection quickly,
if we want to send a hs we must use H1C...HANDSHAKE2 now we
have the tls negotiation done.
2020-04-21 21:51:07 +01:00
Valentin B
aa0e94ca5d 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:35:44 +01:00
Andy Green
c424426523 test-server: bump generated selsigned cert to 2048 bits
On Ubuntu 20.04 Focal, openssl is configured by default to reject the old 1024-bit keys
2020-04-21 03:48:57 +01:00
Andy Green
90aa78f0a8 docs: add notes on cmake 2020-04-20 18:23:10 +01:00
Andy Green
40803b3e0d lws_struct: sqlite open option for create or not 2020-04-20 12:56:58 +01:00
Andy Green
a57e62d502 ctest: fixes-and-changes 2020-04-19 08:43:01 +01:00
Andy Green
7399f82959 spawn: CLOEXEC the wsi fds earlier 2020-04-19 06:15:26 +01:00
Andy Green
dacae3a951 osx: do not connect udp
Unlike linux or windows, blanket rejects sendto() afterwards with EISCONN
2020-04-17 12:39:53 +01:00
Andy Green
ef294c979f ntpclient: make retries less sparse 2020-04-17 12:39:53 +01:00
Andy Green
8299bd4191 windows: async dns find DNS server using modern api 2020-04-17 12:39:53 +01:00
Andy Green
a8ad5068e4 windows: fix service for udp and pending tls delays
UDP: call to recv() in there for unknown reasons was trashing udp

delays: pending tls (where data is buffered and no pending POLLIN)
was not reflected in forcing the wait to 0 properly.
2020-04-17 12:39:53 +01:00
Andy Green
e3c6d9d6c1 context creation: remove chance to create vhost twice 2020-04-17 12:39:53 +01:00