Commit graph

545 commits

Author SHA1 Message Date
Andy Green
7d3b83ea76 close path: make sure a second time timeout and ssl buffered lists are scrubbed
lws_meta children can have a different close path
2017-08-04 13:29:11 +08:00
Andy Green
c6233ce403 coverity 182068: 155650: unnecessary check against illegal NULL 2017-07-28 14:19:24 +08:00
Andy Green
7849c5a8ad pmd: autobahn fixes 2017-07-28 13:12:03 +08:00
Andy Green
3562e441e3 client-fix-header-stash-leak-on-close-before-success 2017-07-21 21:49:24 +08:00
Andy Green
6f11c1361a lws-meta 2017-07-19 08:59:42 +08:00
Andy Green
3b0066cb3f close: make close notification go through writable
Until now we took the approach if just writing the close notification
broke something, we didn't care because we were closing the connection
anyway.

But with lws_meta, breaking stuff in the parent connection would be a
sticky problem outliving the closing child connection.

So this adds a new wsi state LWSS_WAITING_TO_SEND_CLOSE_NOTIFICATION
and makes the send go via the writable callback mechanism.
2017-07-19 08:55:57 +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
8f4f692945 ah: require parsing complete before detach
Introduce helpers to force to detachable state and to test the ah is
in a detachable state.

Require not only the ah rx buffer is all used, but that the
wsi has completed a full set of headers.
2017-06-28 12:13:13 +08:00
Andy Green
eb7233ae97 WITH_STATS: remove accidental dependency on ssl 2017-06-28 10:04:57 +08:00
WebsocketUser
0be9e98aae win32: enable 64-bit file lengths
https://github.com/warmcat/libwebsockets/issues/916

AG added more appveyor warning cleaning and stitched in cmake tests
2017-06-09 20:20:42 +08:00
Andy Green
02638f6758 large files: convert content-length to use lws_filepos_t 2017-06-07 08:20:18 +08:00
Andy Green
156363f3de capabilities support 2017-06-07 06:49:20 +08:00
Leonardo Maccari Rufino
af7f943e05 Subject: windows: support to bind to a specific IPv6 address 2017-06-06 07:44:50 +08:00
Leonardo Maccari Rufino
2ce39fe26c Subject: Support to IPv6 on Windows 2017-06-01 06:55:50 +08:00
Andy Green
a369b42910 cgi: close unforked std fds 2017-05-20 08:05:27 +08:00
Andy Green
3844988b6c cgi: apply chunked grace period only when explicitly chunked 2017-05-19 08:33:33 +08:00
Andy Green
a6a68785f7 cgi: handle no body to keep events coming 2017-05-18 23:20:12 +08:00
Andy Green
de12c860db cgi: allow time travelling headers to decide response code
https://github.com/warmcat/libwebsockets/issues/899
2017-05-18 21:19:57 +08:00
Andy Ning
ed92b6dfe7 client: added socks5 proxy support
AG:

 - move creation info members to end of struct
 - add LWS_WITH_SOCKS5 CMake var, defaults to OFF
 - cast away some warnings about signed / unsigned in strncpy

Signed-off-by: Andy Ning <andy.ning@windriver.com>
2017-05-17 06:18:45 +08:00
Andy Green
fbc1ff6e7b stats: ah and ssl restriction stats 2017-05-15 07:30:06 +08:00
Andy Green
b2f8bc5638 esp32: multi ap slots 2017-05-13 10:26:59 +08:00
Andy Green
a7def3ce44 LWS_WITH_STATS 2017-05-09 14:19:43 +08:00
Martin Milata
aeb3397c8f Subject: ssl: stop spinning on close 2017-04-19 20:49:44 +08:00
Silas Parker
b4b3da06a1 bind protocol: fix for NULL names 2017-04-07 18:22:54 +08:00
Andy Green
19242db55b raw: take care about same vh protocol linked list 2017-04-06 13:49:17 +08:00
Andy Green
00ae90978b esp32: separate factory setup 2017-03-31 20:05:10 +08:00
Andy Green
db64bfcefa lws_remove_child_from_any_parent: clear parent pointer and fix failure message 2017-03-30 08:31:58 +08:00
Andy Green
73ff23e288 debug: reduce spew for debug log level 2017-03-22 21:24:04 +08:00
Silas Parker
4198c20920 ssl: close sometimes continuously asserting POLLIN until timeout
https://github.com/warmcat/libwebsockets/issues/831
2017-03-10 07:46:05 +08:00
Andy Green
3a09c3b7d6 esp32: align fops member name defines 2017-03-08 11:11:41 +08:00
Andy Green
205ccedf6e raw: enable server and client raw sockets 2017-03-07 16:06:05 +08:00
Andy Green
b6e0c89750 coverity 177409: dont bother assigning ignored second SSL_shutdown return value
No security impact
2017-03-06 14:46:06 +08:00
Andy Green
19cc7acb24 fops-zip 2017-03-05 15:32:55 +08:00
Andy Green
2f4dfa4ea7 rx flow: handle child state change during parent cb 2017-03-05 15:32:47 +08:00
Per Bothner
60f4569bb8 adopt: allow binding to parent at same time
- if protocol set, allocate own user_space

   If the child wsi wants the parent wsi user_space, it can use

       lws_wsi_user(lws_get_parent(child_wsi))

 - raw file close processing handles parent-child relationship
2017-03-03 07:36:08 +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
be8d791b5e adoption: make union for socket and file fds
This lets lws support adopting raw file FDs and raw socket fds.

A test plugin creates a FIFO and prints data sent on it, using
the lws event loop.
2017-03-01 10:01:53 +08:00
Lukas Geyer
16ee4b6f0d client: allow change externally-defined wsi user_data
https://github.com/warmcat/libwebsockets/issues/819

AG: add explanation in doxygen comment and check user_space was externally set
2017-02-28 21:17:25 +08:00
Silas Parker
ab89246467 cosmetic fix trailing newline on log 2017-02-28 18:29:57 +08:00
Andy Green
1789d0a483 fops: refactor around lws_fops_fd_t 2017-02-26 08:15:42 +08:00
Andy Green
3d6a1e11c2 client connect: oom4 clean up timeout list
https://github.com/warmcat/libwebsockets/issues/810
2017-02-21 23:38:40 +08:00
Silas Parker
dc4934d2bc ssl close improvement 2017-02-21 19:27:47 +08:00
Andy Green
297c0313fa raw: adoption and processing 2017-02-21 07:47:35 +08:00
Silas Parker
a5f2d8b688 url-parser: handle ipv6 [] addresses 2017-02-21 07:27:07 +08:00
Andy Green
052a685435 ssl close: do explicit ssl shutdown instead of socket shutdown if ssl mode 2017-02-20 05:44:56 +08:00
Andy Green
c7c4ae0aa4 ESP32 platform
This is enough for all the test app features to work on ESP32 without
SSL.
2017-02-18 17:27:22 +08:00
Andy Green
186ba832b3 client: allow http[s] to select targeted protocol name in vhost 2017-02-18 17:27:22 +08:00
Silas Parker
f2c6e48eb8 fix close packet index coding
https://github.com/warmcat/libwebsockets/issues/792
2017-02-18 17:27:22 +08:00
Silas Parker
f9f5a57607 gcc-format-strings: ipv6 2017-02-18 17:27:22 +08:00
Andy Green
c8b20910ec lwsl_visible 2017-02-09 09:11:17 +08:00