-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle missing dns-packet and user-flags
For reasons not yet known, userBlocklistFlagUint may go missing, and that causes issues in dns-operation which don't at all expect it (null, undefined). Fix that by treating empty, null, undefined strings as just empty, and returning early from functions that can't do much with missing user-flags. In a similar issue seen in prod, current-request doesn't do well with a missing (undefined, null) decodedDnsPacket obj. So, before using it in current-request make sure it is set to an equivalent empty obj.
- Loading branch information
1 parent
f2b3439
commit bc6dc50
Showing
8 changed files
with
54 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,4 +91,4 @@ function checkDomainNameUserFlagIntersection( | |
throw e; | ||
} | ||
return response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ export function corsHeaders() { | |
|
||
/** | ||
* @param {String} ua - User Agent string | ||
* @returns | ||
* @returns | ||
*/ | ||
export function corsHeadersIfNeeded(ua) { | ||
// allow cors when user agents claiming to be browsers | ||
|
@@ -104,7 +104,7 @@ export function concatHeaders() { | |
|
||
/** | ||
* @param {Request} request - Request | ||
* @returns | ||
* @returns | ||
*/ | ||
export function copyHeaders(request) { | ||
const headers = {} | ||
|
@@ -213,7 +213,7 @@ export function safeBox(fn, defaultResponse = null) { | |
|
||
/** | ||
* @param {Request} req - Request | ||
* @returns | ||
* @returns | ||
*/ | ||
export function isDnsMsg(req) { | ||
return req.headers.get("Accept") === "application/dns-message" || | ||
|
@@ -240,3 +240,8 @@ export function errResponse(id, err) { | |
data: false, | ||
} | ||
} | ||
|
||
export function emptyString(str) { | ||
return !str || str.length === 0 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ignoramous
Author
Contributor
|
||
} | ||
|
Why is this required? Empty string in JS, i.e.
""
will evaluate to false anyway.