Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/helpers/safeDecodeURIComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ const HEX = {
* Decodes a URI component, returning undefined if the URI is invalid.
* This function is a safe alternative to `decodeURIComponent`, which throws
* an error if the URI is malformed.
*
* We use this for performance reasons (throwing errors is very slow).
*/
export function safeDecodeURIComponent(uri: string): string | undefined {
let percentPosition = uri.indexOf("%");
Expand Down
3 changes: 3 additions & 0 deletions library/sources/http-server/checkIfRequestIsBlocked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const checkedBlocks = Symbol("__zen_checked_blocks__");
* - Whether the user agent is blocked by a user agent blocklist
*/
export function checkIfRequestIsBlocked(
// This flag is used to determine whether the request has already been checked
// We use a Symbol so that we don't accidentally overwrite any other properties on the response object
// and that we're the only ones that can access it
res: ServerResponse & { [checkedBlocks]?: boolean },
agent: Agent
): boolean {
Expand Down