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

1727 commits

Author SHA1 Message Date
Andy Green
f820dcb965 hpack: dont reinterpret lws index for idx hdr 6 inc 2017-11-06 13:34:54 +08:00
Andy Green
8dcb4ca753 h2: never send more than file length 2017-11-05 19:40:34 +08:00
Andy Green
43b06fe351 WITH_STATS: fix signed build warnings 2017-11-05 09:37:00 +08:00
Andy Green
ee0ce8cc76 coverity-fixes 2017-11-05 09:37:00 +08:00
Andy Green
5f74010e9d service: only apply trunc holds rx rule for http2 2017-11-05 09:37:00 +08:00
Andy Green
d2ec329531 rxflow: fix second draining path 2017-11-05 09:37:00 +08:00
Andy Green
bc6f8179c6 service: stop trying to find service TID after first time 2017-11-05 09:37:00 +08:00
Andy Green
6ef69ad82e lws_hdr_copy: protect against garbage 2017-11-03 01:09:53 +08:00
Andy Green
793d8bfa13 ah: increase timeout sanity check to ah_idle + 60 2017-10-31 07:01:11 +08:00
Andy Green
52f2ac57ea 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:43:04 +08:00
Andy Green
fbd524e34a cgi: make sure compiler cant see uninitialized use 2017-10-26 18:56:12 +08:00
Andy Green
c303a0d0e3 lejp: use explicit signed char return 2017-10-25 02:49:18 +08:00
Sebastian Mueller
bc046cb6e0 getifaddrs-fix-include-reference
https://github.com/warmcat/libwebsockets/issues/1068
2017-10-25 02:49:17 +08:00
Andy Green
e80461fbb5 build: strict-aliasing on old compiler workaround
https://github.com/warmcat/libwebsockets/issues/1067
2017-10-24 19:27:38 +08:00
Andy Green
2224183110 http2: missing return when openssl too old 2017-10-24 06:47:10 +08:00
Andy Green
bdc9eda20a protocol init: allow use of client apis during per-vhost protocol init 2017-10-24 06:46:32 +08:00
Andy Green
8095155385 getifaddrs: fix conditional build 2017-10-24 06:46:30 +08:00
Andy Green
d50823c7fb client: allow failout when adding client headers 2017-10-24 06:44:43 +08:00
Andy Green
0a9f37225f 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-24 06:44:26 +08:00
Andy Green
af07cca9f7 getifaddrs: fix second lws_malloc 2017-10-19 21:02:16 +08:00
Andy Green
df0f8341dd daemonize: fix missing lws_malloc reason param 2017-10-18 19:57:56 +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
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
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
Alexander von Gluck IV
8bea6c144e Subject: Haiku: initial platform support
https://github.com/warmcat/libwebsockets/pull/1033
2017-09-27 08:24:05 +08:00
Andy Green
495342c2ae libuv: use shadow active events mask
libuv .events or .pevents in the io watcher don't seem to hold the POLLIN / POLLOUT
state correctly.  When POLLIN is defeated, using the rx flow control, POLLOUT seems
to go away somewhere along the line when trying to OR on to the active mask.

This has us track what we enabled outside in a container struct and use that for
the mask instead.  With this rx flow control works properly with the latest mirror
using libuv (it worked fine with poll() event loop without libuv).
2017-09-27 08:24:05 +08:00
Andy Green
49f8029677 coverity fixes 2017-09-27 08:24:05 +08:00
Andy Green
c52a6267ab clean 2017-09-27 08:24:05 +08:00
Andy Green
91166ecb2a pmd: handle zero-length rx 2017-09-27 08:24:05 +08:00
Andy Green
66a402cc96 cgi: also allow for generic spawn 2017-09-27 08:24:04 +08:00
Andy Green
4a0db7fbf1 LWS_CALLBACK_ADD_HEADERS: also on upgrade headers
https://github.com/warmcat/libwebsockets/issues/1028
2017-09-27 08:24:04 +08:00
Andy Green
12adb39542 lws_ring: introduce generic flexible ringbuffer abstraction 2017-09-21 08:45:56 +08:00
Andy Green
d1859ad4fd logging: move most everything during startup to info 2017-09-21 08:45:56 +08:00
Andy Green
217dfe7c6b drop_privs: ignore if uid or gid is zero
0 is the natural default for the info struct.

If you are not 0 (root) then you can't change to root, it will fail
without having done anything.  What the user probably wanted is
just leave it as the uid/gid it was started as.

If you are 0 (root) you are already at 0 and the change has no
meaning.

Net effect is get rid of two warning logs if you left it at 0 in
the info struct and start as non-root.
2017-09-21 08:45:56 +08:00