diff options
author | Loïc Hoguin <[email protected]> | 2014-12-26 12:05:57 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-26 12:05:57 +0100 |
commit | a3ccda57bcea0cfb23dd9229ca71672dcaca25a0 (patch) | |
tree | 8b9ae28907aa43ce5ca4f3aabd9591c47dea1133 /src/cow_http_hd.erl | |
parent | 62a6fdd7243324799cb5449772c6a67a3d8596f7 (diff) | |
download | cowlib-a3ccda57bcea0cfb23dd9229ca71672dcaca25a0.tar.gz cowlib-a3ccda57bcea0cfb23dd9229ca71672dcaca25a0.tar.bz2 cowlib-a3ccda57bcea0cfb23dd9229ca71672dcaca25a0.zip |
Improve internal cow_http_hd function token_ci_list/2
We now ensure that the tokens are made of token characters only.
Diffstat (limited to 'src/cow_http_hd.erl')
-rw-r--r-- | src/cow_http_hd.erl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index d5f3803..b277292 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -2492,21 +2492,21 @@ token_ci_list(<<>>, Acc) -> lists:reverse(Acc); token_ci_list(<< $\s, R/bits >>, Acc) -> token_ci_list(R, Acc); token_ci_list(<< $\t, R/bits >>, Acc) -> token_ci_list(R, Acc); token_ci_list(<< $,, R/bits >>, Acc) -> token_ci_list(R, Acc); -token_ci_list(<< C, R/bits >>, Acc) -> +token_ci_list(<< C, R/bits >>, Acc) when ?IS_TOKEN(C) -> case C of - ?INLINE_LOWERCASE(token_ci_list, R, Acc, <<>>) + ?INLINE_LOWERCASE(token_ci, R, Acc, <<>>) end. -token_ci_list(<<>>, Acc, T) -> lists:reverse([T|Acc]); -token_ci_list(<< $\s, R/bits >>, Acc, T) -> token_ci_list_sep(R, Acc, T); -token_ci_list(<< $\t, R/bits >>, Acc, T) -> token_ci_list_sep(R, Acc, T); -token_ci_list(<< $,, R/bits >>, Acc, T) -> token_ci_list(R, [T|Acc]); -token_ci_list(<< C, R/bits >>, Acc, T) -> +token_ci(<<>>, Acc, T) -> lists:reverse([T|Acc]); +token_ci(<< $\s, R/bits >>, Acc, T) -> token_ci_list_sep(R, [T|Acc]); +token_ci(<< $\t, R/bits >>, Acc, T) -> token_ci_list_sep(R, [T|Acc]); +token_ci(<< $,, R/bits >>, Acc, T) -> token_ci_list(R, [T|Acc]); +token_ci(<< C, R/bits >>, Acc, T) when ?IS_TOKEN(C) -> case C of - ?INLINE_LOWERCASE(token_ci_list, R, Acc, T) + ?INLINE_LOWERCASE(token_ci, R, Acc, T) end. -token_ci_list_sep(<<>>, Acc, T) -> lists:reverse([T|Acc]); -token_ci_list_sep(<< $\s, R/bits >>, Acc, T) -> token_ci_list_sep(R, Acc, T); -token_ci_list_sep(<< $\t, R/bits >>, Acc, T) -> token_ci_list_sep(R, Acc, T); -token_ci_list_sep(<< $,, R/bits >>, Acc, T) -> token_ci_list(R, [T|Acc]). +token_ci_list_sep(<<>>, Acc) -> lists:reverse(Acc); +token_ci_list_sep(<< $\s, R/bits >>, Acc) -> token_ci_list_sep(R, Acc); +token_ci_list_sep(<< $\t, R/bits >>, Acc) -> token_ci_list_sep(R, Acc); +token_ci_list_sep(<< $,, R/bits >>, Acc) -> token_ci_list(R, Acc). |