-
Notifications
You must be signed in to change notification settings - Fork 338
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
Unix socket support #187
Unix socket support #187
Conversation
We should probably rerun this after a httparrot update |
@@ -1,5 +1,9 @@ | |||
# Changelog | |||
|
|||
# Unreleased | |||
|
|||
* Add support for http over unix sockets - requires hackey >= 1.6.2, erlang >= 19. (#185). |
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.
There is a typo: hackey
→ hackney
.
Also you probably should bump the hackney's version to 1.6.2 in mix.exs
if this is the version in which the feature was implemented.
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.
Issues fixed. Thanks, @nscyclone :)
d99e6c6
to
570d24b
Compare
And the hackney 1.6.2 package is broken in hex.pm => benoitc/hackney#354 |
00d57c0
to
179d367
Compare
Now this looks good to go :) |
@@ -22,9 +22,9 @@ defmodule HTTPoison.Mixfile do | |||
|
|||
defp deps do | |||
[ | |||
{:hackney, "~> 1.6.0"}, | |||
{:hackney, "~> 1.6.0 and >= 1.6.3"}, |
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.
We can probably just do "~> 1.6.3" and it will do the same (I guess?)
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.
~> 1.6.3
would not update to 1.7.0 when it comes out. I was trying to replicate the old ~> 1.6
requirement
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.
I see. Got it 👌
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.
But actually we always(or almost) had ~> MAJOR.MINOR.BUGFIX
set. Maybe we should keep it as it is? so just ~> 1.6.3
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 :)
@@ -94,6 +94,17 @@ defmodule HTTPoisonTest do | |||
assert_response HTTPoison.get("https://localhost:8433/get", [], ssl: [cacertfile: cacert_file, keyfile: key_file, certfile: cert_file]) | |||
end | |||
|
|||
test "http+unix scheme" do | |||
if Application.get_env(:httparrot, :unix_socket, false) do |
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.
So by default it's false and AFAIK we don't set this to true. How do we know this test is running?
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.
Just like your ssl support I've set the default to true
in httparrot. It will be false for versions of httparrot that do not support unix sockets yet.
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.
Oh ok perfect! Got it: https://github.com/edgurgel/httparrot/blob/master/mix.exs#L25-L26
Thanks a lot for pushing this forward. Awesome addition to the library 👍 |
179d367
to
59654fc
Compare
Awesome! Thanks! I will release a new version soon! 👍 |
Allows connecting to http servers listening on unix sockets
To perform a get
/path
on/var/run/app.sock
(note the required escaping on slashes):iex> HTTPoison.get! "http+unix://%2Fvar%2Frun%2Fapp.sock/path"
NOTE requires erlang >= 19 and hackney >= 1.6.2
Closes #185