Skip to content

Commit 170dc6e

Browse files
committed
clean up
1 parent fd9f629 commit 170dc6e

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

src/main/java/com/ning/http/client/cookie/CookieUtil.java

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class CookieUtil {
2020

2121
private static final BitSet VALID_COOKIE_VALUE_OCTETS = validCookieValueOctets();
2222

23-
private static final BitSet VALID_COOKIE_NAME_OCTETS = validCookieNameOctets(VALID_COOKIE_VALUE_OCTETS);
23+
private static final BitSet VALID_COOKIE_NAME_OCTETS = validCookieNameOctets();
2424

2525
// cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
2626
// US-ASCII characters excluding CTLs, whitespace, DQUOTE, comma, semicolon, and backslash
@@ -47,30 +47,15 @@ private static BitSet validCookieValueOctets() {
4747
// | "," | ";" | ":" | "\" | <">
4848
// | "/" | "[" | "]" | "?" | "="
4949
// | "{" | "}" | SP | HT
50-
private static BitSet validCookieNameOctets(BitSet validCookieValueOctets) {
50+
private static BitSet validCookieNameOctets() {
5151
BitSet bits = new BitSet(8);
5252
for (int i = 32; i < 127; i++) {
5353
bits.set(i);
5454
}
55-
bits.set('(', false);
56-
bits.set(')', false);
57-
bits.set('<', false);
58-
bits.set('>', false);
59-
bits.set('@', false);
60-
bits.set(',', false);
61-
bits.set(';', false);
62-
bits.set(':', false);
63-
bits.set('\\', false);
64-
bits.set('"', false);
65-
bits.set('/', false);
66-
bits.set('[', false);
67-
bits.set(']', false);
68-
bits.set('?', false);
69-
bits.set('=', false);
70-
bits.set('{', false);
71-
bits.set('}', false);
72-
bits.set(' ', false);
73-
bits.set('\t', false);
55+
int[] separators = new int[] { '(', ')', '<', '>', '@', ',', ';', ':', '\\', '"', '/', '[', ']', '?', '=', '{', '}', ' ', '\t' };
56+
for (int separator : separators) {
57+
bits.set(separator, false);
58+
}
7459
return bits;
7560
}
7661

0 commit comments

Comments
 (0)