mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
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.
This commit is contained in:
parent
e0b036fe68
commit
f181e510b9
1 changed files with 2 additions and 16 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue