HoneyryderChuck / httpx

(Mirror) An HTTP client library for ruby
https://gitlab.com/os85/httpx
Apache License 2.0
192 stars 10 forks source link

Can't connect to unix domain socket #6

Closed hadmut closed 2 years ago

hadmut commented 2 years ago

Hi, I was looking for a ruby http client able to call REST APIs over unix domain sockets, and came to httpx.

There seems to be very little documentation about it, just one line in doc/release_notes/0_13_0.md , telling

You should also use it to connect to HTTP servers bound to a UNIX socket, in which case you'll have to provide a path:

HTTPX.get("http://example.com", addresses: %w[/path/to/usocket]))

but when trying this examples (fully aware that this example path does not exist and expecting some „not found“-type error) I get this:

ruby -r httpx -e 'p HTTPX.get("http://example.com", addresses: %w[/path/to/usocket])'
/home/hadmut/.gem/gems/ipaddr-1.2.4/lib/ipaddr.rb:684:in `in6_addr': invalid address: (IPAddr::InvalidAddressError)

So it does not seem to work in the intended way.

HoneyryderChuck commented 2 years ago

hi @hadmut ,

Documentation for UNIX socket support is provided in the wiki.

There was an issue with the example provided in the changelog, it should have been:

ruby -r httpx -e 'p HTTPX.get("http://example.com/", transport: "unix", addresses: %w[/path/to/usocket])'

Will fix it.