Bugs in relaxed HTTP REDIRECT response

View: New views
1 Messages — Rating Filter:   Alert me  

Bugs in relaxed HTTP REDIRECT response

by Anders Danne :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

   
_______________________________________________
erlang-bugs mailing list
erlang-bugs@...
http://www.erlang.org/mailman/listinfo/erlang-bugs
LightInTheBox - Buy quality products at wholesale price!