Skip to content
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

https support #17

Open
pmontrasio opened this issue Dec 1, 2017 · 0 comments
Open

https support #17

pmontrasio opened this issue Dec 1, 2017 · 0 comments

Comments

@pmontrasio
Copy link

SOAP requests to https urls fails with {:error, :enoent}

I traced it back to src/detergent.erl in deps, which doesn't have pattern matching for URLs starting with https. It falls back to reading from a local file with the name of the URL, which doesn't exist. The code I'm seeing is

get_url_file("http://"++_ = URL) ->
    case httpc:request(URL) of
    {ok,{{_HTTP,200,_OK}, _Headers, Body}} ->
        {ok, Body};
    {ok,{{_HTTP,RC,Emsg}, _Headers, _Body}} ->
        error_logger:error_msg("~p: http-request got: ~p~n", [?MODULE, {RC, Emsg}]),
        {error, "failed to retrieve: "++URL};
    {error, Reason} ->
        error_logger:error_msg("~p: http-request failed: ~p~n", [?MODULE, Reason]),
        {error, "failed to retrieve: "++URL}
    end;
get_url_file("file://"++Fname) ->
    {ok, Bin} = file:read_file(Fname),
    {ok, binary_to_list(Bin)};
%% added this, since this is what is used in many WSDLs (i.e.: just a filename).
get_url_file(Fname) ->
    {ok, Bin} = file:read_file(Fname),
    {ok, binary_to_list(Bin)}.

However detergent at https://github.com/devinus/detergent/blob/master/src/detergent.erl has the same version of the dependency in detergentex (0.3.0) and does support https (https://github.com/devinus/detergent/blob/master/src/detergent.erl#L395).

get_url_file(URL) ->
    case xmerl_uri:parse(URL) of
        {http, _, _, _, _} -> get_remote_file(URL);
        {https, _, _, _, _} -> get_remote_file(URL);
        _Other -> get_local_file(URL)
end.

That was added in 2013 with devinus/detergent@5354f1c#diff-c46a9580e05c152c0b037750f88eb760

It happens that detergentex is downloading an older detergent or some different fork. However https://hex.pm/packages/detergent links to https://github.com/devinus/detergent

I wonder if there is some dependency mismatch and if mix.exs could be updated to depend from the version at https://github.com/devinus/detergent

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant