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
Add support for Linux's abstract sockets #2564
Conversation
acd9604
to
8abbee1
Compare
Rebased and added two simple tests. The new test framework has a test or two creating hundreds of abstract unix clients... |
8abbee1
to
23173a1
Compare
Thought I'd rebase this. Also, curl can be used to verify the PR. Compile the Puma repo, then # assumes tcp 127.0.0.1:40000 is available, change as needed
bundle exec ruby -Ilib bin/puma -q -w2 -t5:5 -b tcp://127.0.0.1:40000 test/rackup/realistic_response.ru
curl -kso /dev/null -w '%{size_download}' http://127.0.0.1:40000
bundle exec ruby -Ilib bin/puma -q -w2 -t5:5 -b unix://@puma.unix test/rackup/realistic_response.ru
curl -kso /dev/null -w '%{size_download}' --abstract-unix-socket puma.unix http:
The file realistic_response.ru actually returns a 200,000 byte body. Both curl commands should output 200000, which is the body byte size... |
lib/puma/binder.rb
Outdated
@@ -374,7 +381,7 @@ def add_unix_listener(path, umask=nil, mode=nil, backlog=1024) | |||
end | |||
end | |||
|
|||
s = UNIXServer.new(path) | |||
s = UNIXServer.new path.sub(/\A@/, "\0") |
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.
Everywhere that we check for a socket starting with @
, I think we should have a comment explaining this a check for an abstract socket.
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.
Done
Minor style concerns, otherwise LGTM |
23173a1
to
8d51591
Compare
* Support Linux's abstract sockets Closes puma#2526 * Add two simple UNIXSocket tests
Description
Closes #2526
Tests for abstract UNIXSockets exist in the updated test framework. Will open a PR for it after all the library file changes have been accepted. Tested both server & control binding...
Your checklist for this pull request
[changelog skip]
or[ci skip]
to the pull request title.[ci skip]
to the title of the PR.#issue
" to the PR description or my commit messages.