Skip to content
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

Replace webrick with a small/simple custom rack-compatible http server #1017

Closed
bensheldon opened this issue Jul 25, 2023 · 3 comments · Fixed by #1030
Closed

Replace webrick with a small/simple custom rack-compatible http server #1017

bensheldon opened this issue Jul 25, 2023 · 3 comments · Fixed by #1030

Comments

@bensheldon
Copy link
Owner

I would like to drop the runtime dependency on webrick. Webrick is only used for the probe server functionality which is intended to be a private interface.

I think webrick could be replaced with <100 lines of Ruby to implement a bare minimum http server to be used for the probe server, thus it would only need to implement simple GET and string paths, and not do other query-parsing/etc.

@dixpac
Copy link
Contributor

dixpac commented Jul 27, 2023

Can I take this?

@bensheldon
Copy link
Owner Author

@dixpac yes please 🙏

@bensheldon
Copy link
Owner Author

And to calibrate the level of polish I'm expecting (low): I have previously fed this into GitHub Copilot and ChatGPT and the result seemed fine. There already is some integration testing, so maybe 1 or 2 more test cases in this pattern should be sufficient:

describe '#start' do
it 'starts a webrick server that binds to all interfaces' do
probe_server.start
wait_until(max: 1) { expect(probe_server).to be_running }
ip_addresses = Socket.ip_address_list.select(&:ipv4?).map(&:ip_address)
expect(ip_addresses.size).to be >= 2
expect(ip_addresses).to include("127.0.0.1")
aggregate_failures do
ip_addresses.each do |ip_address|
response = Net::HTTP.get(ip_address, "/", port)
expect(response).to eq("OK")
end
end
end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

2 participants