aboutsummaryrefslogtreecommitdiffstats
path: root/net
Commit message (Collapse)AuthorAgeFilesLines
* net.server_epoll: Don't try to flush buffer on closed connectionsKim Alvefur10 days1-1/+2
| | | | | | | | | Attempt to fix a bug where connections are somehow closed twice, leading to bad things happening elsewhere. With LuaSec, closed connections are generally already too closed to write anything to anyway since it does not support unidirectional shutdown.
* net.server_epoll: Revert opportunistic_writes tweakKim Alvefur10 days1-3/+0
| | | | Added in f0b2c026e542 and not sure why
* net.server_epoll: Make running out of buffer space a fatal errorKim Alvefur2024-11-091-0/+6
| | | | | | | Prevent Bad Things from happening when the buffer gets full. This of course opens up the possibility of intentionally killing connections by sending much stuff, which need to be mitigated with rate limits elsewhere.
* net.server_epoll: Improve efficiency of sending much buffered dataKim Alvefur2024-11-091-34/+68
| | | | | | | | | | | | | | Problem: The string slice operations when a lot of data gets buffered ends up being expensive and memory-consuming. We have util.dbuffer for precisely this kind of thing. I want to keep the behavior of writebuffer being upgraded from nil to a string to full buffer since the last step involves three table allocations, where the previous buffer method only used one. Avoiding those allocations for simple writes like white space keep alive feels like it would keep memory churn down. This work was started in 2020
* util.error: Use is_error() instead of is_err() everywhereKim Alvefur2024-10-291-1/+1
| | | | Continuation of 4b39691a274e
* Merge 0.12->trunkKim Alvefur2024-08-161-0/+3
|\
| * net.http: Throw error if missing TLS context for HTTPS requestKim Alvefur2024-08-081-0/+3
| | | | | | | | | | | | | | Prevents the mistake of creating a http context without any TLS context and then trying to use HTTPS, which doesn't work right. Thanks nils
* | util.sslconfig: Support DH parameters as literal stringKim Alvefur2024-07-121-1/+4
| | | | | | | | Simplifies shipping well-known DH parameters in the config
* | Merge 0.12->trunkKim Alvefur2024-07-071-1/+16
|\|
| * net.server_event: Add 'wrapserver' APIKim Alvefur2024-07-071-1/+16
| | | | | | | | | | | | | | | | | | This enables accepting admin stream socket (UNIX) connections trough the same procedures as any other (TCP) socket, which avoids problems caused by using the wrapclient API, which ends up discarding early data due to only expecting early connection failure. Fixes #1867
* | net.server_epoll: Add support for systemd socket activationKim Alvefur2024-05-141-0/+40
| | | | | | | | | | | | | | | | | | | | Allows creating listening sockets and accepting client connections before Prosody starts. This is unlike normal Prosody dynamic resource management, where ports may added and removed at any time, and the ports defined by the config. Weird things happen if these are closed (e.g. due to reload) so here we prevent closing and ensure sockets are reused when opened again.
* | net.unbound: Show canonical name in textual format (e.g. in shell)Kim Alvefur2024-04-141-1/+5
| | | | | | | | | | | | | | libunbound does not tell us the whole chain of CNAMEs, only the final canonical name. This is to aid in debugging since it will only be shown in the shell.
* | net.server: Restore epoll signalfd handlingKim Alvefur2024-03-021-5/+0
| | | | | | | | Reverts 4a9a69659727
* | net.server: Disable epoll signalfd handling by default until problems resolvedKim Alvefur2024-03-011-0/+5
| |
* | net.server_epoll: Log creation of signalfd handles at noise levelKim Alvefur2024-03-011-0/+1
| | | | | | | | To aid in tracking down signalfd-related problems
* | net.server_epoll: Log failure to hook signalsKim Alvefur2024-02-281-1/+6
| | | | | | | | To make any such failures noticeable
* | Merge 0.12->trunkKim Alvefur2024-02-271-1/+1
|\|
| * net.http.files: Validate argument to setup functionKim Alvefur2024-02-271-1/+1
| | | | | | | | Fixes error in #1765 by throwing an error earlier
* | util.signal: Wrap signalfd in an userdatum for gc handling etcKim Alvefur2024-02-241-1/+2
| |
* | net.server_epoll: Support hooking signals via signalfdKim Alvefur2024-02-241-0/+15
| | | | | | | | | | | | Handling signal events the same way as all other events makes sense and seems safer than the signal handling just jumping around in C and messing with Lua states.
* | net.server_epoll: Prevent traceback when checking TLS after connection goneKim Alvefur2024-01-211-0/+5
| | | | | | | | Unclear why this would be done, but an error is not great.
* | net.http.server: Fix whitespace-ignoring syntaxKim Alvefur2023-12-011-2/+2
| |
* | Merge 0.12->trunkKim Alvefur2023-12-011-1/+7
|\|
| * net.http.parser: Reject overlarge header section earlierKim Alvefur2023-08-231-1/+7
| | | | | | | | This case would eventually be rejected by the buffer size limit.
* | net.http.server: Complete async waiter for non-persistent connectionsKim Alvefur2023-11-241-3/+2
| | | | | | | | | | | | | | | | | | Otherwise requests with Connection: close would be stuck in the async wait that starts after the handle_request() call. Together with the new async debugging, this makes the async thread stay in the set of waiting runners forever, where previously it would simply be garbage collected.
* | net.server_epoll: Avoid call to update socket watch flags when nothing changedKim Alvefur2023-11-211-0/+3
| | | | | | | | Should skip a syscall for each write when using epoll.
* | net.http: Set Connection header based on connection pool usageKim Alvefur2023-11-111-1/+8
| | | | | | | | Connection: keep-alive is implicit in HTTP/1.1 but explicit > implicit
* | net.http: Add simple connection poolingKim Alvefur2023-11-111-1/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This should speed up repeated requests to the same site by keeping their connections around and sending more requests on them. Sending multiple requests at the same time is not supported, instead a request started while another to the same authority is in progress would open a new one and the first one to complete would go back in the pool. This could be investigated in the future. Some http servers limit the number of requests per connection and this is not tested and could cause one request to fail, but hopefully it will close the connection and prevent it from being reused.
* | net.http.server: Fix typo in previous commitKim Alvefur2023-09-231-1/+1
| |
* | net.http.server: Support setting Content-Type of uncaught HTTP errorsKim Alvefur2023-09-221-1/+6
| | | | | | | | | | | | | | | | mod_http_errors normally sets the Content-Type header via the response object, which isn't available when handling these uncaught errors. Without a Content-Type header the browser is forced to guess, which may or may not result in something sensible.
* | net.websocket.frames: Remove completed TODOKim Alvefur2023-07-291-1/+0
| | | | | | | | The XOR is done in C since 4e5a2af9dd19
* | net.server: Handle loading from outside Prosody (e.g. Verse)Kim Alvefur2023-05-201-15/+20
| | | | | | | | | | server_select only depending on LuaSocket generally makes it more portable, so fall back to that if util.poll can't be found.
* | net.http.server: Return request ID in header to aid debuggingKim Alvefur2023-05-291-1/+1
| | | | | | | | Eases locating the request in logs
* | net.tls_luasec: Expose method for loading a certificateKim Alvefur2023-05-271-0/+1
| | | | | | | | | | Further isolates LuaSec from Prosody core, with the ultimate goal of allowing LuaSec to be replaced more easily.
* | net.certmanager: Move LuaSec feature detection to net.tls_luasecKim Alvefur2023-05-271-0/+24
| | | | | | | | | | Further isolates LuaSec from Prosody core, with the ultimate goal of allowing LuaSec to be replaced more easily.
* | net.http.server: Remove "Firing event" logs, use event logging insteadKim Alvefur2023-05-141-4/+0
| | | | | | | | | | | | | | | | Since these are noisy and we have the thing in util.helpers to log events fired. The new status line events are meant to replace these as they include more useful info.
* | net.http.server: Log request and response status linesKim Alvefur2023-05-141-0/+3
| | | | | | | | Points out the beginning and end of a request.
* | net.http.server: Assign each request its own log sourceKim Alvefur2023-05-141-5/+8
| |
* | net.http.server: Assign an ID to each request, shared with responseKim Alvefur2023-05-141-0/+3
| | | | | | | | | | Goal is improve tracking of individual HTTP requests throughout its life-cycle. Having a single ID to use in logging should help here.
* | net: Prefix module imports with prosody namespaceKim Alvefur2023-03-1720-108/+108
| |
* | Merge 0.12->trunkMatthew Wild2023-02-171-2/+3
|\|
| * net.http.parser: Fix off-by-one error in chunk parserMatthew Wild2023-02-171-2/+3
| |
* | Merge 0.12->trunkMatthew Wild2023-02-161-0/+4
|\|
| * net.http.server: Add new API to get HTTP request from a connectionMatthew Wild2023-02-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | This information is sometimes necessary in the context where we have a connection that we know (or believe to be) associated with an incoming HTTP request. For example, it can be used to retrieve the IP address of a request (which may differ from the IP address of the connection, due to X-Forwarded-For and co). Thanks to the Jitsi team for highlighting this gap in the API.
* | Merge 0.12->trunkMatthew Wild2023-02-092-7/+12
|\|
| * net.http.parser: Improve handling of responses without content-lengthMatthew Wild2023-02-091-6/+11
| | | | | | | | | | | | This ensures that we support responses without a content-length header, and allow streaming them through the streaming handler interface. An example of such a response would be Server-Sent Events streams.
| * net.http: Add missing log parameterMatthew Wild2023-02-091-1/+1
| |
* | net.http.server: Close file handle earlierKim Alvefur2023-01-081-1/+1
| | | | | | | | | | Frees unneeded resources earlier, so they're not held on to while potentially sending the chunk trailer.
* | Merge 0.12->trunkKim Alvefur2023-01-081-1/+1
|\|
| * net.http.server: Fix #1789Kim Alvefur2023-01-081-1/+1
| | | | | | | | | | | | | | | | | | Unregistering the response before sending the trailer of the chunked transfer encoding prevents opportunistic writes from being invoked and running this code again when, which may cause an error when closing the file handle a second time. Normally the file size is known, so no chuck headers are sent.