aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-10-26 19:23:06 +0200
committerLoïc Hoguin <[email protected]>2011-10-26 19:24:49 +0200
commit20204fd33ef5040428f6d9e3c8e640a7b16abc9d (patch)
treeb70adbeb74f7386ba13729b3e3269e69d02c39e6
parentc605c4fa408272f98b78e06577fb7c446b7ea2e7 (diff)
downloadcowboy-20204fd33ef5040428f6d9e3c8e640a7b16abc9d.tar.gz
cowboy-20204fd33ef5040428f6d9e3c8e640a7b16abc9d.tar.bz2
cowboy-20204fd33ef5040428f6d9e3c8e640a7b16abc9d.zip
Add 'Accept-Encoding' to cowboy_http_req:parse_header/2
-rw-r--r--src/cowboy_http_req.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index fb126e5..1555a02 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -201,6 +201,7 @@ parse_header(Name, Req=#http_req{p_headers=PHeaders}) ->
%% @doc Default values for semantic header parsing.
-spec parse_header_default(http_header()) -> any().
parse_header_default('Accept') -> [];
+parse_header_default('Accept-Encoding') -> [];
parse_header_default('Connection') -> [];
parse_header_default(_Name) -> undefined.
@@ -214,6 +215,11 @@ parse_header(Name, Req, Default) when Name =:= 'Accept' ->
fun (Value) ->
cowboy_http:list(Value, fun cowboy_http:media_range/2)
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,
fun (Value) ->