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

571 commits

Author SHA1 Message Date
Andy Green
8de6e5fcf0 client: allow pipelined http to call LWS_CALLBACK_CLOSED_CLIENT_HTTP 2018-08-15 12:49:32 +08:00
Andy Green
c3def0e527 etag: send cache-control even so 2018-08-14 08:00:30 +08:00
Andy Green
f44e38f148 unix socket: fixes and improvements
Auto-remove any unix socket file already there.

Correctly identify if it's in use per-vhost.

Make the peer-limits stuff ignore it.
2018-08-14 08:00:30 +08:00
Andy Green
69d9cf2e6b coverity: cleanup 2018-08-14 08:00:30 +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
Andy Green
2697be8439 content_length zero: server
https://github.com/warmcat/libwebsockets/issues/1337
2018-07-21 13:32:45 +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
Andy Green
f85cc83de3 http: ETAG hits wrongly seen as serve fails on h2
nonzero return from lws_http_serve() can equally be because we
hit on an ETAG and finished the serve with only the headers.

Split the return so -1 is to assertively close the stream, 1
is we didn't serve anything (eg, not found) and 0 is continuing
asynchronously to serve.
2018-07-16 09:38:12 +08:00
張俊芝
d810379015 Fixes the binding error when SMP in tandem with a Unix domain socket 2018-07-08 20:53:49 +08:00
Andy Green
8ed4574d36 pmd: fix stray client-only
Fix wrong loglevels on some pmd debug stuff

Small cosmetic cleaning
2018-06-30 09:54:22 +08:00
Andy Green
b58fb2dae3 lws_mutex_refcount
This creates a "pthread mutex with a reference count"
using gcc / clang atomic intrinsics + pthreads.

Both pt and context locks are moved to use this,
pt already had reference counting but it's new for
context.
2018-06-27 07:15:39 +08:00
Andy Green
f2f96857d6 fd_cloexec: add and use lws_open wrapper and lws_plat_apply_FD_CLOEXEC() on cgi 2018-06-23 12:56:21 +08:00
Andy Green
7c6e3a8aeb http: urlarg capture fixes 2018-06-20 16:41:28 +08:00
Andy Green
e9d1782863 http: skip NULs between fragments 2018-06-20 16:41:28 +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
1eb4ac4b41 LWS_ILLEGAL_HTTP_CONTENT_LEN implies connection:close
If no content-length is coming, we just can't do
http/1.1 keep-alive.
2018-06-20 16:41:27 +08:00
Andy Green
d84aebd43a http: defer transaction completed if partial pending
This is only helpful for http/1... the real solution is cut up
sending large things.
2018-06-20 16:41:27 +08:00
Andy Green
df1d60fc1a plat: refactor private headers and split files
Also remove LWS_VISIBLE that are not necessary from plat apis
2018-06-20 16:41:27 +08:00
Andy Green
ac3bd36c60 vhost_destroy: use vhost wsi reference counting to trigger destroy
This changes the vhost destroy flow to only hand off the listen
socket if another vhost sharing it, and mark the vhost as
being_destroyed.

Each tsi calls lws_check_deferred_free() once a second, if it sees
any vhost being_destroyed there, it closes all wsi on its tsi on
the same vhost, one time.

As the wsi on the vhost complete close (ie, after libuv async close
if on libuv event loop), they decrement a reference count for all
wsi open on the vhost.  The tsi who closes the last one then
completes the destroy flow for the vhost itself... it's random
which tsi completes the vhost destroy but since there are no
wsi left on the vhost, and it holds the context lock, nothing
can conflict.

The advantage of this is that owning tsi do the close for wsi
that are bound to the vhost under destruction, at a time when
they are guaranteed to be idle for service, and they do it with
both vhost and context locks owned, so no other service thread
can conflict for stuff protected by those either.

For the situation the user code may have allocations attached to
the vhost, this adds args to lws_vhost_destroy() to allow destroying
the user allocations just before the vhost is freed.
2018-06-18 09:11:46 +08:00
Andy Green
d2bdb60a17 cgi: fix for https git server 2018-06-16 09:35:07 +08:00
Andy Green
6d72ef4768 client: pipelining needs ah reset at client transaction completed 2018-06-04 07:14:42 +08:00
Alfred Sawaya
37f2297b2a fix memleak when role h1 failed to upgrade to websocket 2018-06-02 05:57:26 +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
0f9c75f6b5 dummy: add transaction completed processing for POST 2018-05-24 12:48:05 +08:00
Andy Green
0d787fa312 ws: pingpong: server wants to send pings too
During the role refactoring pingpong accidentally
became something only a client wsi could initiate.

https://github.com/warmcat/libwebsockets/issues/1283
2018-05-22 16:28:50 +08:00
Andy Green
621cdd7c4f adopt: fix raw protocol binding 2018-05-21 14:43:40 +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
064c548f9b lws_read_h1: handle LRS_RETURNED_CLOSE 2018-05-11 10:25:28 +08:00
Andy Green
a4b44320c0 role ws: allow zero length PONG 2018-05-09 18:06:45 +08:00
Andy Green
6c1fbbf4cb minimal-ws-client-ping 2018-05-09 17:00:37 +08:00
Andy Green
2f5f1125f7 esp32: align hrtimer and avoid compiler warning 2018-05-07 13:34:14 +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
c99a99e9b4 LRS_DOING_TRANSACTION 2018-05-04 12:05:56 +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
Andy Green
da0be64f68 minimal-raw-netcat
Adapt attack.sh to use it instead of OS netcat and fox various bugs that
exposed.
2018-05-02 08:46:16 +08:00
Andy Green
f497562a62 refactor: change event lib minimal examples to serve as the test apps 2018-04-30 19:17:32 +08:00
Andy Green
d37b383edc refactor: apply ops structs to event loop handlers 2018-04-29 10:44:36 +08:00
Andy Green
d05b408cde refactor: clean out test-apps 2018-04-29 08:35:24 +08:00
Andy Green
ac6c48d98f refactor: most preparation for -DLWS_ROLE_H1=0 2018-04-27 19:16:50 +08:00
Andy Green
16a907180c refactor: move all ah and http specific vars to http private and conditional inclusion from there 2018-04-27 15:20:56 +08:00
Andy Green
9c9ef9cea2 refactor: move everything related to HTTP_PROXY out of struct lws and private-libwebsockets.h into http role private 2018-04-27 14:36:10 +08:00
Andy Green
7c0a2ae633 smp: h2 children must go on same tsi as parent
We can't have a situation where stream wsis inside an h2 connection
are serviced by different threads than the actual parent connection.
2018-04-27 12:49:42 +08:00
Andy Green
82adc07c0a fix minimal-server-tls 2018-04-27 09:36:03 +08:00