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

2700 commits

Author SHA1 Message Date
Andy Green
23e433ac1b minimal: adapt for ping test over https 2018-08-20 07:44:20 +08:00
Frank May
2cddfc963b windows: fix timeout between writes on Windows
After servicing a writable socket, we need to set timeout_ms
to zero. This makes WSAWaitForMultipleEvents() return immediately
after checking events.
2018-08-19 06:44:19 +08:00
Frank May
248826d7fc windows: Remove useless code
WSASetEvent(pt->events) just makes WSAWaitForMultipleEvents()
return, it will not set LWS_POLLOUT in pfd->revents and thus
has IMHO no effect. If WSAWaitForMultipleEvents() will set
LWS_POLLOUT it will also signal the event automatically.
2018-08-19 06:44:03 +08:00
Frank May
e17820cf67 windows: fix possible crash
Checking for (!wsi) does not make sense, if wsi is
dereferenced in the line above.
2018-08-19 06:43:49 +08:00
Frank May
fab4bff4f6 windows: Ignore Visual Studio internal files 2018-08-19 06:43:06 +08:00
Badbaljan
90089af508 esp32: change make flash-related names to not conflict with idf 2018-08-19 06:41:59 +08:00
Andy Green
5c0b0450f2 client: bind and drop protocol like server
HTTP server protocols have had for a while LWS_CALLBACK_HTTP_DROP/BIND_PROTOCOL
callbacks that mark when a wsi is attched to a protocol and detached.

It turns out this is generally useful for everything to know when a wsi is
joining a protocol and definitively completely finished with a protocol.

Particularly with client wsi where you provided the userdata externally, this
makes a clear point to free() it on the protocol binding being dropped.

This patch adds protocol bind / unbind callbacks to the role definition and
lets them operate on all roles.  For the various roles

HTTP server: LWS_CALLBACK_HTTP_BIND/DROP_PROTOCOL as before
HTTP client: LWS_CALLBACK_CLIENT_HTTP_BIND/DROP_PROTOCOL
ws server:   LWS_CALLBACK_WS_SERVER_BIND/DROP_PROTOCOL
ws client:   LWS_CALLBACK_WS_CLIENT_BIND/DROP_PROTOCOL
raw file:    LWS_CALLBACK_RAW_FILE_BIND/DROP_PROTOCOL
raw skt:     LWS_CALLBACK_RAW_SKT_BIND/DROP_PROTOCOL
2018-08-18 14:11:29 +08:00
Andy Green
d461f46a97 libwebsockets.h: clean out some boilerplate better put in core/private.h
https://github.com/warmcat/libwebsockets/issues/1370
2018-08-16 19:10:32 +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
956bb4e255 lws_pvo_get_str 2018-08-15 09:23:35 +08:00
Andy Green
79397b21a3 README.md: serve from repo 2018-08-14 19:09:23 +08:00
Andy Green
c3def0e527 etag: send cache-control even so 2018-08-14 08:00:30 +08:00
Andy Green
b7e05ad590 mailmap 2018-08-14 08:00:30 +08:00
Andy Green
f37454ab17 cmake: LEJF and LEJP_CONF now on by default 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
9df3557ef9 lws_get_effective_uid_gid
This helper lets you find out the eventual uid / gid lws will run
under before the root privileges are actually dropped
2018-08-14 08:00:30 +08:00
Andy Green
69d9cf2e6b coverity: cleanup 2018-08-14 08:00:30 +08:00
Andy Green
94e375f552 lejp: improve bogus JSON underrun detection
https://github.com/warmcat/libwebsockets/issues/1357
2018-08-14 08:00:30 +08:00
James Chicca
f285fe4a60 vhost protocol timers: SMP threadsafety
From 35923abbf3.patch

Adapted by AG to deal with OOM and use the existing vh timer
struct.
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
6f1e67cf91 appveyor: stop default vc build
Suddenly appveyor just says this

Build started
git clone -q --branch=master https://github.com/warmcat/libwebsockets.git C:\projects\libwebsockets
git checkout -qf e035ceb36e0b79e85bc18b313e8f46eeadd360b6
The build phase is set to "MSBuild" mode (default), but no Visual Studio project or solution files were found in the root directory. If you are not building Visual Studio project switch build mode to "Script" and provide your custom build command.
2018-08-14 08:00:30 +08:00
Andy Green
7d21bd2ea8 svg: README overview 2018-08-14 08:00:30 +08:00
Andy Green
cfeb196479 client: SMP: associate client with tsi of thread creating client connection
1) This moves the service tid detection stuff from context to pt.

2) If LWS_MAX_SMP > 1, a default pthread tid detection callback is provided
   on the dummy callback.  Callback handlers that call through to the dummy
   handler will inherit this.  It provides an int truncation of the pthread
   tid.

3) If there has been any service calls on the service threads, the pts now
   know the low sizeof(int) bytes of their tid.  When you ask for a client
   connection to be created, it looks through the pts to see if the calling
   thread is a pt service thread.  If so, the new client is set to use the
   same pt as the caller.
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
James Chicca
7019b56ec9 lws_vhost_bind_wsi: avoid if already bound to same wsi
if wsi->vhost == vhost then it is already bound to that
 vhost. doubling binding causes a problem during shutdown
by trashing the reference counting.
2018-07-21 09:03:10 +08:00
Andy Green
991241905c client: use effective wsi for some callbacks 2018-07-20 08:40:53 +08:00
Andy Green
6677425272 minimal: kill stray symlink
https://github.com/warmcat/libwebsockets/issues/1344
2018-07-19 15:58:24 +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
0222cd25b0 lws_get_peer_write_allowance: cope with no role callback for it
https://github.com/warmcat/libwebsockets/issues/1339
2018-07-17 18:29:05 +08:00
Dmytro Ivanov
ff2b1eab36 tls:Implement client_ssl_ca_mem/client_ssl_ca_mem_len to load root CA certs from memory. 2018-07-17 18:25:53 +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
Dmytro Ivanov
78aeb75221 Android: Fixing missing sockaddr_in definition. 2018-07-16 09:38:07 +08:00
chrisplusplus
2b9c69b55f Update protocol_lws_minimal_server_echo.c
This plugin will not compile as a plugin without changing
LWS_PLUGIN_PROTOCOL_MINIMAL_server_echo to
LWS_PLUGIN_PROTOCOL_MINIMAL_SERVER_ECHO
2018-07-11 15:31:22 +08:00
James Chicca
6648e01072 foreach_ll_safe 2018-07-11 15:17:58 +08:00
shinny-chengzhi
5740356d9a Fix I/O hang after received a large deflate frame
When a large deflate frame been received, WSAEnumNetworkEvents will indicate the socket is ready to read. And because the frame is compressed, it may not be consumed entirely(not all bytes ready to receive have been received), since WSAEnumNetworkEvents is edge triggered, and the socket read buffer never been drained, WSAEnumNetworkEvents will never indicate the socket is ready to read again. What here need is level trigger behavior, thus add additional recv with empty buffer to reset edge status.
2018-07-11 15:14:01 +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
5af32fe27d logging: stderr: reduce brightness of some ANSI loglevels 2018-06-30 09:54:22 +08:00
Rosen Penev
eb4cefceae openssl: Fix compile with 1.1.0 - deprecated APIs
These function have been deprecated. Keep compatibility with OpenSSL 1.0.2 as it is still supported.
2018-06-30 09:42:44 +08:00
Andy Green
855114e39a smp: context lock around vhost destroy 2018-06-27 09:18:24 +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
Dominyk Tiller
8869a6ce1d libwebsockets.h: include new libuv header 2018-06-24 10:56:59 +08:00
Dominyk Tiller
d2943ff866 CMakeLists: add check for new libuv header 2018-06-24 10:54:17 +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
Per Bothner
f7631b7a10 sockets: FD_CLOEXEC
If the user code forks, it inherits open copies of all
lws sockets, which conflict if lws later decides to
close them.
2018-06-23 05:44:36 +08:00
negativekelvin
bd9c1b715f Fixes to track updates in esp-idf 2018-06-20 16:41:28 +08:00