Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Manually add a host header. This drags in amqp_client, but it's very …

…likely you're running that already.
  • Loading branch information...
commit 704aeed74ffee814861700cd26164bf18bb59586 1 parent 1eda12d
@simonmacmullen simonmacmullen authored
View
6 src/rabbit_auth_backend_http.erl
@@ -69,7 +69,11 @@ bool_req(PathName, Props) ->
end.
http_get(Path) ->
- case httpc:request(get, {Path, []}, ?HTTPC_OPTS, []) of
+ URI = uri_parser:parse(Path, [{port, 80}]),
+ {host, Host} = lists:keyfind(host, 1, URI),
+ {port, Port} = lists:keyfind(port, 1, URI),
+ HostHdr = rabbit_misc:format("~s:~b", [Host, Port]),
+ case httpc:request(get, {Path, [{"Host", HostHdr}]}, ?HTTPC_OPTS, []) of
{ok, {{_HTTP, Code, _}, _Headers, Body}} ->
case Code of
200 -> case parse_resp(Body) of
View
2  src/rabbitmq_auth_backend_http.app.src
@@ -8,4 +8,4 @@
{env, [{user_path, "http://localhost:8000/auth/user"},
{vhost_path, "http://localhost:8000/auth/vhost"},
{resource_path, "http://localhost:8000/auth/resource"}] },
- {applications, [kernel, stdlib, inets]}]}.
+ {applications, [kernel, stdlib, inets, amqp_client]}]}.
Please sign in to comment.
Something went wrong with that request. Please try again.