Proposed patch to httpc_response.erl (R13A)
Hi,
I am new to Erlang, so please bear with me:
Fix_relative_uri function was giving me errors, because Port variable is not a list, but an integer, and ++ operator bombed.
Proposed patch (tested on several web pages with relative URI on the Location response, found working fine):
mtalyans@dev-db4$ diff -Naur httpc_response.erl.orig httpc_response.erl
--- httpc_response.erl.orig 2009-04-08 09:02:44.000000000 -0700
+++ httpc_response.erl 2009-04-08 09:03:12.000000000 -0700
@@ -364,13 +364,18 @@
end
end.
+list_port(Port) when is_list(Port) ->
+ Port;
+list_port(Port) when is_integer(Port) ->
+ integer_to_list(Port).
+
%%% Guessing that we received a relative URI, fix it to become an absoluteURI
fix_relative_uri(Request, RedirUrl) ->
{Server, Port} = Request#request.address,
Path = Request#request.path,
- atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ Port
- ++ Path ++ RedirUrl.
-
+ atom_to_list(Request#request.scheme) ++ "://" ++ Server ++ ":" ++ list_port(Port)
+ ++ Path ++ RedirUrl.
+
error(#request{id = Id}, Reason) ->
{Id, {error, Reason}}.
Thanks!
_______________________________________________
erlang-patches mailing list
erlang-patches@...
http://www.erlang.org/mailman/listinfo/erlang-patches