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

651 commits

Author SHA1 Message Date
Andy Green
c54a35e1a9 h2: allow empty SETTINGS
https://libwebsockets.org/pipermail/libwebsockets/2020-August/008676.html
2020-08-31 16:51:37 +01:00
Andy Green
fa78129f73 ws: LCCSCF_PRIORITIZE_READS 2020-08-31 16:51:37 +01:00
Andy Green
72b245ea38 h2: fix breakage with LWS_WITH_HTTP2=0 2020-08-31 16:51:37 +01:00
Andy Green
28f4aae555 listen: network filter: provide a struct with client info to the FILTER cb
For backwards compatibility, keep the cast fd on in and pass an info struct
to the callback by overloading user_data.
2020-08-31 16:51:37 +01:00
Andy Green
258ee1886f coverity: 37468: confirm gethostname worked 2020-08-19 07:19:48 +01:00
Andy Green
d69b91d2d9 coverity: 62123: explicitly check things to guide coverity
Coverity sees we sometimes check if header length is 0 and extrapolates
from that not checking header length return is a violation.  But often
we are OK if the header length is 0 and there is no error return to
check from that.

It also doesn't understand that if we saw a nonzero length for a header,
then we are going to get a non-null simple_ptr() return for sure.  Just
give up and explicitly, unneccessarily check everything so coverity can
stop telling us about it.
2020-08-19 07:11:59 +01:00
Andy Green
a8315807e7 coverity: 10417: move goto inside preprocessor conditional that needs it
Otherwise coverity sees it with !defined(LWS_ROLE_WS) sitting there doing nothing
2020-08-19 06:46:19 +01:00
Andy Green
7ff64b3c42 coverity: 10117: help coverity understand simple_ptr cannot be NULL 2020-08-19 06:40:13 +01:00
Andy Green
9679222070 coverity: 62147: setting retcode var is cruft 2020-08-18 14:00:54 +01:00
Andy Green
ad6dfd3df6 coverity: 21071: no need to init accept_fd 2020-08-18 14:00:54 +01:00
Andy Green
d5497d5f55 coverity: 62535: another simple_ptr NULL check after confirmed by other means 2020-08-18 14:00:54 +01:00
Andy Green
398a9e1bad coverity: 62134: protect debug-only statement with preprocessor conditional
Compiler has no problem with it but coverity complains nobody uses p in release build
2020-08-18 14:00:54 +01:00
Andy Green
598a82ca1d coverity: 62512: remove unused assignment 2020-08-18 14:00:54 +01:00
Andy Green
5ef6c548d8 coverity: 62488 62253: comment NOP left in for extensibility 2020-08-18 14:00:54 +01:00
Andy Green
1892af1ce3 coverity: 40529: add needless check on NULL simple_ptr after confirmed it has nonzero length 2020-08-18 14:00:54 +01:00
Andy Green
630391e0fb coverity: 50320: show coverity protocol can always be found by name 2020-08-18 14:00:54 +01:00
Andy Green
b1281f1f3a coverity: 50773: no need to set m any more when transitioning and exiting 2020-08-18 14:00:54 +01:00
Andy Green
cdbf86fe4a coverity: 51248: convince coverity we have an ah attached before dereference during parse 2020-08-18 14:00:54 +01:00
Andy Green
b63c7f1e8e coverity: 62131: check when logging role name for NULL 2020-08-18 14:00:54 +01:00
Andy Green
06005d14b4 coverity: 62154: calculation needed if WITH_FILE_OPS 2020-08-18 09:34:50 +01:00
Andy Green
048604751c coverity: 62584: init m only inside preprocessor conditional that needs it 2020-08-18 09:28:40 +01:00
Andy Green
60e2c65208 coverity: 62333; no need to init cce as set on all paths that use it 2020-08-18 09:19:34 +01:00
Andy Green
400355fdc3 coverity: 62458: coverity doesnt understand nonzero header length means simple_ptr cannot be NULL 2020-08-18 09:19:33 +01:00
Andy Green
9745c5cca8 coverity: 62477: explicitly check wsi->protocol even though client creation sets it 2020-08-18 09:11:45 +01:00
Andy Green
192b76c89b coverity: 62540: explicitly check for NULL even though cannot be 2020-08-18 09:08:03 +01:00
Andy Green
0f173e0bbe coverity: 62622: remove unused line 2020-08-18 09:00:39 +01:00
Andy Green
7692d920a8 coverity: 244441: strerror broken on some platforms
Some platforms have strerror but it's broken according to Coverity.
Let's avoid it
2020-08-14 09:14:24 +01:00
Andy Green
491f0f6068 coverity: 324943: confirm get_random worked
In normal systems this doesn't have a way to fail.  But check it for
consistency.
2020-08-14 09:07:27 +01:00
Andy Green
aec2bdec2f coverity: 324897: mqtt: check unsub var for NULL 2020-08-14 09:02:29 +01:00
Andy Green
795d20081e coverity: 232068: hpack 6-bit index may be garbage
It's possible an attacker may send an illegal dynamic index
we can't succeed to look up
2020-08-14 08:56:19 +01:00
Andy Green
ecb8de3386 coverity: 232025: modulo with zero modulus
Add a generic helper macro that has defined operation with modulus 0
2020-08-14 08:46:31 +01:00
Andy Green
4a28bc8c87 coverity: 231739: clear false positive by needless checks
Client connection api must provide host
2020-08-14 07:27:08 +01:00
Andy Green
df2f135c09 coverity: 324692: mqtt: check for OOM in generate_id 2020-08-14 07:18:48 +01:00
Andy Green
908d259a47 coverity: 305064: clear false positive by needless NULL check
Add needless check so we don't keep getting the same coverity hit from different people
2020-08-14 07:02:07 +01:00
Andy Green
146858fb54 coverity: 231926: clear false positive by showing coverity what it wants to see
We can't get here without testing for COLON_PATH existing in http2.c as part of
the h2spec pass code.

		if (!lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_PATH) ||
		    !lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_METHOD) ||
		    !lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_SCHEME) ||
		     lws_hdr_total_length(h2n->swsi, WSI_TOKEN_HTTP_COLON_STATUS) ||
		     lws_hdr_extant(h2n->swsi, WSI_TOKEN_CONNECTION)) {
			lws_h2_goaway(wsi, H2_ERR_PROTOCOL_ERROR,
				      "Pseudoheader checks");
			break;
		}

So there is no issue.  But show Coverity what it wants so we don't keep getting this
false positive reported by different coverity users.
2020-08-14 06:35:31 +01:00
Andy Green
629c8138b1 sai: freebsd 2020-08-10 15:04:10 +01:00
Andy Green
1f0cd18dd6 ss: server: check more carefully if built but not used on a wsi 2020-08-10 15:04:10 +01:00
Andy Green
9a7ce85001 h2: defend against no NUL possible in log 2020-08-10 15:04:10 +01:00
Andy Green
924bd78085 clean: reduce log verbosity in various places 2020-08-10 15:04:10 +01:00
Andy Green
5be8ff27d5 ss-server-raw
Add an example and some small changes for secure streams
serving raw data over a listening tcp socket
2020-07-28 09:21:45 +01:00
Andy Green
7eb36102a9 ss: server: h1, h2, ws basic support
Add initial support for defining servers using Secure Streams
policy and api semantics.

Serving h1, h2 and ws should be functional, the new minimal
example shows a combined http + SS server with an incrementing
ws message shown in the browser over tls, in around 200 lines
of user code.

NOP out anything to do with plugins, they're not currently used.

Update the docs correspondingly.
2020-07-27 12:05:24 +01:00
Andy Green
08bc9bf410 ss: http: handle rx DESTROY_ME 2020-07-21 07:57:15 +01:00
Andy Green
1a93e73402 fakewsi: replace with smaller substructure
Currently we always reserve a fakewsi per pt so events that don't have a related actual
wsi, like vhost-protocol-init or vhost cert init via protocol callback can make callbacks
that look reasonable to user protocol handler code expecting a valid wsi every time.

This patch splits out stuff that user callbacks often unconditionally expect to be in
a wsi, like context pointer, vhost pointer etc into a substructure, which is composed
into struct lws at the top of it.  Internal references (struct lws is opaque, so there
are only internal references) are all updated to go via the substructre, the compiler
should make that a NOP.

Helpers are added when fakewsi is used and referenced.

If not PLAT_FREERTOS, we continue to provide a full fakewsi in the pt as before,
although the helpers improve consistency by zeroing down the substructure.  There is
a huge amount of user code out there over the last 10 years that did not always have
the minimal examples to follow, some of it does some unexpected things.

If it is PLAT_FREERTOS, that is a newer thing in lws and users have the benefit of
being able to follow the minimal examples' approach.  For PLAT_FREERTOS we don't
reserve the fakewsi in the pt any more, saving around 800 bytes.  The helpers then
create a struct lws_a (the substructure) on the stack, zero it down (but it is only
like 4 pointers) and prepare it with whatever we know like the context.

Then we cast it to a struct lws * and use it in the user protocol handler call.
In this case, the remainder of the struct lws is undefined.  However the amount of
old protocol handlers that might touch things outside of the substructure in
PLAT_FREERTOS is very limited compared to legacy lws user code and the saving is
significant on constrained devices.

User handlers should not be touching everything in a wsi every time anyway, there
are several cases where there is no valid wsi to do the call with.  Dereference of
things outside the substructure should only happen when the callback reason shows
there is a valid wsi bound to the activity (as in all the minimal examples).
2020-07-20 06:28:52 +01:00
Andy Green
da7ef0468b cgi: add spawn reap callback 2020-07-20 06:28:52 +01:00
Andy Green
006eeaa6a0 ws: correctly handle ESTABLISHED rejecting connection
https://github.com/warmcat/libwebsockets/issues/1973
2020-07-15 16:18:00 +01:00
Andy Green
f21226ca3e mqtt: remove fcntl.h
These aren't needed and can make trouble in lwip case
2020-07-15 16:18:00 +01:00
Andy Green
634a97ad79 lws_jwt_token_sanity 2020-07-15 16:18:00 +01:00
Andy Green
0bcfe88381 lws_http_cookie_get 2020-07-15 16:17:59 +01:00
Andy Green
6b639e6a81 coverity: force amount to 0 before read call 2020-07-08 18:27:47 +01:00
Andy Green
b72ab32c17 lws_netdev 2020-07-02 10:36:31 +01:00