File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const bench = common.createBenchmark(main, {
88 hostname : [
99 '127.0.0.1' ,
1010 'localhost' ,
11+ 'localhost:123' ,
1112 'www.example.com' ,
1213 'example.com' ,
1314 'myexample.com' ,
@@ -16,6 +17,8 @@ const bench = common.createBenchmark(main, {
1617 '' ,
1718 '*' ,
1819 '126.255.255.1-127.0.0.255' ,
20+ 'localhost' ,
21+ 'localhost:123' ,
1922 '127.0.0.1' ,
2023 'example.com' ,
2124 '.example.com' ,
Original file line number Diff line number Diff line change @@ -176,7 +176,7 @@ class ProxyConfig {
176176 } else {
177177 this . #buildBypassMatchFns( ) ;
178178 // Use the bypass match functions to determine if the proxy should be used.
179- this . shouldUseProxy = this . #match. bind ( this ) ;
179+ this . shouldUseProxy = this . #match;
180180 }
181181 }
182182
@@ -199,8 +199,7 @@ class ProxyConfig {
199199 continue ;
200200 }
201201 this . #bypassMatchFns. push ( ( host ) => {
202- const hostLength = host . length ;
203- const offset = hostLength - suffixLength ;
202+ const offset = host . length - suffixLength ;
204203 if ( offset < 0 ) return false ; // Host is shorter than the suffix.
205204 for ( let i = 0 ; i < suffixLength ; i ++ ) {
206205 if ( host [ offset + i ] !== suffix [ i ] ) {
@@ -246,8 +245,8 @@ class ProxyConfig {
246245 const host = hostname . toLowerCase ( ) ;
247246 const hostWithPort = port ? `${ host } :${ port } ` : host ;
248247
249- for ( const bypassMatchFn of this . #bypassMatchFns) {
250- if ( bypassMatchFn ( host , hostWithPort ) ) {
248+ for ( let i = 0 ; i < this . #bypassMatchFns. length ; i ++ ) {
249+ if ( this . #bypassMatchFns [ i ] ( host , hostWithPort ) ) {
251250 return false ; // If any bypass function matches, do not use the proxy.
252251 }
253252 }
You can’t perform that action at this time.
0 commit comments