File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,8 @@ const HEX = {
6161 * Decodes a URI component, returning undefined if the URI is invalid.
6262 * This function is a safe alternative to `decodeURIComponent`, which throws
6363 * an error if the URI is malformed.
64+ *
65+ * We use this for performance reasons (throwing errors is very slow).
6466 */
6567export function safeDecodeURIComponent ( uri : string ) : string | undefined {
6668 let percentPosition = uri . indexOf ( "%" ) ;
Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ const checkedBlocks = Symbol("__zen_checked_blocks__");
1414 * - Whether the user agent is blocked by a user agent blocklist
1515 */
1616export function checkIfRequestIsBlocked (
17+ // This flag is used to determine whether the request has already been checked
18+ // We use a Symbol so that we don't accidentally overwrite any other properties on the response object
19+ // and that we're the only ones that can access it
1720 res : ServerResponse & { [ checkedBlocks ] ?: boolean } ,
1821 agent : Agent
1922) : boolean {
You can’t perform that action at this time.
0 commit comments