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

3779 commits

Author SHA1 Message Date
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
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
Andy Green
f2d5d4274b client: change default connect timeout to 30s 2020-04-26 06:34:00 +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
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
Andy Green
e4c59e3a91 osx: mbedtls: SYSCALL and errno 35 is WANT_READ 2020-04-17 12:39:53 +01:00
Andy Green
6e4eac2b80 http: client multipart: caulate remaining length correctly
The current position is understood to be in *p, but for the remaining length
calculation we are wrongly comparing to p...
2020-04-17 12:39:53 +01:00
Andy Green
d5cb0c6aa3 async-dns: cope with larger resolv.conf
Eg, systemd-resolved produces a huge comment at the start of its
default resolv.conf.  Buffer it into the pt_serv_buf to cope.
2020-04-17 12:39:53 +01:00
Andy Green
886a588963 lws_dir: XFS does not report directories via dirent
If it says it's unknown, we always need to fall back on to the stat method.
2020-04-16 11:18:40 +01:00
Andy Green
d339505f51 h2: cmake: build with NO_SERVER 2020-04-16 06:59:45 +01:00
Andy Green
a8eebc47a5 smp: helgrind and sai lock fixes 2020-04-15 20:57:56 +01:00
Andy Green
eca75ee14d http: pipelining: fixes from xenial sai 2020-04-15 20:35:13 +01:00
Andy Green
63c8a23776 lws_spawn: windows
Move the unix spawn.c from lib/misc through to lib/plat/unix, and
add an implementation for windows in lib/plat/windows
2020-04-13 19:29:09 +01:00
Octavia93
2d5a7d1430 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:16:26 +01:00
Andy Green
e3d780dac6 gencrypto: windows: warnings
Coming out of increasing number of build variants on windows via Sai
2020-04-12 08:39:27 +01:00
Andy Green
acc3e9ba13 lws_struct: sqlite3: avoid chown for windows 2020-04-11 16:55:54 +01:00
Andy Green
ff53a89db2 windows: async dns: fix typo 2020-04-10 17:49:19 +01:00
Andy Green
d7294a714e windows: import tronkko's dirent.h
Win32 compatible version of dirent.h microsoft just don't seem to be
able to include themselves.

MIT license, same as lws, link to original github project in the header
2020-04-08 11:26:53 +01:00
Andy Green
d3308df40f windows: pthreads
Add support for external pthreads lib on windows and some docs about how to do.

It can build with LWS_WITH_THREADPOOL and LWS_WITH_MINIMAL_EXAMPLES including the
pthreads-dependent ones without warnings or errors on windows platform as well with this.

pthreads_t can be anything, including a struct - not a pointer-to-a-struct
but the struct itself.  These can't be cast to a void * for printing as they can
on linux, where the base type is a pointer.

Let's fix all the usage of those to determine their own thread index in terms
of the meaning to the program rather than as a tid.
2020-04-07 14:05:21 +01:00
Andy Green
1a8833dcfd windows: ipv6 compile fix
Via turtiain

https://github.com/warmcat/libwebsockets/issues/1880
2020-04-07 10:09:00 +01:00
Andy Green
2d55e18947 ss: windows build adaptations
Windows compiler finds various non-bug things to complain about when
building with SS and other options, fix them up
2020-04-06 20:25:06 +01:00
Jaco Kroon
33c9a6da4c 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:19 +01:00
Andy Green
5e99b9f3ee h2: take care to retain initial sid 2020-04-06 13:22:01 +01:00
Andy Green
370ba6f5ed lws_struct: handle empty char array serialization 2020-04-05 12:06:31 +01:00
Andy Green
fb3fd499e3 threadpool: allow multiple threadpool tasks to bind to same wsi 2020-04-04 10:47:11 +01:00
Andy Green
4caeb56bec vfork
There's a subtle difference between fork and vfork... when doing the
dup() before the exec, with cfork we are still dealing with the
parent process "possessed" by the forked process briefly inbetween
the vfork() and the exec().

That matters because when we close the duplicated fds for the stdxxx
pipes, with vfork we're closing the fd we still want to hold in the
parent process.
2020-04-01 05:56:45 +01:00
Andy Green
39b05e7db3 mbedtls: remove mbedtls_x509_crt_info reference
Nobody uses this from the wrapper... it brings in mbedtls_x509_crt_info()
even if you're using -ffunctionsections for a loss of about 1.7KB on Arm.


Let's chop it out...
2020-03-31 11:36:47 +01:00
Andy Green
d9f249f39f ss-document-support-for-unix-domain
Explain how to use unix domain connection with secure streams
2020-03-28 19:06:46 +00:00
Andy Green
e26f83bd83 ss: add support for raw-skt protocol 2020-03-28 16:20:50 +00:00
Andy Green
ee9ab7c1fc fanalyzer: workarounds and fixes
GCC -fanalyzer did find a real issue (unchecked malloc return)
but it mainly reported things that weren't true due to what
was happening outside of the particular compilation unit that
it could see.
2020-03-27 19:16:06 +00:00
Andy Green
be32d0554e mbedtls: attempt to remove dependency on net_sockets.c
The mbedtls openssl wrapper wants to use exports from mbedtls' net_sockets.c,
but this is only supposed to work on *nix and windows.  Typically people
are using mbedtls on RTOS type platforms and to use it, net_sockets.c
needs some hacking.

Try to avoid that situation by porting the two exports we need into the
lws plat code and call from the wrapper.
2020-03-27 13:24:44 +00:00