New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Unix Domain Sockets #2471
Conversation
d37beae
to
efb46a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks! LMK what you think of my comments inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great changes, thank you!
I've prefixed non-critical things with nit:
. Feel free to ignore those. The other things I think must be fixed before merging.
dbe3bb4
to
17a8df8
Compare
Ok, I think I got everything. Let me know if I should make any more changes! |
…ile if one is provided
… a socket path as opposed to a hostname and port
…le wasn't removed beforehand
…PClient is happy with
…y be used for testing
Co-Authored-By: Gwynne Raskind <gwynne@users.noreply.github.com>
…ts http+unix URLs directly
…are used when starting up
…ic domain socket paths
…having multiple cases
…ng connection point
ea2cd0b
to
6c77aaa
Compare
Rebased off of the latest master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The updated Server protocol is much clearer and URI.Host is a great addition. Just a couple minor comments left. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes LGTM. :) I've updated the PR body slightly to reflect the latest API. Ready to merge this?
Ready when you are! 🎉 |
Removed |
These changes are now available in 4.29.0 |
Thanks @dimitribouniol :D |
Thanks for the great additions @dimitribouniol ! |
@tanner0101 @MrLotU Thank you both for helping make this the best it could be! |
Adds support for Unix Domain Sockets (#2471, #2226, #2371).
A server can be started using the
serve
command:vapor run serve --unix-socket /tmp/vapor.socket
Alternatively, the app can be configured in code to connect to a socket:
In either scenario, if a socket path is specified, it takes precedence over binding the server to a hostname/port. Note that TLS may be combined with this options if you wish the server to only listen to encrypted connections made to the socket file.
The socket file must not exist prior to starting the server. If one is left behind during an incomplete shutdown, however, and the app has permission to delete it, it will be overidden.
To assist with making connections to socket paths,
URI.Scheme
has a.httpUnixDomainSocket
property.