diff options
author | DataTriny <datatriny@gmail.com> | 2022-10-04 22:25:41 +0200 |
---|---|---|
committer | DataTriny <datatriny@gmail.com> | 2022-10-04 22:25:41 +0200 |
commit | 112cf5843a52fa6a57865faea5b7e60ec1a7e141 (patch) | |
tree | 6115aca7bb105360bc1c35eeb6ae7adfad913f2c /lib/inets/src | |
parent | a00463b9c43f80b671619fddfd0e8d1c594c5b88 (diff) | |
download | erlang-112cf5843a52fa6a57865faea5b7e60ec1a7e141.tar.gz |
inets: Implement HTTP 308 Permanent Redirect
Diffstat (limited to 'lib/inets/src')
-rw-r--r-- | lib/inets/src/http_client/httpc_response.erl | 20 | ||||
-rw-r--r-- | lib/inets/src/http_server/httpd_util.erl | 1 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/inets/src/http_client/httpc_response.erl b/lib/inets/src/http_client/httpc_response.erl index 79895e447e..2c421c5969 100644 --- a/lib/inets/src/http_client/httpc_response.erl +++ b/lib/inets/src/http_client/httpc_response.erl @@ -122,17 +122,19 @@ result(Response = {{_, Code, _}, _, _}, (Code =:= 303) -> redirect(Response, Request#request{method = get}); result(Response = {{_, Code, _}, _, _}, - Request = #request{settings = - #http_options{autoredirect = true}, - method = post}) when (Code =:= 307) -> + Request = #request{settings = + #http_options{autoredirect = true}, + method = post}) when (Code =:= 307) orelse + (Code =:= 308) -> redirect(Response, Request); result(Response = {{_, Code, _}, _, _}, - Request = #request{settings = - #http_options{autoredirect = true}, - method = Method}) when (Code =:= 301) orelse - (Code =:= 302) orelse - (Code =:= 303) orelse - (Code =:= 307) -> + Request = #request{settings = + #http_options{autoredirect = true}, + method = Method}) when (Code =:= 301) orelse + (Code =:= 302) orelse + (Code =:= 303) orelse + (Code =:= 307) orelse + (Code =:= 308) -> case lists:member(Method, [get, head, options, trace]) of true -> redirect(Response, Request); diff --git a/lib/inets/src/http_server/httpd_util.erl b/lib/inets/src/http_server/httpd_util.erl index c1f273af79..07fc553f70 100644 --- a/lib/inets/src/http_server/httpd_util.erl +++ b/lib/inets/src/http_server/httpd_util.erl @@ -129,6 +129,7 @@ reason_phrase(304) -> "Not Modified" ; reason_phrase(305) -> "Use Proxy" ; reason_phrase(306) -> "(unused)" ; reason_phrase(307) -> "Temporary Redirect" ; +reason_phrase(308) -> "Permanent Redirect" ; reason_phrase(400) -> "Bad Request"; reason_phrase(401) -> "Unauthorized"; reason_phrase(402) -> "Payment Required"; |