[erlang-bugs] Bugs in relaxed HTTP REDIRECT response

Anders Danne anders.danne@REDACTED
Thu Sep 4 16:51:05 CEST 2008


Hi,

I had to fix two things in R12B-4 httpc_response.erl.
I sent a HTTP get with {relaxed,true} and got a
HTTP REDIRECT back and got a crash.

1) Port is an integer.

2) The Path was duplicated in RedirUrl. That may depend on the server so 
a more
intelligent solution may be needed.

Original code:
fix_relative_uri(Request, RedirUrl) ->
    {Server, Port} = Request#request.address,
    Path = Request#request.path,
    atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ Port
    ++ Path ++ RedirUrl.


New code:
    ...
    atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ 
integer_to_list(Port)
    ++ "/" ++ RedirUrl.

///Anders

   



More information about the erlang-bugs mailing list