0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 20:30:23 +00:00

Add 'Accept-Encoding' to cowboy_http_req:parse_header/2

This commit is contained in:
Loïc Hoguin 2011-10-26 19:23:06 +02:00
parent c605c4fa40
commit 20204fd33e

View file

@ -201,6 +201,7 @@ parse_header(Name, Req=#http_req{p_headers=PHeaders}) ->
%% @doc Default values for semantic header parsing. %% @doc Default values for semantic header parsing.
-spec parse_header_default(http_header()) -> any(). -spec parse_header_default(http_header()) -> any().
parse_header_default('Accept') -> []; parse_header_default('Accept') -> [];
parse_header_default('Accept-Encoding') -> [];
parse_header_default('Connection') -> []; parse_header_default('Connection') -> [];
parse_header_default(_Name) -> undefined. parse_header_default(_Name) -> undefined.
@ -214,6 +215,11 @@ parse_header(Name, Req, Default) when Name =:= 'Accept' ->
fun (Value) -> fun (Value) ->
cowboy_http:list(Value, fun cowboy_http:media_range/2) cowboy_http:list(Value, fun cowboy_http:media_range/2)
end); end);
parse_header(Name, Req, Default) when Name =:= 'Accept-Encoding' ->
parse_header(Name, Req, Default,
fun (Value) ->
cowboy_http:list(Value, fun cowboy_http:token_ci/2)
end);
parse_header(Name, Req, Default) when Name =:= 'Connection' -> parse_header(Name, Req, Default) when Name =:= 'Connection' ->
parse_header(Name, Req, Default, parse_header(Name, Req, Default,
fun (Value) -> fun (Value) ->