Commit graph

421 commits

Author SHA1 Message Date
Andy Green
2e5110e731 cgi: provide constants for reason_bf 2017-08-26 12:15:40 +08:00
Andy Green
040b408029 ping test app: avoid FPE when no packets received 2017-08-04 13:28:01 +08:00
Andy Green
414f114b8f attack.sh: adapt to changes 2017-07-28 07:04:54 +08:00
Andy Green
d86641ed3a libevent: update to use static plugins and work with new libevent2
Plus fix broken indent style
2017-07-27 07:57:59 +08:00
Andy Green
41c15511eb test-server-libuv: add lws_meta 2017-07-27 07:29:56 +08:00
Andy Green
941e93ea33 test-server-libuv: also call context_destroy2 when using foreign loop
https://github.com/warmcat/libwebsockets/issues/972
2017-07-21 11:09:03 +08:00
Andy Green
6f11c1361a lws-meta 2017-07-19 08:59:42 +08:00
Andy Green
faa1526b39 lws-vhost-destroy
Adds a new api lws_vhost_destroy(struct lws_vhost *) which allows dynamic removal of vhosts.

The external api calls two parts of internal helpers that get reused for context destroy.

The second part is called deferred by 5s... this is to ensure that event library objects
composed into structs owned by the vhost all have a chance to complete their close
asynchronously.  That should happen immediately, but it requires us to return to the
event loop first.

The vhost being removed is deleted from the context vhost list by the first part, and does
not block further removals or creation during the delay for the deferred freeing of the
vhost memory.

Part 1:

 - if the vhost owned a listen socket needed by other vhosts listening on same iface + port, the listen
   socket is first handed off to another vhost so it stays alive

 - all wsi still open on the vhost are forcibly closed (including any listen socket still attached)

 - inform all active protocols on the vhost they should destroy themselves

 - remove vhost from context vhost list (can no longer be found by incoming connections)

 - add to a "being destroyed" context list and schedule the second part to be called in 5s

Part 2:

 - remove us from the being destroyed list

 - free all allocations owned by the vhost

 - zero down the vhost and free the vhost itself


In libwebsockets-test-server, you can send it a SIGUSR1 to have it toggle the creation and destruction of
a second vhost on port + 1.
2017-07-19 08:51:43 +08:00
Andy Green
6f2a470ee2 test-html: unify ws open function 2017-07-14 10:26:39 +08:00
Andy Green
05d74e45dc mirror: multiple mirror contexts by mirror= url arg
By default mirror acts the same as before.

However if you access the test server with a url containing "?mirror=<name>", the session will bind to
a mirror instance private to "?mirror=<name>".  Only sessions that used the same 'mirror=' name can
share the drawings, mirror instances with a different name (including the default "" name) are unaffected.
2017-07-08 16:03:40 +08:00
Andy Green
1b41322c28 test server: only init ssl when --ssl in use 2017-07-08 16:03:39 +08:00
Andy Green
7262e14dc1 lws_intptr_t 2017-07-07 08:32:04 +08:00
Andy Green
6a89c7e931 lws_return_http_status: if not in HTTP/2, restrict to a single write 2017-06-29 11:26:22 +08:00
Andy Green
0e222ab084 test-server-libuv: add missing call to lws_context_destroy2() 2017-06-28 11:37:15 +08:00
Andy Green
5939d3a961 test servers: convert to static inclusion of plugins
This eliminates the duplicated implementations of the test protocols,
except dumb-increment (which requires libuv).

This has various advantages, including bringing all the test servers
up to the same set of protocols support.

Triggered by finding a bug in server status protocol that was long
ago fixed in the plugins version.
2017-06-28 11:16:48 +08:00
Andy Green
55d9037c32 test-server-status: increase tx size to avoid WRITEABLE loops 2017-06-28 10:35:40 +08:00
Andy Green
47da96664f test-server-http: no need to complete transaction early since FILE_COMPLETION will do it 2017-06-28 10:04:57 +08:00
Andy Green
3ff720ff66 support openssl info callback
https://github.com/warmcat/libwebsockets/issues/936
2017-06-20 11:46:49 +08:00
Sergey Kovalevich
be4efcfe58 Subject: LWS_UNUSED 2017-06-19 10:57:39 +08:00
Andy Green
581b86efd0 HTTP_PROXY: make usable 2017-06-14 09:53:09 +08:00
Leonardo Maccari Rufino
568aae9c2d Subject: Fix compile error in GCC 4.1.2 2017-06-08 05:41:00 +08:00
Leonardo Maccari Rufino
393b38aed9 Subject: Support to bind accepted socket to device on Linux
AG: move new member to end of info,
    allow info member even on nonsupporting platform,
    document requires root,
    apply only to listen skt before we drop root,
    add -k to test server to allow testing
2017-06-07 08:13:11 +08:00
emptyVoid
348887ea53 Subject: Direct extension confirmation to the negotiated protocol's callback
Fixes #897

Notice this means if you want to globally ban an extension, you should
no longer include the extension at context creation time.
2017-05-29 08:30:26 +08:00
Andy Green
6384eb79e0 esp32: return random length from lws_get_random 2017-04-28 11:54:27 +08:00
Andy Green
d58353f98a pmd: handle case we are already on drain list
Provide internal helper for adding to list that takes care of the
case we are already on the list.

https://github.com/warmcat/libwebsockets/issues/847
2017-03-26 10:19:34 +08:00
Andy Green
629e356bb2 test-server-v2.0: disable setting default protocol 2017-03-22 21:24:04 +08:00
Aditya Tirumala
ec50ebac12 Subject: Libevent: Initial Support
* Added libevent support functionality into lib/libevent.c
* Added test-server-libevent for testing
2017-03-22 05:36:25 +08:00
Andy Green
f84338ac1c test-server-v2.0: add string.h include
via Joel Winarske on ml
2017-03-22 05:29:22 +08:00
Andy Green
9287f7d1b3 ext: pmd: improve dealing with partial input usage with drain
https://github.com/warmcat/libwebsockets/issues/841
2017-03-20 19:07:19 +08:00
Silas Parker
3c02868408 gcc-format-strings: 32-bit build 2017-03-09 18:52:10 +08:00
Andy Green
4219a3281d server-name: add_server_header add LWSAHH_FLAG_NO_SERVER_NAME
Also clean up usage of status code defines in lws
2017-03-08 07:51:47 +08:00
Andy Green
205ccedf6e raw: enable server and client raw sockets 2017-03-07 16:06:05 +08:00
Andy Green
4578036b53 ext: use arguments and reply with them 2017-03-07 10:08:03 +08:00
Andy Green
21d83b44ea test-client: only take data from LWS_CALLBACK_RECEIVE_CLIENT_HTTP 2017-03-06 14:46:03 +08:00
Andy Green
19cc7acb24 fops-zip 2017-03-05 15:32:55 +08:00
Andy Green
1ada132932 fops: allow setting from context creation and introduce lws_select_fops_by_vfs_path
1) There's now a .fops pointer that can be set in the context creation info.  If set, the array of
fops it points to (terminated by an entry with .open = NULL) is walked to find out the best vfs filesystem
path match (comparing the vfs path to fops.path_prefix) for which fops to use.

If none given (.fops is NULL in info) then behaviour is as before, fops are the platform-provided one only.

2) The built in fileserving now walks any array of fops looking for the best fops match automatically.

3) lws_plat_file_... apis are renamed to lws_vfs_file_...
2017-03-01 14:59:48 +08:00
Andy Green
1789d0a483 fops: refactor around lws_fops_fd_t 2017-02-26 08:15:42 +08:00
Andy Green
a5488f9c27 mbedtls: remove abortive attempt to avoid confusing people
Basically we support openssl api compatibles only.

If we ever try something different we need a shim making it openssl api or a proper abstraction layer added first.
2017-02-22 09:54:47 +08:00
Andy Green
2e11efa84b file_ops: add compression flags and convert open flags to pointer
ihttps://libwebsockets.org/pipermail/libwebsockets/2017-February/003127.html
2017-02-12 18:15:15 +08:00
Andy Green
31c5130802 client: fix redirects and allow ssl / non-ssl redirects 2017-02-09 15:25:01 +08:00
Andy Green
5e25dc07c8 chunked http client: support in test-client and document
This improves the test client to

 - dump http content if INFO log level enabled
 - handle chunked content correctly
 - document lws_http_client_read()
2017-02-09 09:17:23 +08:00
Johnny
388f6c97fb test client: some compilers dont accept void * as const char *
This fixes a conversion error from a void pointer to a string.
2017-02-08 07:02:00 +08:00
Andy Green
ce37ee9624 gcc- format strings: debug and extra plugins 2017-02-05 22:30:27 +08:00
Martin Milata
be1f0a3a92 Subject: gcc format strings: Make GCC check format strings, fix found problems 2017-02-05 21:32:30 +08:00
Andy Green
ad945976f7 client: decruft extensions
https://github.com/warmcat/libwebsockets/issues/770
2017-02-03 10:39:37 +08:00
Andy Green
a14be2664c test server: add -P secs to allow pingpong test 2016-12-24 07:37:40 +08:00
Namowen
8694d1bdbc echo: fix debug build
https://github.com/warmcat/libwebsockets/issues/716#issuecomment-267377856
2016-12-20 14:37:07 +08:00
Andy Green
5767095208 test-client: fix broken protocol names 2016-12-20 14:37:07 +08:00
Andy Green
ee94621b40 basic-auth 2016-12-16 22:08:13 +08:00
Andy Green
86ab060cd9 client: add lws_http_client_http_response api 2016-12-16 22:08:13 +08:00