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

22 commits

Author SHA1 Message Date
Andy Green
0ceba15d9c lws_lifecycle
This adds some new objects and helpers for keeping and logging
info on grouped allocations, a group is, eg, SS handles or client
wsis.

Allocated objects get a context-unique "tag" string intended to replace
%p / wsi pointers etc.  Pointers quickly become confusing when
allocations are freed and reused, the tag string won't repeat
until you produce 2^64 objects in a context.

In addition the tag string documents the object group, with prefixes
like "wsi-" or "vh-" and contain object-specific additional
information like the vhost name, address / port  or the role of the wsi.
At creation time the lws code can use a format string and args
to add whatever group-specific info makes sense, eg, a wsi bound
to a secure stream can also append the guid of the secure stream,
it's copied into the new object tag and so is still available
cleanly after the stream is destroyed if the wsi outlives it.
2021-01-04 05:26:50 +00:00
Andy Green
d98101d1e3 plugins: generalize and provide public api
Move the common plugin scanning dir stuff to be based on lws_dir, which
already builds for windows.  Previously this was done via dirent for unix
and libuv for windows.

Reduce the dl plat stuff to just wrap instantiation and destruction of
dynlibs, establish common code in lib/misc/dir.c for plugin scanning
itself.

Migrate the libuv windows dl stuff to windows-plugins.c, so that he's
available even if later libuv loop support becomes and event lib plugin.

Remove the existing api exports scheme for plugins, just export a const struct
now which has a fixed header type but then whatever you want afterwards depending
on the class / purpose of the plugin.  Place a "class" string in the header so
there can be different kinds of plugins implying different types exported.

Make the plugin apis public and add support for filter by class string, and
per instantation / destruction callbacks so the subclassed header type can
do its thing for the plugin class.  The user provides a linked-list base
for his class of plugins, so he can manage them completely separately and
in user code / user export types.

Rip out some last hangers-on from generic sessions / tables.

This is all aimed at making the plugins support general enough so it can
provide event lib plugins later.
2020-08-31 16:51:37 +01:00
Andy Green
8b0dee426e README.coding: update libev section 2019-12-20 18:39:07 +00:00
Andy Green
b318877cd9 adopt: allow associated accepted vhost connections to specific role
Normalize the vhost options around optionally handling noncompliant
traffic at the listening socket for both non-tls and tls cases.

By default everything is as before.

However it's now possible to tell the vhost to allow noncompliant
connects to fall back to a specific role and protocol, both set
by name in the vhost creation info struct.

The original vhost flags allowing http redirect to https and
direct http serving from https server (which is a security
downgrade if enabled) are cleaned up and tested.

A minimal example minimal-raw-fallback-http-server is added with
switches to confirm operation of all the valid possibilities (see
the readme on that).
2018-12-01 11:05:59 +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
c027c3db28 docs: cleanups 2018-11-21 17:03: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
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
04e1661411 client: http1.1 pipelining 2018-04-06 10:38:03 +08:00
Andy Green
7cef6fcc7b udp 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
341f280662 README.codng.md: add libevent as a peer and suggest avoid libev 2018-02-21 07:42:11 +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
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
4ff8e866d5 docs: fixup links broken by move to READMEs 2017-11-26 19:16:06 +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
Andy Green
4f267c515e clean up top level of project 2017-09-27 08:24:05 +08:00
Renamed from README.coding.md (Browse further)