[erlang-questions] Re : http client bug in inets when following relative redirects
Ingela Anderton Andin
ingela@REDACTED
Mon Feb 9 10:43:43 CET 2009
Hi!
> [eliast@REDACTED] /usr/local/lib/erlang/lib/inets-5.0.12/src $ erl -s inets
> Eshell V5.6.5 (abort with ^G)
> 1> http:request(get, {"http://mohegansun.com/",[]}, [{autoredirect,
> true},{relaxed, true}],[]).
> error,{badarg,[{erlang,'++',[80,"//gateway/index.html"]},
{httpc_response,fix_relative_uri,2},
{httpc_response,redirect,2},
{httpc_handler,handle_response,1},
{gen_server,handle_msg,5},
{proc_lib,init_p_do_apply,3}]}}
> In httpc_response.erl:fix_relative_uri/2 I found the following:
> fix_relative_uri(Request, RedirUrl) ->
> {Server, Port} = Request#request.address,
> Path = Request#request.path,
> atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ Port
> ++ Path ++ RedirUrl.
> It's choking when concatenating Port which is an integer. For now I
> have wrapped Port with an integer_to_list call, but this function
> really smells bad. For example, it grabs the original path and simply
> concatenates it with the redirect path. In this case "/" +
> "/gateway/index.html" == "//gateway/index.html" but what if the
>original path was /old_working_link"?
Thank you for pointing this out, we will look into the issue.
> Thanks for you attention to the matter. If there's an official place
> to submit this bug please let me know.
erlang-bugs<AT>erlang.org Change <AT> to @
You can subscrie to it here:
http://www.erlang.org/faq.html
Ingela Erlang/OTP - Ericsson
More information about the erlang-questions
mailing list