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

2264 commits

Author SHA1 Message Date
Andy Green
dba00cff6f mirror: fix spin on close 2017-11-03 11:47:57 +08:00
Andy Green
462e449cd6 lws_hdr_copy: protect against garbage 2017-11-02 08:11:06 +08:00
Andy Green
d30597f728 ah: increase timeout sanity check to ah_idle + 60 2017-10-31 07:02:51 +08:00
Andy Green
7594bc585c win: move LEAN_AND_MEAN before tls includes
It's always mean... we define LEAN_AND_MEAN in libwebsockets.h
but we include libwebsockets.h partway through private-libwebsockets.h.

Reorder for https://github.com/warmcat/libwebsockets/issues/1080
2017-10-31 06:45:03 +08:00
Andy Green
491fd183f8 lws_timingsafe_bcmp 2017-10-28 13:24:41 +08:00
Petar Paradzik
413631632b ssl: fix segfault when using SSL_CTX that is not created
vhost->ssl_ctx is created in 'lws_tls_server_vhost_backend_init', but it
is used before in 'lws_tls_server_client_cert_verify_config' when
calling SSL_CTX_set_session_id_context...

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>
2017-10-26 18:55:12 +08:00
Andy Green
5a90bb36d1 lejp: add test app to parse stdin 2017-10-26 18:55:12 +08:00
Andy Green
f9421f084b lejp: integrate header into libwebsockets.h 2017-10-26 18:55:11 +08:00
Andy Green
505a3fc1fc windows: finally fix gzip redefinition warnings 2017-10-26 18:55:11 +08:00
Andy Green
d286e990f0 windows: fix missing declatations for open etc
Due to windows needing nonstandard include io.h for
standard apis...
2017-10-26 18:55:11 +08:00
Andy Green
52d82ad83a cgi: make sure compiler cant see uninitialized use 2017-10-26 18:54:52 +08:00
Andy Green
5a0b5299d2 lejp: use explicit signed char return 2017-10-25 07:54:18 +08:00
Andy Green
4afeefbb3c build: strict-aliasing on old compiler workaround
https://github.com/warmcat/libwebsockets/issues/1067
2017-10-25 07:54:18 +08:00
Andy Green
1c70181ca2 build: enable signed vs unsigned warnings on gcc
This enables selected things from -Wextra, can't use -Wextra because it is
fussy enough to complain about unused params on functions... they are
there for a reason.

-Wsign-compare
-Wignored-qualifiers
not -Wimplicit-fallthrough=3 ... only on gcc 7
-Wtype-limits
-Wuninitialized
not -Wclobbered ... only on gcc 7ish

fix the warnings everywhere they were found.
2017-10-25 07:17:29 +08:00
Andy Green
89cb55ea58 tls: split out common, openssl and mbedtls code
- introduce lib/tls/mbedtls lib/tls/openssl
 - move wrapper into lib/tls/mbedtls/wrapper
 - introduce private helpers to hide backend

This patch doesn't replace or remove the wrapper, it moves it
to lib/tls/mbedtls/wrapper.

But it should be now that the ONLY functions directly consuming
wrapper apis are isolated in

  - lib/tls/mbedtls/client.c (180 lines)
  - lib/tls/mbedtls/server.c (317 lines)
  - lib/tls/mbedtls/ssl.c    (325 lines)

In particular there are no uses of openssl or mbedtls-related
constants outside of ./lib/tls any more.
2017-10-25 07:17:29 +08:00
Andy Green
bb04883097 travis: add mbedtls + http2 variant 2017-10-25 07:17:29 +08:00
Andy Green
ce68d38794 LWS_PRE: make int 2017-10-25 07:17:22 +08:00
Andy Green
4a2dd2bdaa http2: missing return when openssl too old 2017-10-24 20:19:24 +08:00
Andy Green
af8f2d3616 protocol init: allow use of client apis during per-vhost protocol init 2017-10-24 20:19:24 +08:00
Sebastian Mueller
28d820ba0a getifaddrs-fix-include-reference
https://github.com/warmcat/libwebsockets/issues/1068
2017-10-24 20:19:17 +08:00
Andy Green
c86488be9c getifaddrs: fix conditional build 2017-10-24 06:39:37 +08:00
Andy Green
11afda24ed client: allow failout when adding client headers 2017-10-23 13:44:35 +08:00
Andy Green
07d4cf7628 client: do not treat selected response codes as connection failures
There was not really any "connection failure" with some of these like 404.

They may have body content that is important.

The client should use lws_http_client_http_response(wsi) to discover
the response code the client action received and decide for itself
what to do about that.
2017-10-23 13:44:27 +08:00
Andy Green
10828b1ea0 mirror: fix multiple mirror instances hang 2017-10-20 21:10:29 +08:00
Andy Green
8528de580a getifaddrs: fix second lws_malloc 2017-10-19 21:00:50 +08:00
Andy Green
001b3010a6 sshd: fix NULL vhd protection 2017-10-19 11:26:29 +08:00
Andy Green
79326e4f07 daemonize: fix missing lws_malloc reason param 2017-10-18 20:19:46 +08:00
Andy Green
fcf5b2c25a v2.4.0 2017-10-17 13:21:12 +08:00
Andy Green
dfacbc2071 mbedtls: fix client 2017-10-17 13:21:10 +08:00
Andy Green
1799b02a43 windows: POLLHUP is or-ed on other events
https://github.com/warmcat/libwebsockets/issues/1054
2017-10-16 17:28:37 +08:00
Andy Green
c83afc66e6 refactor: subdirs for source in lib
Split out some optional code into own sources to
shrink down libwebsockets.c and server.c a bit
2017-10-16 17:28:37 +08:00
Andy Green
904a9c0920 http2: make usable
HTTP/2 support is now able to serve the test server, complete with
websockets, from a single vhost.

 - This works the same with both OpenSSL and mbedTLS.

 - POST is now wired up and works (also for file upload).

 - CGI is wired up and works.

 - Redirect is adapted and works

 - lwsws works.

 - URI urldecode, sanitation and argument parsing wired up for :path

valgrind clean (aside from openssl-style false uninit data usage in mbedtls send occasionally)

h2spec reports:

$ h2spec  -h 127.0.0.1 -p 7681 -t -k -o 1
...
145 tests, 145 passed, 0 skipped, 0 failed"

Incorporates:

 - "https://github.com/warmcat/libwebsockets/pull/1039
	Fixes issue with -Werror=unused-variable flag

 - 2c843a1395
	ssl: fix infinite loop on client cert verification failure

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>"

Caused and fixes Coverity 184887 - 184892
2017-10-16 17:13:49 +08:00
Andy Green
028551271e client: reorder close callbacks
This will make sure you get

 - DROP_PROTOCOL
 - CONNECTION_ERROR
 - CLOSED_CLIENT_HTTP

as expected for failed client connections.
2017-10-16 17:13:49 +08:00
Andy Green
e67ae24d41 doxygen cleanup 2017-10-16 17:13:49 +08:00
Andy Green
6f3f2df7ca lejp-conf: skip conf.d files containing tilde
https://github.com/warmcat/libwebsockets/issues/1051
2017-10-16 17:13:49 +08:00
Andy Green
1673554c6b vh protocol destroy: dont miss vhosts 2017-10-16 17:13:49 +08:00
Andy Green
f66b84778c windows: defeat service if no vhosts 2017-10-16 17:13:49 +08:00
Andy Green
46b04f4ba4 wrapper: make SSL_accept nonblocking
The mbedTLS / OpenSSL wrapper spins for the duration of the
handshake, which is a slow 31ms on my x86_64 box (by comparison
it's ~1ms on actual OpenSSL on the same box).

This doesn't change the 31ms but it stops us spinning during the
accept and has us retry on POLLIN instead like OpenSSL.

Note this also fixes the endemic mismatches in returncode
between mbedTLS and OpenSSL semantics...
2017-10-16 17:13:49 +08:00
Claudi Martinez
df2dc99c14 Subject: toolchain: Create cross-w64.cmake
Toolchain file for crosscompiling on 64bit Windows platforms.
2017-10-16 17:13:49 +08:00
Claudi Martinez
d3fb641cdb Subject: toolchain: Create cross-w32.cmake
Toolchain file for crosscompiling on 32bit Windows platforms from Linux's MinGW platform.
2017-10-16 17:13:49 +08:00
Andy Green
9c2a7dd58b ah pool: change to dynamic linked list
For some targets like ESP32, the ah pool is mainly sitting idle wasting memory.

For HTTP/2, if the client sends a series of pipelined headers on different SIDs
that exist simultaneously, there is no way to stall the headers to wait for an
ah, because we must read the stream for stuff like WINDOW_UPDATE on the other
streams.

In both these cases having the ability to free unused ah completely and allocate
more dynamically if there is memory is useful, so this patch makes the ah pool
an initially-empty linked list that allocates on demand up to the "max pool
size" limit from the context info.  When nobody wants an ah, it is freed (if
someone was waiting for it, it is directly reused).

For ESP32 it means no large, permanent alloc when lws starts and dynamic alloc
according to how many streams the client opens, which can be controlled by
SETTINGS.
2017-10-16 17:13:49 +08:00
Andy Green
4f99ccd6a8 heap instrumentation 2017-10-16 17:13:49 +08:00
Andy Green
4e55c1c452 docs: add complex cross compile worked example 2017-10-16 17:13:49 +08:00
Andy Green
5fd9ad2dc3 wrapper: force mbedtls ssl rx buf size to 2048 if 0 2017-10-16 17:13:49 +08:00
Andy Green
7cff6b0cf9 add 100 Continue
https://github.com/warmcat/libwebsockets/issues/1041
2017-10-16 17:13:49 +08:00
Andy Green
8b5eaa0534 SSL_shutdown spin fix 2017-10-16 17:13:49 +08:00
Andy Green
a9843c3c26 openssl-wrapper: fix SSL_shutdown 2017-10-16 17:13:49 +08:00
Andy Green
796a5edb6c openssl-wrapper: add APLN accessors
This adds the necessary OpenSSL Apis to the mbedTLS openssl wrapper
to allow ALPN negotiation OpenSSL-style.

The OpenSSL upgrade list format is supported and converted to mbedtls
format at runtime.
2017-10-16 17:13:48 +08:00
Andy Green
fc995df480 CMake: convert all LWS_USE_... to LWS_WITH_...
Almost all the CMake options begin with LWS_WITH_..., but many of the
symbols passed to lws are LWS_USE_... , this causes neededless confusion,
compounded by the fact that a few CMake options also begin with
LWS_USE_.

This patch globally converts all LWS_USE_... to LWS_WITH_..., so there
is only one prefix to remember in both CMake and the code.

The affected public CMake options are

LWS_USE_BORINGSSL     ->  LWS_WITH_BORINGSSL
LWS_USE_CYASSL        ->  LWS_WITH_CYASSL
LWS_USE_WOLFSSL       ->  LWS_WITH_WOLFSSL
LWS_USE_MBEDTLS       ->  LWS_WITH_MBEDTLS
LWS_USE_BUNDLED_ZLIB  ->  LWS_WITH_BUNDLED_ZLIB
2017-10-16 17:13:48 +08:00
Andy Green
7597ac3766 Plugins: add ssh-base ssh server plugin 2017-10-16 16:59:57 +08:00