Browse Source

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

Loïc Hoguin 13 years ago
parent
commit
20204fd33e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/cowboy_http_req.erl

+ 6 - 0
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) ->