Commit graph

306 commits

Author SHA1 Message Date
Andy Green
b0adae427f ah: reuse at end of transaction has no timeout
If we complete a transaction but end up keeping the ah, we must force
a timeout on it.  Otherwise a bad bot could keep the socket open and
exhaust the ah pool.
2017-08-15 08:05:56 +08:00
lnmx
e11dcaad41 send content-type when LWS_WITH_RANGES=OFF
https://github.com/warmcat/libwebsockets/pull/987

With the RANGES feature disabled, lws_serve_http_file would
not add the content-type header to the response.
2017-08-12 20:53:58 +08:00
Andy Green
855f7e8712 log: downgrade logging for ah wait 2017-07-28 07:04:47 +08:00
Andy Green
6c09952065 url cleaning: leave // after http[s]: alone 2017-07-21 20:04:02 +08:00
Andy Green
ad15082563 coverity-181580: supposedly dead code 2017-07-19 14:47:30 +08:00
Andy Green
3526fde154 coverity 181573: false positive since lws_is_ssl returns a bool 2017-07-19 14:37:04 +08:00
Andy Green
1690581cd2 coverity 181574: confirm uri_ptr non-null before deref 2017-07-19 14:19: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
7262e14dc1 lws_intptr_t 2017-07-07 08:32:04 +08:00
Andy Green
ff9a24de1c parsing: if we ended on a set of headers and read a new buffer mark as more_rx_waiting to avoid dropping the ah 2017-06-29 10:13:29 +08:00
Andy Green
a637d8f41f file serve: defer transaction completed to HTTP_FILE_COMPLETION 2017-06-28 14:27:09 +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
bd23a401f6 transaction_completed: ignore if parsing not complete 2017-06-28 10:04:57 +08:00
Andy Green
34ef9743d2 serving: protect file sending from downgrading to waiting pipelined headers
https://github.com/warmcat/libwebsockets/issues/946
2017-06-28 10:04:57 +08:00
Andy Green
abc2a5cd2e windows: SO_EXCLUSIVEADDRUSE
https://github.com/warmcat/libwebsockets/issues/942
2017-06-26 08:36:49 +08:00
Andy Green
581b86efd0 HTTP_PROXY: make usable 2017-06-14 09:53:09 +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
Leonardo Maccari Rufino
2ce39fe26c Subject: Support to IPv6 on Windows 2017-06-01 06:55:50 +08:00
Andy Green
a4f88d543e NULL protocol: make sure vhost same protocol linklist gets correct protocol index 2017-05-31 09:45:28 +08:00
Andy Green
49769a7c24 esp32: otf and use group-role as hostname if present 2017-05-22 14:01:08 +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 Green
3198446d3c adoption: close socket manually if fails before add fds 2017-05-15 08:10:08 +08:00
Andy Green
fbc1ff6e7b stats: ah and ssl restriction stats 2017-05-15 07:30:06 +08:00
Andy Green
a7def3ce44 LWS_WITH_STATS 2017-05-09 14:19:43 +08:00
Andy Green
ba9d639792 ssl: only apply restriction if nonzero for vhost 2017-04-07 20:51:44 +08:00
Andy Green
47bbb044ad raw: defer creation callback until after fds inserted 2017-04-07 11:25:55 +08:00
Andy Green
19242db55b raw: take care about same vh protocol linked list 2017-04-06 13:49:17 +08:00
Andy Green
54c22623ab adopt: use default protocol in given vhost 2017-04-06 12:47:42 +08:00
Andy Green
6cae994750 adopt: LWS_SERVER_OPTION_ONLY_RAW to indicate a vhost only serves raw 2017-04-06 07:57:45 +08:00
Andy Green
34822f190d esp32: enforce ssl nonblocking 2017-04-03 14:09:37 +08:00
Andy Green
7faa71637f logs: reduce ah err to info 2017-04-02 13:01:07 +08:00
Andy Green
00ae90978b esp32: separate factory setup 2017-03-31 20:05:10 +08:00
Andy Green
311e3a585d spa: reject junk after finalization 2017-03-23 19:30:29 +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
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
Andy Green
2e874dea50 windows: cannot use fstat 2017-03-17 11:43:45 +08:00
Andy Green
3a09c3b7d6 esp32: align fops member name defines 2017-03-08 11:11:41 +08:00
Andy Green
c53a76f0ef reduce log spew on POST processing 2017-03-08 10:52:49 +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
19cc7acb24 fops-zip 2017-03-05 15:32:55 +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
Andy Green
1789d0a483 fops: refactor around lws_fops_fd_t 2017-02-26 08:15:42 +08:00
Andy Green
0aed7a06d5 mbed3: sayonara
The port was technically worthwhile and laid the groundwork for ESP support.

But now it is just useless cruft like mbed3 itself...
2017-02-22 09:50:11 +08:00
Andy Green
297c0313fa raw: adoption and processing 2017-02-21 07:47:35 +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