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

3150 commits

Author SHA1 Message Date
Chunho Lee
05a1f9ef37 coverity: check timer opaque before dereferencing
Actually we always set this correctly using the uv_timer_start() wrapper,
so this is a false positive.  But satisfy Coverity nonetheless.
2021-06-30 06:52:57 +01:00
Andy Green
c744c0934d v3.2.3 2020-05-06 18:25:37 +01:00
Andy Green
d3f6f08f2c 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:10:18 +00:00
Akira Tsukamoto
9a5861cf76 jws: lws_gencrypto_jws_alg_to_definition needs sentinel
Otherwise segfault when end of array reached.
2020-03-21 07:02:27 +00:00
Andy Green
9cac58a4c2 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:50:05 +00:00
TerryZhang
5eaab80708 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:51:47 +00:00
Andy Green
3a4698e63a malloc_trim: move out of unix plat and into lwsws
https://github.com/warmcat/libwebsockets/issues/1849
2020-02-24 10:32:59 +00:00
Andy Green
77c1294bd8 cmake: make sure libz is at end of link if enabled
https://github.com/warmcat/libwebsockets/issues/1840
2020-02-17 19:10:52 +00:00
Oliver Langlois
17357ddd5a 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-09 05:48:16 +00:00
Oliver Langlois
8c690f1ed9 ev: log aio backend 2020-02-09 05:48:10 +00:00
Andy Green
cad9f3e521 cmake: old osx clang: suppress check failures sue to -pthread only recognized at compile time 2020-01-27 16:23:39 +00:00
Maciek Sipior
d642a3ee2b humanize: export schema arrays to include lengths
Due to windows compiler choking on it otherwise
2020-01-23 11:12:52 +00:00
Piotr Nazimek
1ead90bcd6 lws_ring: use __mtail instead of hardcoded tail
Changed harcoded member name "tail" into ___mtail in lws_ring_consume_and_update_oldest_tail macro.
2020-01-22 14:18:33 +00:00
Andy Green
d880fe2330 v3.2.2 2020-01-17 12:38:42 +00:00
Andy Green
bd5e3ccec4 openssl: make sure tests have -ldl v2
https://github.com/warmcat/libwebsockets/issues/1662
2020-01-17 12:35:27 +00:00
Andy Green
de978800f0 openssl: disallow client connections if X509_VERIFY_PARAM_set1_host absent from tls lib
https://github.com/warmcat/libwebsockets/issues/1827
2020-01-16 19:51:44 +00:00
Christian Thießen
3179323afa http client: Fix overwite of addrlen for connect if binding to iface
The addrlen argument to connect() was overwritten by the
lws_socket_bind() result, which is a port number.
Fixes https://github.com/warmcat/libwebsockets/issues/1817
2020-01-10 06:00:14 +00:00
Jaco Kroon
0cf41c06ac build options: fix SOCKS5 and WITHOUT_CLIENT
If LWS is build with SOCKS5 support, but WITHOUT_CLIENT then a compile
failure occurs which this fixes.

Signed-off-by: Jaco Kroon <jaco@iewc.co.za>
2020-01-06 19:56:20 +00:00
Fabrice Fontaine
b57c520495 CMakeLists.txt: fix LWS_HAS_GETOPT_LONG
Commit 6985244eb1 wrongly moved
LWS_HAS_GETOPT_LONG under LWS_HAVE_PTHREAD_H so revert this change

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-01-03 14:03:34 +00:00
Fabrice Fontaine
bfcbe8f542 openssl: detect apis correctly when pthreads not available
Since version 3.1.0 and commit aa4143aebd,
-pthread is unconditionally added to CMAKE_REQUIRED_FLAGS even if
pthread.h is not found, this will result in a build failure with openssl
if the toolchain doesn't support threads:

[  5%] Building C object CMakeFiles/websockets_shared.dir/lib/core/lws_dll2.c.o
In file included from /home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/include/libwebsockets.h:570,
                 from /home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/lib/core/private.h:130,
                 from /home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/lib/core/lws_dll2.c:22:
/home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/include/libwebsockets/lws-genhash.h:79:18: error: field 'ctx' has incomplete type
         HMAC_CTX ctx;
                  ^~~

This build failure is raised because openssl functions are not correcly
detected:

Determining if the function SSL_CTX_set1_param exists failed with the following output:
Change Dir: /home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_06946/fast && make[1]: Entering directory '/home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/CMakeFiles/CMakeTmp'
/usr/bin/make -f CMakeFiles/cmTC_06946.dir/build.make CMakeFiles/cmTC_06946.dir/build
make[2]: Entering directory '/home/buildroot/autobuild/instance-2/output-1/build/libwebsockets-3.2.0/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_06946.dir/CheckFunctionExists.c.o
/home/buildroot/autobuild/instance-2/output-1/host/bin/arm-linux-gcc --sysroot=/home/buildroot/autobuild/instance-2/output-1/host/arm-buildroot-linux-uclibcgnueabihf/sysroot -DKEYWORD=__inline  -Wall -Wsign-compare -Wuninitialized -Werror  -Wundef  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os  -DCHECK_FUNCTION_EXISTS=SSL_CTX_set1_param -pthread  -DNDEBUG   -o CMakeFiles/cmTC_06946.dir/CheckFunctionExists.c.o   -c /home/buildroot/autobuild/instance-2/output-1/host/share/cmake-3.15/Modules/CheckFunctionExists.c
Linking C executable cmTC_06946
/home/buildroot/autobuild/instance-2/output-1/host/bin/cmake -E cmake_link_script CMakeFiles/cmTC_06946.dir/link.txt --verbose=1
/home/buildroot/autobuild/instance-2/output-1/host/bin/arm-linux-gcc --sysroot=/home/buildroot/autobuild/instance-2/output-1/host/arm-buildroot-linux-uclibcgnueabihf/sysroot -Wall -Wsign-compare -Wuninitialized -Werror  -Wundef  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os  -DCHECK_FUNCTION_EXISTS=SSL_CTX_set1_param -pthread  -DNDEBUG    CMakeFiles/cmTC_06946.dir/CheckFunctionExists.c.o  -o cmTC_06946 /home/buildroot/autobuild/instance-2/output-1/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/libssl.so /home/buildroot/autobuild/instance-2/output-1/host/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/libcrypto.so -lssl -lcrypto -lm -lcap
/home/buildroot/autobuild/instance-2/output-1/host/opt/ext-toolchain/bin/../lib/gcc/arm-buildroot-linux-uclibcgnueabihf/8.3.0/../../../../arm-buildroot-linux-uclibcgnueabihf/bin/ld: cannot find -lpthread
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_06946.dir/build.make:88: recipe for target 'cmTC_06946' failed

Fixes:
 - http://autobuild.buildroot.org/results/6186b4718db285edadf7203d00ed72f8d76a31e4

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-01-01 10:48:04 +00:00
Andy Green
bb244c0b2b lextable: fix x-forwarded-for
https://github.com/warmcat/libwebsockets/issues/1801
2019-12-20 18:45:04 +00:00
Andy Green
a58586b3a4 README.coding: update libev section 2019-12-20 18:37:17 +00:00
Wojtek Kaniewski
fd70c1ac81 openssl: handle negotiation errors handling in client
If a client connects to a SSL server and the server sends handshake
alert (e.g. no matching ciphers) SSL_connect() fails, but because
SSL_ERROR_SSL return value is not handled, it's not considered a
failure. SSL_want_read() will return 1 and the client will happily wait
for more data from the server. Now if the server closes connection after
sending handshake alert, POLLIN event will be triggered,
lws_tls_client_connect() called again, but SSL_connect() will fail
without calling read(), so the client will end up consuming 100% CPU
because POLLIN will be triggered repeatedly.

Similar error handling is used in lws_tls_server_accept() and the
condition checks for SSL_ERROR_SSL. Using the same condition in
lws_tls_client_connect() fixes the problem.

Tested with OpenSSL 1.0.2k.
2019-12-19 21:32:31 +00:00
Jerry Jacobs
9f9dba9f20 close.c: close reason length wrong
The string length is actually 25... solve it by measuring the same
string.
2019-12-18 14:45:31 +00:00
Andy Green
f4f4d25faa mbedtls: cast ecdh enum type for some toolchains 2019-11-27 07:43:55 +00:00
Andy Green
1b3e35bfe2 docs: improve explanation in LWS_CALLBACK_RECEIVE_CLIENT_HTTP
https://github.com/warmcat/libwebsockets/issues/1772
2019-11-26 17:50:29 +00:00
Andy Green
3de710e223 lws_context_create: clean up cancel pipes on fail
https://github.com/warmcat/libwebsockets/issues/1765
2019-11-16 16:55:09 +00:00
Andy Green
f04d18b5da server vfs: close: cleanup also at just_kill_connection
... and at transaction completion
2019-11-16 08:20:48 +00:00
Andy Green
25a2ce56e2 connect: make sure SOCK_STREAM set either way 2019-11-15 20:22:29 +00:00
Andy Green
c450d06413 server: vfs: make sure handle freed if problems while setting up file transfer
https://github.com/warmcat/libwebsockets/issues/1765
2019-11-15 20:14:32 +00:00
Andy Green
d8fa971b8a http_proxy: fix for mbedtls 2019-11-15 09:15:37 +00:00
Andy Green
0516966d7d http_proxy: fixes 2019-11-15 08:44:22 +00:00
Andy Green
1bd08c3941 test-client: crl: declare vars before code
Some toolchains blow chunks otherwise

https://github.com/warmcat/libwebsockets/issues/1451
2019-11-06 09:11:04 +00:00
Andy Green
0019b67f8b ws-over-h2: wrong sid on rst_stream
rst_stream is almost always called from the h2 parser... in the case
a ws-over-h2 is closing though, it can't reference the h2n parser sid
context to get the sid to send... it's unrelated at that time.

https://bugzilla.mozilla.org/show_bug.cgi?id=1590299
https://github.com/warmcat/libwebsockets/issues/1752
2019-11-04 21:24:55 +00:00
Andy Green
7fad06e9e0 unix: sul schedule rename internal api and call regardless of existing timeout
Pre-sul, checking for interval to next pending scheduled event was expensive and
iterative, so the service avoided it if the wait was already 0.

With sul though, the internal "check" function also services ripe events and
removes them, and finding the interval to the next one is really cheap.

Rename the "check" function to __lws_sul_service_ripe() to make it clear it's
not just about returning the interval to the next pending one.  And call it
regardless of if we already decided we are not going to wait in the poll.

After https://github.com/warmcat/libwebsockets/pull/1745
2019-11-01 12:35:31 +00:00
Kristján Valur Jónsson
e949b20c00 windows: service: do sul check and service regardless of service timeout 2019-11-01 06:46:25 +00:00
Kristján Valur Jónsson
16e31d4fd6 windows: Fix ioctl result check polarity 2019-10-28 13:24:21 +00:00
Kristján Valur Jónsson
1485db1805 Use IPPROTO_TCP if getprotobyname("tcp") fails. 2019-10-27 16:39:19 +00:00
Kristján Valur Jónsson
9dd8d03387 Improve logging when setting sock opts on windows 2019-10-27 16:39:07 +00:00
Kristján Valur Jónsson
f958c0f03e fix integer conversions from 64 bit 2019-10-27 16:38:54 +00:00
Andy Green
5bd1bed6e9 sul: more paranoid casting vs libc header types 2019-10-27 15:46:58 +00:00
Andy Green
4d23fb1389 ws: handle no ws object at sul_ping callback 2019-10-23 12:04:32 +01:00
Andy Green
841a762992 wsproxy: clear down proxy struct at alloc 2019-10-07 16:09:24 +01:00
Zhiwen Zheng
6b0e2e7cfa cgi: fix passing cgi envs using setenv() 2019-10-07 10:14:06 +01:00
Zhiwen Zheng
de6a8e8194 illumos: fix build errors and warnings for v3.2-stable on illumos 2019-10-07 10:14:02 +01:00
Fabrice Fontaine
3817780ea7 CMakeLists.txt: fix build with libev and without testapps
Move libev workaround outside the
if ((LWS_ROLE_H1 OR LWS_ROLE_H2) AND NOT LWS_WITHOUT_TESTAPPS) block
otherwise build fails on:

/home/naourr/work/instance-1/output-1/build/libwebsockets-3.2.0/lib/event-libs/libev/libev.c: In function 'lws_ev_hrtimer_cb':
/home/naourr/work/instance-1/output-1/build/libwebsockets-3.2.0/lib/event-libs/libev/libev.c:34:3: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
   ev_timer_set(&pt->ev.hrtimer, ((float)us) / 1000000.0, 0);
   ^~~~~~~~~~~~

Fixes:
 - http://autobuild.buildroot.org/results/b5a2188dce90f3ca9bf0cc7a043c1a946b8e288f

AG: this doesn't really fix anything... the spew is intentionally part of libev.
    It just hides the spew... since the maintainer won't fix it
    this is the only way AFAIK.  Other than don't use libev.

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2019-10-06 15:26:00 +01:00
Andy Green
3e013bf352 cgi: check for stdout failed or gone away 2019-10-05 11:15:14 +01:00
Jakob Szumacher
d949b5529a client: LCCSCF_ALLOW_INSECURE
AG add options the minimal http client related to this
2019-09-18 10:09:43 +01:00
Andy Green
bd8a751fc4 client_reset: don't reset protocol 2019-09-17 10:13:00 +01:00
Andy Green
b2de3c98cc doxygen: cleanup and add recent includes 2019-09-17 09:25:45 +01:00