aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/cow_parse.hrl74
-rw-r--r--src/cow_http_hd.erl18
2 files changed, 46 insertions, 46 deletions
diff --git a/include/cow_parse.hrl b/include/cow_parse.hrl
index 1ec3dcb..5bbf8a3 100644
--- a/include/cow_parse.hrl
+++ b/include/cow_parse.hrl
@@ -16,64 +16,64 @@
-define(COW_PARSE_HRL, 1).
-define(IS_ALPHA(C),
- C =:= $a orelse C =:= $b orelse C =:= $c orelse C =:= $d orelse C =:= $e orelse
- C =:= $f orelse C =:= $g orelse C =:= $h orelse C =:= $i orelse C =:= $j orelse
- C =:= $k orelse C =:= $l orelse C =:= $m orelse C =:= $n orelse C =:= $o orelse
- C =:= $p orelse C =:= $q orelse C =:= $r orelse C =:= $s orelse C =:= $t orelse
- C =:= $u orelse C =:= $v orelse C =:= $w orelse C =:= $x orelse C =:= $y orelse
- C =:= $z orelse
- C =:= $A orelse C =:= $B orelse C =:= $C orelse C =:= $D orelse C =:= $E orelse
- C =:= $F orelse C =:= $G orelse C =:= $H orelse C =:= $I orelse C =:= $J orelse
- C =:= $K orelse C =:= $L orelse C =:= $M orelse C =:= $N orelse C =:= $O orelse
- C =:= $P orelse C =:= $Q orelse C =:= $R orelse C =:= $S orelse C =:= $T orelse
- C =:= $U orelse C =:= $V orelse C =:= $W orelse C =:= $X orelse C =:= $Y orelse
- C =:= $Z
+ (C =:= $a) or (C =:= $b) or (C =:= $c) or (C =:= $d) or (C =:= $e) or
+ (C =:= $f) or (C =:= $g) or (C =:= $h) or (C =:= $i) or (C =:= $j) or
+ (C =:= $k) or (C =:= $l) or (C =:= $m) or (C =:= $n) or (C =:= $o) or
+ (C =:= $p) or (C =:= $q) or (C =:= $r) or (C =:= $s) or (C =:= $t) or
+ (C =:= $u) or (C =:= $v) or (C =:= $w) or (C =:= $x) or (C =:= $y) or
+ (C =:= $z) or
+ (C =:= $A) or (C =:= $B) or (C =:= $C) or (C =:= $D) or (C =:= $E) or
+ (C =:= $F) or (C =:= $G) or (C =:= $H) or (C =:= $I) or (C =:= $J) or
+ (C =:= $K) or (C =:= $L) or (C =:= $M) or (C =:= $N) or (C =:= $O) or
+ (C =:= $P) or (C =:= $Q) or (C =:= $R) or (C =:= $S) or (C =:= $T) or
+ (C =:= $U) or (C =:= $V) or (C =:= $W) or (C =:= $X) or (C =:= $Y) or
+ (C =:= $Z)
).
--define(IS_ALPHANUM(C), ?IS_ALPHA(C) orelse ?IS_DIGIT(C)).
+-define(IS_ALPHANUM(C), ?IS_ALPHA(C) or ?IS_DIGIT(C)).
-define(IS_CHAR(C), C > 0, C < 128).
-define(IS_DIGIT(C),
- C =:= $0 orelse C =:= $1 orelse C =:= $2 orelse C =:= $3 orelse C =:= $4 orelse
- C =:= $5 orelse C =:= $6 orelse C =:= $7 orelse C =:= $8 orelse C =:= $9).
+ (C =:= $0) or (C =:= $1) or (C =:= $2) or (C =:= $3) or (C =:= $4) or
+ (C =:= $5) or (C =:= $6) or (C =:= $7) or (C =:= $8) or (C =:= $9)).
-define(IS_ETAGC(C), C =:= 16#21; C >= 16#23, C =/= 16#7f).
-define(IS_HEX(C),
- ?IS_DIGIT(C) orelse
- C =:= $a orelse C =:= $b orelse C =:= $c orelse
- C =:= $d orelse C =:= $e orelse C =:= $f orelse
- C =:= $A orelse C =:= $B orelse C =:= $C orelse
- C =:= $D orelse C =:= $E orelse C =:= $F).
+ ?IS_DIGIT(C) or
+ (C =:= $a) or (C =:= $b) or (C =:= $c) or
+ (C =:= $d) or (C =:= $e) or (C =:= $f) or
+ (C =:= $A) or (C =:= $B) or (C =:= $C) or
+ (C =:= $D) or (C =:= $E) or (C =:= $F)).
-define(IS_LHEX(C),
- ?IS_DIGIT(C) orelse
- C =:= $a orelse C =:= $b orelse C =:= $c orelse
- C =:= $d orelse C =:= $e orelse C =:= $f).
+ ?IS_DIGIT(C) or
+ (C =:= $a) or (C =:= $b) or (C =:= $c) or
+ (C =:= $d) or (C =:= $e) or (C =:= $f)).
-define(IS_TOKEN(C),
- ?IS_ALPHA(C) orelse ?IS_DIGIT(C)
- orelse C =:= $! orelse C =:= $# orelse C =:= $$ orelse C =:= $% orelse C =:= $&
- orelse C =:= $' orelse C =:= $* orelse C =:= $+ orelse C =:= $- orelse C =:= $.
- orelse C =:= $^ orelse C =:= $_ orelse C =:= $` orelse C =:= $| orelse C =:= $~).
+ ?IS_ALPHA(C) or ?IS_DIGIT(C) or
+ (C =:= $!) or (C =:= $#) or (C =:= $$) or (C =:= $%) or (C =:= $&) or
+ (C =:= $') or (C =:= $*) or (C =:= $+) or (C =:= $-) or (C =:= $.) or
+ (C =:= $^) or (C =:= $_) or (C =:= $`) or (C =:= $|) or (C =:= $~)).
-define(IS_TOKEN68(C),
- ?IS_ALPHA(C) orelse ?IS_DIGIT(C) orelse
- C =:= $- orelse C =:= $. orelse C =:= $_ orelse
- C =:= $~ orelse C =:= $+ orelse C =:= $/).
+ ?IS_ALPHA(C) or ?IS_DIGIT(C) or
+ (C =:= $-) or (C =:= $.) or (C =:= $_) or
+ (C =:= $~) or (C =:= $+) or (C =:= $/)).
-define(IS_URI_UNRESERVED(C),
- ?IS_ALPHA(C) orelse ?IS_DIGIT(C) orelse
- C =:= $- orelse C =:= $. orelse C =:= $_ orelse C =:= $~).
+ ?IS_ALPHA(C) or ?IS_DIGIT(C) or
+ (C =:= $-) or (C =:= $.) or (C =:= $_) or (C =:= $~)).
-define(IS_URI_SUB_DELIMS(C),
- C =:= $! orelse C =:= $$ orelse C =:= $& orelse C =:= $' orelse
- C =:= $( orelse C =:= $) orelse C =:= $* orelse C =:= $+ orelse
- C =:= $, orelse C =:= $; orelse C =:= $=).
+ (C =:= $!) or (C =:= $$) or (C =:= $&) or (C =:= $') or
+ (C =:= $() or (C =:= $)) or (C =:= $*) or (C =:= $+) or
+ (C =:= $,) or (C =:= $;) or (C =:= $=)).
-define(IS_VCHAR(C), C =:= $\t; C > 31, C < 127).
-define(IS_VCHAR_OBS(C), C =:= $\t; C > 31, C =/= 127).
--define(IS_WS(C), C =:= $\s orelse C =:= $\t).
--define(IS_WS_COMMA(C), ?IS_WS(C) orelse C =:= $,).
+-define(IS_WS(C), (C =:= $\s) or (C =:= $\t)).
+-define(IS_WS_COMMA(C), ?IS_WS(C) or (C =:= $,)).
-endif.
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl
index cfea5e3..b54ade6 100644
--- a/src/cow_http_hd.erl
+++ b/src/cow_http_hd.erl
@@ -910,11 +910,11 @@ cache_directive_list(<< C, R/bits >>, Acc) when ?IS_TOKEN(C) ->
?LOWER(cache_directive, R, Acc, <<>>).
cache_directive(<< $=, $", R/bits >>, Acc, T)
- when T =:= <<"no-cache">> orelse T =:= <<"private">> ->
+ when (T =:= <<"no-cache">>) or (T =:= <<"private">>) ->
cache_directive_fields_list(R, Acc, T, []);
cache_directive(<< $=, C, R/bits >>, Acc, T)
- when ?IS_DIGIT(C), T =:= <<"max-age">> orelse T =:= <<"max-stale">>
- orelse T =:= <<"min-fresh">> orelse T =:= <<"s-maxage">> ->
+ when ?IS_DIGIT(C), (T =:= <<"max-age">>) or (T =:= <<"max-stale">>)
+ or (T =:= <<"min-fresh">>) or (T =:= <<"s-maxage">>) ->
cache_directive_delta(R, Acc, T, (C - $0));
cache_directive(<< $=, $", R/bits >>, Acc, T) -> cache_directive_quoted_string(R, Acc, T, <<>>);
cache_directive(<< $=, C, R/bits >>, Acc, T) when ?IS_TOKEN(C) -> cache_directive_token(R, Acc, T, << C >>);
@@ -1754,10 +1754,10 @@ horse_parse_etag() ->
parse_expect(<<"100-continue">>) ->
continue;
parse_expect(<<"100-", C, O, N, T, I, M, U, E >>)
- when C =:= $C orelse C =:= $c, O =:= $O orelse O =:= $o,
- N =:= $N orelse N =:= $n, T =:= $T orelse T =:= $t,
- I =:= $I orelse I =:= $i, M =:= $N orelse M =:= $n,
- U =:= $U orelse U =:= $u, E =:= $E orelse E =:= $e ->
+ when (C =:= $C) or (C =:= $c), (O =:= $O) or (O =:= $o),
+ (N =:= $N) or (N =:= $n), (T =:= $T) or (T =:= $t),
+ (I =:= $I) or (I =:= $i), (M =:= $N) or (M =:= $n),
+ (U =:= $U) or (U =:= $u), (E =:= $E) or (E =:= $e) ->
continue.
-ifdef(TEST).
@@ -1857,12 +1857,12 @@ parse_host(Host) ->
ipv6_address(<< $] >>, IP) -> {<< IP/binary, $] >>, undefined};
ipv6_address(<< $], $:, Port/bits >>, IP) -> {<< IP/binary, $] >>, binary_to_integer(Port)};
-ipv6_address(<< C, R/bits >>, IP) when ?IS_HEX(C) orelse C =:= $: orelse C =:= $. ->
+ipv6_address(<< C, R/bits >>, IP) when ?IS_HEX(C) or (C =:= $:) or (C =:= $.) ->
?LOWER(ipv6_address, R, IP).
reg_name(<<>>, Name) -> {Name, undefined};
reg_name(<< $:, Port/bits >>, Name) -> {Name, binary_to_integer(Port)};
-reg_name(<< C, R/bits >>, Name) when ?IS_URI_UNRESERVED(C) orelse ?IS_URI_SUB_DELIMS(C) ->
+reg_name(<< C, R/bits >>, Name) when ?IS_URI_UNRESERVED(C) or ?IS_URI_SUB_DELIMS(C) ->
?LOWER(reg_name, R, Name).
-ifdef(TEST).