Kim Alvefur <zash@zash.se> [Sun, 11 Jul 2021 10:09:10 +0200] rev 11671
scansion tests: Allow specifying network settings via environment variable
Allows testing e.g. opportunistic writes or other settings easily in CI
or otherwise without editing the config file.
make integration-test PROSODY_NETWORK_SETTINGS='{"opportunistic_writes":true}'
Kim Alvefur <zash@zash.se> [Sun, 11 Jul 2021 10:09:07 +0200] rev 11670
scansion tests: Allow specifying network backend via environment variable
To make it easier to test select and event without having to edit the
config file, e.g. in CI.
make integration-test PROSODY_NETWORK_BACKEND=event
Kim Alvefur <zash@zash.se> [Sun, 11 Jul 2021 09:39:21 +0200] rev 11669
net.server_epoll: Prevent stack overflow of opportunistic writes
net.http.files serving a big enough file on a fast enough connection
with opportunistic_writes enabled could trigger a stack overflow through
repeatedly serving more data that immediately gets sent, draining the
buffer and triggering more data to be sent. This also blocked the server
on a single task until completion or an error.
This change prevents nested opportunistic writes, which should prevent
the stack overflow, at the cost of reduced download speed, but this is
unlikely to be noticeable outside of Gbit networks. Speed at the cost of
blocking other processing is not worth it, especially with the risk of
stack overflow.
Kim Alvefur <zash@zash.se> [Fri, 09 Jul 2021 22:06:58 +0200] rev 11668
mod_http_errors: Set status code 200 from root page
It isn't quite an error.
Kim Alvefur <zash@zash.se> [Fri, 09 Jul 2021 21:55:14 +0200] rev 11667
mod_http_errors: Add a Prosody logo to root page
Kim Alvefur <zash@zash.se> [Fri, 09 Jul 2021 21:54:47 +0200] rev 11666
mod_http_errors: Allow adding icons on error pages
Kim Alvefur <zash@zash.se> [Thu, 08 Jul 2021 18:21:59 +0200] rev 11665
net.http: Send entire HTTP request header as one write
When opportunistic writes are enabled this reduces the number of
syscalls and TCP packets sent on the wire.
Experiments with TCP Fast Open made this even more obvious.
That table trick probably wasn't as efficient. Lua generates bytecode
for a table with zero array slots and space for two entries in the hash
part, plus code to set [2] and [4]. I didn't verify but I suspect it
would have had to resize the table when setting [1] and [3], although
probably only once. Concatenating the strings directly in Lua is easier
to read and involves no extra table or function call.
Kim Alvefur <zash@zash.se> [Thu, 08 Jul 2021 17:57:44 +0200] rev 11664
net.server_epoll: Immediately attempt to read from newly accepted connections
This may speed up client-first protocols (e.g. XMPP, HTTP and TLS) when
the first client data already arrived by the time we accept() it.
If LuaSocket supported TCP_DEFER_ACCEPT we could use that to further
increase the chance that there's already data to handle.
In case no data has arrived, no harm should be done, :onreadable would
simply set the read timeout and we'll get back to it once there is
something to handle.
Kim Alvefur <zash@zash.se> [Thu, 08 Jul 2021 17:52:59 +0200] rev 11663
net.server_epoll: Separate handling of new incoming and outgoing connections
The :init method is more suited for new outgoing connections, which is
why it uses the connect_timeout setting.
Depending on whether a newly accepted connection is to a Direct TLS port
or not, it should be handled differently, and was already. The :starttls
method sets up timeouts on its own, so the one set in :init was not needed.
Newly accepted plain TCP connections don't need a write timeout set, a
read timeout is enough.
Kim Alvefur <zash@zash.se> [Sat, 31 Oct 2020 00:33:29 +0100] rev 11662
net.server_epoll: Ensure timeout after closing
This should make sure that if there's data left to be written when
closing a connection, there's also a timeout so that it doesn't wait
forever.