aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client/httpc_response.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-03-15 11:59:40 +0100
committerMicael Karlberg <[email protected]>2012-03-15 11:59:40 +0100
commita366623c674e993667fedbe01ad52dc4fab5b4f0 (patch)
treef377605e6270ad279cfe48253b8ae84b5c99b951 /lib/inets/src/http_client/httpc_response.erl
parent0c11d7235ed1f0f5c595cf3d9a433adf9c61cc8c (diff)
downloadotp-a366623c674e993667fedbe01ad52dc4fab5b4f0.tar.gz
otp-a366623c674e993667fedbe01ad52dc4fab5b4f0.tar.bz2
otp-a366623c674e993667fedbe01ad52dc4fab5b4f0.zip
[inets] The module http_uri now officially supported
The module http_uri now officially supported. Also, the http_uri:parse/1,2 function has been extended with more scheme support and a way to provide your own scheme info. OTP-9983
Diffstat (limited to 'lib/inets/src/http_client/httpc_response.erl')
-rw-r--r--lib/inets/src/http_client/httpc_response.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/inets/src/http_client/httpc_response.erl b/lib/inets/src/http_client/httpc_response.erl
index 919115a23a..23924e355e 100644
--- a/lib/inets/src/http_client/httpc_response.erl
+++ b/lib/inets/src/http_client/httpc_response.erl
@@ -342,7 +342,7 @@ redirect(Response = {StatusLine, Headers, Body}, Request) ->
RedirUrl ->
UrlParseOpts = [{ipv6_host_with_brackets,
Request#request.ipv6_host_with_brackets}],
- case http_uri:parse(RedirUrl, UrlParseOpts) of
+ case uri_parse(RedirUrl, UrlParseOpts) of
{error, no_scheme} when
(Request#request.settings)#http_options.relaxed ->
NewLocation = fix_relative_uri(Request, RedirUrl),
@@ -437,3 +437,17 @@ format_response({StatusLine, Headers, Body}) ->
end,
{{StatusLine, http_response:header_list(Headers), NewBody}, Data}.
+%%--------------------------------------------------------------------------
+%% These functions is just simple wrappers to parse specifically HTTP URIs
+%%--------------------------------------------------------------------------
+
+scheme_defaults() ->
+ [{http, 80}, {https, 443}].
+
+uri_parse(URI, Opts) ->
+ http_uri:parse(URI, [{scheme_defaults, scheme_defaults()} | Opts]).
+
+
+%%--------------------------------------------------------------------------
+
+