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

214 commits

Author SHA1 Message Date
Andy Green
b3d6e28bc7 lws_sequencer 2019-06-25 12:10:18 +01:00
Andy Green
4692c1a7ee rtos: clean warnings where uint32_t is an unsigned long 2019-06-07 11:11:46 +01:00
Chen Xi
892cde2c71 rtos: add support for AMAZON_RTOS 2019-06-05 05:04:17 +01:00
Andy Green
8b8849e8cc client: modernize socks5 fixing heap overflow
https://github.com/warmcat/libwebsockets/issues/1583
2019-05-22 15:54:46 +01:00
Andy Green
8d473ad78c smtp: make abstract 2019-05-04 08:28:31 +01:00
Andy Green
359aeb1093 client http rx: check correct binding state 2019-04-20 09:28:15 +01:00
Andy Green
ff71e3cc0d close: after DROP_PROTOCOL no longer report traffic to callback
x
2019-03-23 08:02:53 +08:00
Andy Green
5c3a2be00d http proxy: proxy Authorization header
Sai notifications are signed using Authorization: and "sai" auth type.

After the auth type, the format is, eg, "sha256=<hash>" .
2019-03-22 18:52:08 +08:00
Andy Green
da3d8cb593 http proxy: support POST 2019-03-22 11:25:22 +08:00
Andy Green
462847bb6f lws_dll: remove lws_dll_lws and deprecate lws_dll_remove 2019-03-21 06:19:31 +08:00
Andy Green
09fe212432 bzero: replace all with memset
lws_explicit_bzero() is available if the goal is to have volatile zeroing.
2019-03-10 08:02:02 +08:00
Andy Green
b31ab02786 ipv6: force ipv4 if iface bind uses ipv4 address 2019-03-10 08:02:02 +08:00
Andy Green
986bb37c88 ah: custom headers for h1
Until now lws only parses headers it knows at build-time from its
prebuilt lexical analyzer.

This adds an on-by-default cmake option and a couple of apis
to also store and query "custom", ie, unknown-to-lws headers.

A minimal example is also provided.

At the moment it only works on h1, h2 support needs improvements
to the hpack implementation.

Since it bloats ah memory usage compared to without it if custom
headers are present, the related code and ah footprint can be
disabled with the cmake option LWS_WITH_CUSTOM_HEADERS, but it's
on by default normally.  ESP32 platform disables it.

https://github.com/warmcat/libwebsockets/pull/1499
2019-03-10 08:02:02 +08:00
JoonCheol Park
281d2a7fc2 socks5: fix remain dst buffer length when calls lws_strncpy 2019-03-10 08:02:02 +08:00
fanc
32cb5e1466 client: confirm sin_zero actual size for platform
in some platform, the size of sa46.sa4.sin_zero is not 8, but 6, so use 8 will cause coredump.
2019-03-10 08:02:02 +08:00
Andy Green
043700a4b0 optee: remove build system 2019-01-15 06:59:48 +08:00
Andy Green
84a57540ab LWS_WITH_NETWORK: cmake option for no network code 2019-01-13 07:54:57 +08:00
Andy Green
9b5e45d383 client: typo in client-handshake 2019-01-13 07:54:57 +08:00
Andy Green
eda102e397 jwe 2018-12-27 06:45:32 +08:00
Andy Green
08b5ad9299 role: raw-proxy 2018-12-01 11:05:59 +08:00
Andy Green
43cf8bb391 wsi: opaque_user_data and accessors
Under some circumstances it's useful to tag a wsi with user
data, while still having an lws-allocated and destroyed pss.
2018-12-01 11:05:59 +08:00
Andy Green
9bed6d6fc6 clean: general whitespace cleanup 2018-11-23 08:47:56 +08:00
Andy Green
aa4143aebd lws_diskcache: split generic parts from gitohashi into lws 2018-11-12 15:24:42 +08:00
Andy Green
47579b5306 gcc 8.2.0: ensure port always defined to something 2018-11-07 19:30:37 +08:00
Andy Green
27ae132e7b http: add callback to allow upgrade reject
https://github.com/warmcat/libwebsockets/issues/1415
2018-10-31 13:45:00 +08:00
Andy Green
d702b83d10 uv: allocate watcher
Until now the uv watcher has been composed in the wsi.

This works fine except in the case of a client wsi that
meets a redirect when the event loop is libuv with its
requirement for handle close via the event loop.

We want to reuse the wsi, since the originator of it has
a copy of the wsi pointer, and we want to conceal the
redirect.  Since the redirect is commonly to a different
IP, we want to keep the wsi alive while closing its
socket cleanly.  That's not too difficult, unless you are
using uv.

With UV the comoposed watcher is a disaster, since after
the close is requested the wsi will start to reconnect.
We tried to deal with that by copying the uv handle and
freeing it when the handle close finalizes.  But it turns
out the handle is in a linked-list scheme in uv.

This patch hopefully finally solves it by giving the uv
handle its own allocation from the start.  When we want
to close the socket and reuse the wsi, we simply take
responsibility for freeing the handle and set the wsi
watcher pointer to NULL.
2018-10-13 12:43:13 +08:00
Andy Green
d03c57b87f quench logging 2018-10-13 08:16:27 +08:00
Andy Green
33a6034875 codacy: minor fixes 2018-10-13 08:16:27 +08:00
Andy Green
db827733c3 h1 ws client: produce CONNECTION 2018-10-13 08:16:27 +08:00
Andy Green
074b8f3881 client: oom4: unify with __lws_free_wsi 2018-10-07 13:12:44 +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
78e6d45f78 openssl: error handling align 2018-09-11 18:27:59 +08:00
Andy Green
ebed5e74cb threadpool 2018-09-11 18:27:59 +08:00
Andy Green
edd7efd43d client: libuv: fix close handling during redirect
During client redirect we "reset" the wsi to the redirect address,
involving closing the current fd that was told to redirect (it will
usually be a completely different server or port).

With libuv and its two-stage close that's not trivial.  This solves
the problem we will "reset" (overwrite) where the handle lives in the
wsi with new a new connection / handle by having it copied out into
an allocated watcher struct, which is freed in the uv close callback.

To confirm it the minimal ws client example gets some new options, the
original problem was replicated with this

$ lws-minimal-ws-client-echo -s invalid.url.com -p 80

https://github.com/warmcat/libwebsockets/issues/1390
2018-09-11 18:27:59 +08:00
Andy Green
8de6e5fcf0 client: allow pipelined http to call LWS_CALLBACK_CLOSED_CLIENT_HTTP 2018-08-15 12:49:32 +08:00
Andy Green
de21a5b5b9 protocol_init: make errors fatal 2018-08-14 08:00:30 +08:00
Andy Green
c5012fac1d client: handle oom4 fail path for vhost dll_active_client_conns list
Client connections can put themselves on the active client list
before they have survived the client connect process past oom4,
which can fail out without close processing.

So ensure the wsi destruction on oom4 removes it from the list.
2018-08-14 08:00:30 +08:00
Andy Green
a03dd40e62 plugins: gitws libjsongit2 support
This adds a plugin that interfaces to libjsongit2

https://warmcat.com/git/libjsongit2

to provide a per-vhost service for presenting bare git repos in a
web interface.
2018-08-14 08:00:25 +08:00
Andy Green
12ec231411 client: ipv6 handle failed ads lookup 2018-07-23 17:19:06 +08:00
ecionis
d573a06eb6 content_length zero: client
https://github.com/warmcat/libwebsockets/issues/1337
2018-07-21 13:32:45 +08:00
Andy Green
991241905c client: use effective wsi for some callbacks 2018-07-20 08:40:53 +08:00
Andy Green
97f4b6906b client: use lws_strdup for client_hostname_copy
https://github.com/warmcat/libwebsockets/issues/1343
2018-07-19 06:15:29 +08:00
Silas Parker
b30af71ad8 client: off-by-one in redirect max length calc
https://libwebsockets.org/pipermail/libwebsockets/2018-June/003729.html
2018-06-20 16:41:28 +08:00
Andy Green
6d72ef4768 client: pipelining needs ah reset at client transaction completed 2018-06-04 07:14:42 +08:00
Andy Green
78e6c962f8 client: fix SOCKS5 compilation
https://github.com/warmcat/libwebsockets/issues/1292
2018-05-25 21:43:31 +08:00
Andy Green
a177285b9c cgi: fix QUERY_STRING 2018-05-18 08:40:18 +08:00
Andy Green
502130d999 refactor: split out adoption and client apis to core
- split raw role into separate skt and file

 - remove all special knowledge from the adoption
   apis and migrate to core

 - remove all special knowledge from client_connect
   stuff, and have it discovered by iterating the
   role callbacks to let those choose how to bind;
   migrate to core

 - retire the old deprecated client apis pre-
   client_connect_info
2018-05-11 10:29:08 +08:00
Andy Green
c4dc102a0b windows: cleanup wrong and duplicated socket validity helpers
https://github.com/warmcat/libwebsockets/issues/1259
2018-05-06 07:22:25 +08:00
Andy Green
de064fd65a refactor: core code in lib/core and private-libwebsockets.h to core/private.h
This commit is coverity-clean as tested

cmake .. -DLWS_WITH_MINIMAL_EXAMPLES=1 -DLWS_WITHOUT_EXTENSIONS=1 -DLWS_WITH_ACME=1 -DLWS_WITH_LWSWS=1 -DLWS_WITH_LIBUV=1 -DLWS_WITH_HTTP2=1 -DLWS_WITHOUT_CLIENT=0 -DLWS_WITHOUT_SERVER=0 -DLWS_UNIX_SOCK=1 -DLWS_WITH_TLS=0 -DLWS_WITH_MBEDTLS=0 -DLWS_WITH_CGI=1 -DCMAKE_BUILD_TYPE=DEBUG -DLWS_WITH_GENERIC_SESSIONS=1 -DLWS_WITH_RANGES=1 -DLWS_ROLE_WS=1 -DLWS_MAX_SMP=16 -DLWS_ROLE_H1=1 -DLWS_WITH_WOLFSSL=0 -DLWS_WITH_LIBEV=0 -DLWS_WITH_LIBEVENT=1
2018-05-03 10:49:36 +08:00
Andy Green
bce8cca042 refactor: also migrate tls to the ops struct and private.h pattern
Several new ops are planned for tls... so better to bite the bullet and
clean it out to the same level as roles + event-libs first.

Also adds a new travis target "mbedtls" and all the tests except
autobahn against mbedtls build.
2018-05-02 12:10:36 +08:00