aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_server/httpd_esi.erl
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2017-11-01 12:01:06 +0100
committerIngela Anderton Andin <[email protected]>2017-11-01 12:01:06 +0100
commit61a64986b805ac8b140e25cb4caa4ad5430837a0 (patch)
tree5b486e77148a1647acc1a4fb28ee346c64b453d2 /lib/inets/src/http_server/httpd_esi.erl
parent850375f7de788d9d3b3252adb65b3491d5d10efc (diff)
parentd7a5a8a61f496708133863391f2a67a0ea47bdc7 (diff)
downloadotp-61a64986b805ac8b140e25cb4caa4ad5430837a0.tar.gz
otp-61a64986b805ac8b140e25cb4caa4ad5430837a0.tar.bz2
otp-61a64986b805ac8b140e25cb4caa4ad5430837a0.zip
Merge branch 'ingela/inets/httpd-location/OTP-14716' into maint
* ingela/inets/httpd-location/OTP-14716: inets: httpd - do not hardcode 302 status for location
Diffstat (limited to 'lib/inets/src/http_server/httpd_esi.erl')
-rw-r--r--lib/inets/src/http_server/httpd_esi.erl25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/inets/src/http_server/httpd_esi.erl b/lib/inets/src/http_server/httpd_esi.erl
index 9406b47802..fd50934d00 100644
--- a/lib/inets/src/http_server/httpd_esi.erl
+++ b/lib/inets/src/http_server/httpd_esi.erl
@@ -66,7 +66,7 @@ handle_headers("") ->
{ok, [], 200};
handle_headers(Headers) ->
NewHeaders = string:tokens(Headers, ?CRLF),
- handle_headers(NewHeaders, [], 200).
+ handle_headers(NewHeaders, [], 200, true).
%%%========================================================================
%%% Internal functions
@@ -80,21 +80,17 @@ parse_headers([?CR, ?LF, ?CR, ?LF | Rest], Acc) ->
parse_headers([Char | Rest], Acc) ->
parse_headers(Rest, [Char | Acc]).
-handle_headers([], NewHeaders, StatusCode) ->
+handle_headers([], NewHeaders, StatusCode, _) ->
{ok, NewHeaders, StatusCode};
-handle_headers([Header | Headers], NewHeaders, StatusCode) ->
+handle_headers([Header | Headers], NewHeaders, StatusCode, NoESIStatus) ->
{FieldName, FieldValue} = httpd_response:split_header(Header, []),
case FieldName of
"location" ->
- case http_request:is_absolut_uri(FieldValue) of
- true ->
- handle_headers(Headers,
- [{FieldName, FieldValue} | NewHeaders],
- 302);
- false ->
- {proceed, FieldValue}
- end;
+ handle_headers(Headers,
+ [{FieldName, FieldValue} | NewHeaders],
+ 302, NoESIStatus);
+
"status" ->
NewStatusCode =
case httpd_util:split(FieldValue," ",2) of
@@ -103,8 +99,9 @@ handle_headers([Header | Headers], NewHeaders, StatusCode) ->
_ ->
200
end,
- handle_headers(Headers, NewHeaders, NewStatusCode);
+ handle_headers(Headers, NewHeaders, NewStatusCode, false);
_ ->
handle_headers(Headers,
- [{FieldName, FieldValue}| NewHeaders], StatusCode)
- end.
+ [{FieldName, FieldValue}| NewHeaders], StatusCode,
+ NoESIStatus)
+ end.