diff options
author | Loïc Hoguin <[email protected]> | 2011-12-22 22:09:08 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-12-22 22:10:00 +0100 |
commit | 298ba1f1bbc501e8366c4fad4a636842c33ad030 (patch) | |
tree | 02e81d34cc7b65a9fc86fe8e03bd696d81f86b91 /src/cowboy_http_req.erl | |
parent | 17c9d45786b23983fbecc05d27add12def3fa087 (diff) | |
download | cowboy-298ba1f1bbc501e8366c4fad4a636842c33ad030.tar.gz cowboy-298ba1f1bbc501e8366c4fad4a636842c33ad030.tar.bz2 cowboy-298ba1f1bbc501e8366c4fad4a636842c33ad030.zip |
Add 'Upgrade' header parsing
Not parsing product tokens, I don't see much point.
Diffstat (limited to 'src/cowboy_http_req.erl')
-rw-r--r-- | src/cowboy_http_req.erl | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl index d4b7fd3..a995871 100644 --- a/src/cowboy_http_req.erl +++ b/src/cowboy_http_req.erl @@ -227,13 +227,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') -> undefined; -parse_header_default('Accept-Charset') -> undefined; -parse_header_default('Accept-Encoding') -> undefined; -parse_header_default('Accept-Language') -> undefined; parse_header_default('Connection') -> []; -parse_header_default('If-Match') -> undefined; -parse_header_default('If-None-Match') -> undefined; parse_header_default(_Name) -> undefined. %% @doc Semantically parse headers. @@ -288,6 +282,11 @@ parse_header(Name, Req, Default) fun (Value) -> cowboy_http:http_date(Value) end); +parse_header(Name, Req, Default) when Name =:= 'Upgrade' -> + parse_header(Name, Req, Default, + fun (Value) -> + cowboy_http:nonempty_list(Value, fun cowboy_http:token_ci/2) + end); parse_header(Name, Req, Default) -> {Value, Req2} = header(Name, Req, Default), {undefined, Value, Req2}. |