Repository navigation
httpd: extract reusable server code - #132
Merged
Merged
Conversation
katexochen
reviewed
Sep 21, 2026
Extract the existing code varlink-httpd code that builds the SslAcceptorBuilder with the cert_path and key_path into tls_acceptor_builder() so that it can be reused. Do the same for the `accept` part of a connection and move that into `tls_accept`. This will allow us to reuse this in next TLS server we need to build. No behavior change, pure extraction.
Extract the accept code from varlink-httpd into the new `listen.rs` helpers. This allows us to reuse it again when building a second TLS server. Also tweak it slightly so that on accept() error we add a small delay before retring (there is really not much else we can do and the old code was spinning without delay which was wasteful). Also tweak the error message so that we give a useful hint when running out of file descriptors.
Ensure that a connection completes its handshake within a new TLS_HANDSHAKE_TIMEOUT of 10s to ensure we cannot get DoS'ed by opening a connection and then not sending any data.
katexochen
approved these changes
Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR prepares for a coming additional server binary. Its useful on its own and extracts a bunch of the existing helpers for TLS server handling into shared code. Small tweaks along the way, see the individual commits.