File tree Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Expand file tree Collapse file tree 1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -58,24 +58,10 @@ var RE_CONN_VALUES = /(?:^|\W)close|upgrade(?:$|\W)/ig;
58
58
var RE_TE_CHUNKED = common . chunkExpression ;
59
59
60
60
// isCookieField performs a case-insensitive comparison of a provided string
61
- // against the word "cookie." This method (at least as of V8 5.4) is faster than
62
- // the equivalent case-insensitive regexp, even if isCookieField does not get
63
- // inlined.
61
+ // against the word "cookie." As of V8 6.6 this is faster than handrolling or
62
+ // using a case-insensitive RegExp.
64
63
function isCookieField ( s ) {
65
- if ( s . length !== 6 ) return false ;
66
- var ch = s . charCodeAt ( 0 ) ;
67
- if ( ch !== 99 && ch !== 67 ) return false ;
68
- ch = s . charCodeAt ( 1 ) ;
69
- if ( ch !== 111 && ch !== 79 ) return false ;
70
- ch = s . charCodeAt ( 2 ) ;
71
- if ( ch !== 111 && ch !== 79 ) return false ;
72
- ch = s . charCodeAt ( 3 ) ;
73
- if ( ch !== 107 && ch !== 75 ) return false ;
74
- ch = s . charCodeAt ( 4 ) ;
75
- if ( ch !== 105 && ch !== 73 ) return false ;
76
- ch = s . charCodeAt ( 5 ) ;
77
- if ( ch !== 101 && ch !== 69 ) return false ;
78
- return true ;
64
+ return s . length === 6 && s . toLowerCase ( ) === 'cookie' ;
79
65
}
80
66
81
67
function noopPendingOutput ( amount ) { }
You can’t perform that action at this time.
0 commit comments