aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-02 14:01:29 +0100
committerLoïc Hoguin <[email protected]>2018-11-02 14:01:29 +0100
commitf181e510b908b5afd2912e86307d8571b469b99e (patch)
treefc26d1e8f3c246c39c58cb6935a89f045f40ec0b
parente0b036fe68579b3ffb69b450acf2d17bb7162cf3 (diff)
downloadcowboy-f181e510b908b5afd2912e86307d8571b469b99e.tar.gz
cowboy-f181e510b908b5afd2912e86307d8571b469b99e.tar.bz2
cowboy-f181e510b908b5afd2912e86307d8571b469b99e.zip
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.
-rw-r--r--src/cowboy_rest.erl18
1 files changed, 2 insertions, 16 deletions
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);