aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_req.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-11-07 00:53:19 +0100
committerLoïc Hoguin <[email protected]>2011-11-07 00:53:19 +0100
commit6dbe2b21300c2324766edaf1619272d65f5faaed (patch)
tree489b8e8ea0411c32e9f37c26163f7eafb7424838 /src/cowboy_http_req.erl
parent3e443f0a6c4f8076298f5a1a37c30417594ae75e (diff)
downloadcowboy-6dbe2b21300c2324766edaf1619272d65f5faaed.tar.gz
cowboy-6dbe2b21300c2324766edaf1619272d65f5faaed.tar.bz2
cowboy-6dbe2b21300c2324766edaf1619272d65f5faaed.zip
Add 'Accept-Language' to cowboy_http_req:parse_header/2
Diffstat (limited to 'src/cowboy_http_req.erl')
-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 2b17f9c..5a63e98 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -203,6 +203,7 @@ parse_header(Name, Req=#http_req{p_headers=PHeaders}) ->
parse_header_default('Accept') -> [];
parse_header_default('Accept-Charset') -> [];
parse_header_default('Accept-Encoding') -> [];
+parse_header_default('Accept-Language') -> [];
parse_header_default('Connection') -> [];
parse_header_default(_Name) -> undefined.
@@ -226,6 +227,11 @@ parse_header(Name, Req, Default) when Name =:= 'Accept-Encoding' ->
fun (Value) ->
cowboy_http:list(Value, fun cowboy_http:conneg/2)
end);
+parse_header(Name, Req, Default) when Name =:= 'Accept-Language' ->
+ parse_header(Name, Req, Default,
+ fun (Value) ->
+ cowboy_http:nonempty_list(Value, fun cowboy_http:language_range/2)
+ end);
parse_header(Name, Req, Default) when Name =:= 'Connection' ->
parse_header(Name, Req, Default,
fun (Value) ->