Feature #13719

[PATCH] net/http: allow existing socket arg for Net::HTTP.start

Added by normalperson (Eric Wong) over 3 years ago. Updated 5 months ago.

Target version:


This allows Net::HTTP users to use Unix domain sockets
or any other type of stream socket, including TCP.
Several HTTP servers (e.g. nginx and puma) support
listening on local Unix sockets instead of TCP.

* lib/net/http.rb (HTTP.start): handle :socket option
  (initialize): @live_socket defaults to nil
  (connect): only connect if @live_socket is missing
  (do_finish): remove reference to @live_socket
* test/net/http/test_http.rb (test_socket_arg_unix): new test

patch mirror:


Updated by hadmut (Hadmut Danisch) 5 months ago

Any news on this?

I was just trying to use the rest-client gem to connect to a unix domain socket, which isn't possible since the underlying net/http component does not accept unix domain URLs.

Since offering rest-apis on unix-domain sockets has become a standard, ruby should be able to connect straight forward.

Updated by normalperson (Eric Wong) 5 months ago wrote:

Any news on this?

It looks like net/http development moved to a proprietary service
which I can't comment on due to Terms-of-Service + JS + CAPTCHA:

In the past, hsbt (Hiroshi SHIBATA) said he'd help merge patches from non-GitHub users;
I don't know if that's still true.

Also available in: Atom PDF