ruby / xmlrpc

The Ruby standard library package 'xmlrpc'
Other
37 stars 26 forks source link

XMLRPC::Server port attribute #17

Closed hsitter closed 3 years ago

hsitter commented 7 years ago

Right now Server doesn't really support port=0. To WEBrick port=0 indicates that it should pick a port automatically. This still works with XMLRPC::Server as the argument is simply passed along. Currently there is no way to get the automatically determined port though. So, you can tell the server to pick a port but then you don't know which port it picked :roll_eyes: It would be lovely if Server could get a simple forwarded attribute to either read webrick's config[:Port] or to config as a whole.

For unit testing purposes I do not care about the actual port used, I do however care that this port is dynamically picked so it doesn't conflict with concurrently running tests and/or other services.

s = XMLRPC::Server.new(0)
port = s.port # @server.config.fetch(:Port)
url = "http://localhost:#{port}"
test_handlers(url)
herwinw commented 7 years ago

Something like #18 ?

hsitter commented 7 years ago

Sorry, forgot to reply. That's exactly what I meant :+1: