aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_http_req.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-10-17 09:15:01 +0200
committerLoïc Hoguin <[email protected]>2011-10-17 10:29:14 +0200
commit1e7338bdd4768123da177895ec6c91d3dabb7ca9 (patch)
tree3ad2d6ce92d15a372ac7db8d7a2f197bbc747e06 /src/cowboy_http_req.erl
parent81cc99d10bab86369f4ae7ea0db948ffad1239d0 (diff)
downloadcowboy-1e7338bdd4768123da177895ec6c91d3dabb7ca9.tar.gz
cowboy-1e7338bdd4768123da177895ec6c91d3dabb7ca9.tar.bz2
cowboy-1e7338bdd4768123da177895ec6c91d3dabb7ca9.zip
Rewrite the token list parsing into separate, modulable functions
Introduce cowboy_http's list/2, nonempty_list/2, token/2 functions.
Diffstat (limited to 'src/cowboy_http_req.erl')
-rw-r--r--src/cowboy_http_req.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cowboy_http_req.erl b/src/cowboy_http_req.erl
index a7b0533..da7c16f 100644
--- a/src/cowboy_http_req.erl
+++ b/src/cowboy_http_req.erl
@@ -220,7 +220,7 @@ parse_header(Name, Req=#http_req{p_headers=PHeaders}, Default)
case header(Name, Req) of
{undefined, Req2} -> {tokens, Default, Req2};
{Value, Req2} ->
- case cowboy_http:parse_tokens_list(Value) of
+ case cowboy_http:nonempty_list(Value, fun cowboy_http:token/2) of
{error, badarg} ->
{error, badarg};
P ->
@@ -417,7 +417,7 @@ response_connection([{Name, Value}|Tail], Connection) ->
-spec response_connection_parse(binary()) -> keepalive | close.
response_connection_parse(ReplyConn) ->
- Tokens = cowboy_http:parse_tokens_list(ReplyConn),
+ Tokens = cowboy_http:nonempty_list(ReplyConn, fun cowboy_http:token/2),
cowboy_http:connection_to_atom(Tokens).
-spec response_head(http_status(), http_headers(), http_headers()) -> iolist().