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

155 commits

Author SHA1 Message Date
Andy Green
89eedcaa94 v3.1.0 2018-11-23 11:30:56 +08:00
Andy Green
edeb8a59fa boringssl: update 2018-11-23 10:52:39 +08:00
Andy Green
37d6116374 cmake: copy include/libwebsockets into the build dir
https://libwebsockets.org/pipermail/libwebsockets/2018-November/007745.html

This allows user code to use the build dir ./include without
having to do the make install, as a convenience.
2018-11-23 08:54:40 +08:00
Andy Green
9bed6d6fc6 clean: general whitespace cleanup 2018-11-23 08:47:56 +08:00
Andy Green
c027c3db28 docs: cleanups 2018-11-21 17:03:29 +08:00
Andy Green
d9f982a055 minimal examples: update for CSP best practices
1) update the logos to svg

2) add svg icon for strict security policy where used

3) define new vhost option flag to enforce sending CSP headers
   with the result code

4) add vhost option flag to minimal examples to
   enforce sending CSP where applicable

5) Go through all the affecting examples confirming they
   still work

6) add LWS_RECOMMENDED_MIN_HEADER_SPACE constant (currently
   2048) to clarify when we need a buffer to hold headers...
   with CSP the headers have become potentially a lot
   larger.
2018-11-21 17:03:29 +08:00
Andy Green
ac032544bf README.md: update in preparation for v3.1 2018-11-16 09:10:41 +08:00
Andy Green
0647806f4c docs: release-policy README and pics 2018-11-14 08:57:29 +08:00
Andy Green
cbb8b1d3e9 LWS_WITH_ASAN
This lets you build using the runtime Address Sanitizer in gcc.

LWS is heavily tested with valgrind routinely during development.  But ASAN
did find some theoretical-only issues with shifting, strictly ~(1 << 31) is
a signed int, it should be ~(1u << 31).  Gcc does the same for both, but it's
good to have the ability to find these.
2018-11-03 14:47:48 +08:00
Andy Green
93d4e186c2 openssl tls1.3: allow setting ciphersuites at context creation time
https://github.com/warmcat/libwebsockets/issues/1440
2018-10-27 08:05:21 +08:00
Andy Green
20fb55934b client vhost OpenSSL set and clear options
https://github.com/warmcat/libwebsockets/issues/1438
2018-10-26 13:55:36 +08:00
Andy Green
33a6034875 codacy: minor fixes 2018-10-13 08:16:27 +08:00
Andy Green
bdaa339a6e README.ci.md 2018-10-13 08:16:27 +08:00
Andy Green
df3e29ea16 README.vulnerability-reporting.md 2018-10-13 08:16:27 +08:00
Andy Green
fb2d13b462 README.contributing.md 2018-10-13 08:16:27 +08:00
Andy Green
2f8efa1082 auth: record basic auth user
This causes the WSI_TOKEN_HTTP_AUTHORIZATION content to be
replaced by the plaintext username that succeeded to be
authenticated.
2018-10-02 10:52:09 +08:00
Andy Green
fd810f198a http proxy: client: unix socket support
This allows the client stuff to understand that addresses beginning with '+'
represent unix sockets.

If the first character after the '+' is '@', it understands that the '@'
should be read as '\0', in order to use Linux "abstract namespace"
sockets.

Further the lws_parse_uri() helper is extended to understand the convention
that an address starting with + is a unix socket, and treats the socket
path as delimited by ':', eg

http://+/var/run/mysocket:/my/path

HTTP Proxy is updated to allow mounts to these unix socket paths.

Proxy connections go out on h1, but are dynamically translated to h1 or h2
on the incoming side.

Proxy usage of libhubbub is separated out... LWS_WITH_HTTP_PROXY is on by
default, and LWS_WITH_HUBBUB is off by default.
2018-09-12 13:58:13 +08:00
Andy Green
dc38eea060 docs: CSP 2018-09-12 13:58:13 +08:00
Andy Green
f6a3aa01c9 http: enlarge headers buffers since they may meet large headers from vhost config 2018-09-11 18:27:59 +08:00
Andy Green
d1f9f0ae2d libwebsockets.h: split out into a dir of sub-includes included by libwebsockets.h
This has no effect on user code or backward compatibility.

It moves the in-tree public api header libwebsockets.h from ./lib
to ./include, and introduces a dir ./include/libwebsockets/

The single public api header is split out into 31 sub-headers
in ./include/libwebsockets.  ./include/libwebsockets.h contains
some core types and platform adaptation code, but the rest of it
is now 31 #include <libwebsockets/...>

At install time, /usr/[local/]include/libwebsockets.h is installed
as before, along now with the 31 sub-headers in ...include/libwebsockets/

There's no net effect on user code.

But the api header is now much easier to maintain and study, with 31
topic-based sub headers.
2018-09-11 18:27:59 +08:00
Andy Green
5d06f610a9 travis: h2spec integration 2018-04-26 15:27:02 +08:00
Andy Green
7b227eb333 autobahn fixes
This replaces the old test-app for echo with separate client and server
minimal versions.

The autobahn test script is made more autonomous and tests both
client and server.
2018-04-22 06:45:46 +08:00
Andy Green
2a9b6f54c6 client: h2
This adds h2 http support for the client api.

The public client api requires no changes, it will detect by
ALPN if the server can handle http/2, if so, it will use it.

Multiple client connections using the lws api will be mapped on
to the same single http/2 + tls socket using http/2 streams
that are serviced simultaneously where possible.
2018-04-06 10:38:03 +08:00
Andy Green
8f19a3fa9a network interface: defer bindings to absent network interfaces
Previously down network interfaces without an IPv4 address are
removed from the posix api that lists network interfaces.

That means if you bound a vhost listen socket to a particular
interface, it will fail at startup time.

This patch adds these vhosts to a list, starts the vhost without
a listen socket, and checks to see if the vhost's network interface
has appeared while the rest of lws is running.

If it appears, the listen socket is opened on the network interface
and the vhost becomes reachable.
2018-04-06 10:38:03 +08:00
Andy Green
04e1661411 client: http1.1 pipelining 2018-04-06 10:38:03 +08:00
Fabio Alessandrelli
94f3981bef mbedtls: wrapper: client: Force mbedTLS to attemp to verify cert
AG: unlike openssl, mbedtls does not load the system trust store.
So this change will make client tls operations that work OK on openssl fail on
mbedtls unless you provide the correct CA cert.

This allows lws to distinguish between untrusted CAs, hostname
mismatches, expired certificates.

NOTE: LCCSCF_ALLOW_SELFSIGNED actually allows for untrusted CAs, and
will also skip hostname verification. This is somewhat a limitiation of
the current lws verification process.

AG: improve error reporting up to the CLIENT_CONNECTION_ERROR argument
and add a note specific to mbedtls in the test client.  Adapt the test
client to note the CA requirement if built with mbedTLS.  Adapt the
minimal test clients to have the CAs available and use them if mbedTLS.
2018-04-06 10:38:03 +08:00
Andy Green
7cef6fcc7b udp 2018-04-06 10:38:03 +08:00
Andy Green
5acbb04b51 unixskt: add test server support and cleanup inode on exit 2018-04-06 10:38:03 +08:00
Andy Green
0d8b11d250 smp: add user pthread helpers that are NOP for LWS_SMP_MAX == 1 2018-03-02 19:19:35 +08:00
Andy Green
a0581a926b esp32: map basic auth to nvs 2018-02-24 08:14:17 +08:00
Andy Green
341f280662 README.codng.md: add libevent as a peer and suggest avoid libev 2018-02-21 07:42:11 +08:00
Andy Green
1d9d04ff9d LWS_WITH_DISTRO_RECOMMENDED
Idea from Per Bothner
https://libwebsockets.org/pipermail/libwebsockets/2018-January/003635.html
2018-01-27 08:01:33 +08:00
mulander
b3b6bcdf64 READMEs: CHANGE callback replaces SET/CLEAR_MODE
LWS_CALLBACK_SET_MODE_POLL_FD and LWS_CALLBACK_CLEAR_MODE_POLL_FD no longer exist.

Updating the documentation to reflect that and point to LWS_CALLBACK_CHANGE_MODE_POLL_FD.
2018-01-24 08:24:04 +08:00
Andy Green
15820da8ba docs: spell out how to set the default protocol when client doesnt give any 2018-01-03 08:29:29 +08:00
Andy Green
1da0197798 truncated: detect and flag any write on a wsi that could have pending truncated 2017-12-07 10:19:48 +08:00
Andy Green
8487279e64 plat: remove esp8266
ESP32 module price is now within range of 8266 price.

ESP32 capability and OS support is hugely better than 8266,
we can support mbedtls tls, http/2 etc with ESP32.

I'm no longer testing on ESP8266... there's no more
user traffic... it's time to go.
2017-12-01 11:37:36 +08:00
Andy Green
5b74d7108b gcov: add in cmake and adapt defaults
1) Introduce LWS_WITH_GCOV to build with gcc / clang coverage instrumentation.

$ cd build
$ make clean && rm -f `find . -name "*.gcno" -o -name "*.gcda"` && make -j16 && sudo make install && sudo /usr/local/bin/libwebsockets-test-server -s
...
$ gcov `find . -name *.c.gcno | grep -v test-apps` -b | sed "/\.h.\$/,/^$/d"

The above are available in two helper scripts

 - scripts/build-gcov.sh
 - scripts/gcov.sh

2)

CMake defaults changed:

 - LWS_WITH_ZIP_FOPS: OFF
 - LWS_WITH_RANGES: OFF
 - LWS_WITHOUT_EXTENSIONS: ON
 - LWS_WITH_ZLIB: OFF

New CMake controls that default-OFF:

 - LWS_WITH_GENHASH
 - LWS_WITH_GENRSA

these are implied by LWS_WITH_JWS (which is implied by LWS_WITH_ACME)

3) rename ./lib/tls/XXX/server.c and client.c to XXX-server.c / XXX-client.c.

This is because gcov dumps its results using the .c filename part only,
the copies overwrite each other if there are different .c files in the tree
with the same filename part.

4) Add onetime test-client mode and test to ./test-apps/attack.sh

5) Add gcov howto in READMEs/README.build.md using attack.sh
2017-12-01 11:37:35 +08:00
Ben Delarre
3160605462 docs: whitespace and add existing READMEs to doxygen list 2017-12-01 11:37:35 +08:00
Andy Green
3ec7c1ab21 ACME client plugin
This adds support for a plugin that can be attached to a vhost
to acquire and maintain its TLS cert automatically.

It works the same with both OpenSSL and mbedTLS backends, but
they can't share auth keys, delete the 'auth.jwk' file as it is
in the example JSON when switching between libs
2017-12-01 11:37:35 +08:00
Pavel Shramov
66916394ed lib: Spelling fixes based on debian packaging 2017-11-28 07:46:22 +08:00
Andy Green
41d1326da0 appveyor artifacts debug 2017-11-26 19:16:17 +08:00
Andy Green
1d5bd23268 bsd: support foreign thread event changes while in poll wait
https://github.com/warmcat/libwebsockets/issues/314
2017-11-26 19:16:17 +08:00
Andy Green
74fddbc09e cancel_service: change to event-loop agnostic implementation
- Add platform helpers for pipe creation.

 - Change the direct-to-fds implementation to create a wsi for each
   pt and use the normal apis to bind it to the event loop.

 - Modifiy context creation and destroy to create and remove the
   event pipe wsis.

 - Create the event pipe wsis during context create if using the
   default poll() event loop, or when the other event loops start
   otherwise.

 - Add handler that calls back user code with
   LWS_CALLBACK_EVENT_WAIT_CANCELLED

This patch allows you to call `lws_cancel_service(struct lws_context *context)`
from another thread.

It's very cheap for the other thread to call and is safe without
locking.

Every use protocol receives a LWS_CALLBACK_EVENT_WAIT_CANCELLED from
the main thread serialized normally in the event loop.
2017-11-26 19:16:17 +08:00
Andy Green
fa73d31558 docs: update discussion in test-apps README about plugin inclusion 2017-11-26 19:16:14 +08:00
Andy Green
4ff8e866d5 docs: fixup links broken by move to READMEs 2017-11-26 19:16:06 +08:00
Andy Green
b1934d6b64 client-certs: add related docs 2017-11-26 19:07:12 +08:00
Andy Green
fcf5b2c25a v2.4.0 2017-10-17 13:21:12 +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
e67ae24d41 doxygen cleanup 2017-10-16 17:13:49 +08:00