From f181e510b908b5afd2912e86307d8571b469b99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 2 Nov 2018 14:01:29 +0100 Subject: Remove the default charset iso-8859-1 in cowboy_rest This requirement was removed in RFC7231 and the rationale behind it was documented in RFC6657. --- src/cowboy_rest.erl | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/cowboy_rest.erl b/src/cowboy_rest.erl index 24c0fb0..512dc5b 100644 --- a/src/cowboy_rest.erl +++ b/src/cowboy_rest.erl @@ -658,25 +658,11 @@ charsets_provided(Req, State) -> charsets_provided(Req2, State#state{handler_state=HandlerState, charsets_p=CP}) end. -%% The special value "*", if present in the Accept-Charset field, -%% matches every character set (including ISO-8859-1) which is not -%% mentioned elsewhere in the Accept-Charset field. If no "*" is present -%% in an Accept-Charset field, then all character sets not explicitly -%% mentioned get a quality value of 0, except for ISO-8859-1, which gets -%% a quality value of 1 if not explicitly mentioned. prioritize_charsets(AcceptCharsets) -> - AcceptCharsets2 = lists:sort( + lists:sort( fun ({_CharsetA, QualityA}, {_CharsetB, QualityB}) -> QualityA > QualityB - end, AcceptCharsets), - case lists:keymember(<<"*">>, 1, AcceptCharsets2) of - true -> AcceptCharsets2; - false -> - case lists:keymember(<<"iso-8859-1">>, 1, AcceptCharsets2) of - true -> AcceptCharsets2; - false -> [{<<"iso-8859-1">>, 1000}|AcceptCharsets2] - end - end. + end, AcceptCharsets). choose_charset(Req, State, []) -> not_acceptable(Req, State); -- cgit v1.2.3