summaryrefslogtreecommitdiff
path: root/ext/http
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2023-05-01 22:30:02 +0900
committerGitHub <noreply@github.com>2023-05-01 15:30:02 +0200
commit6728ad4203d731e555dabf89ec6157f113454ce6 (patch)
tree956dc2d403b5a6ef107c35cab1ccc259ad4d86a1 /ext/http
parent94a148cdb6f7660518c75a3c20109bf64848f0f1 (diff)
fix(core): Use primordials for methods (#18839)
I would like to get this change into Deno before merging https://github.com/denoland/deno_lint/pull/1152
Diffstat (limited to 'ext/http')
-rw-r--r--ext/http/00_serve.js5
-rw-r--r--ext/http/01_http.js12
2 files changed, 11 insertions, 6 deletions
diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js
index 33742e122..6aed08bdd 100644
--- a/ext/http/00_serve.js
+++ b/ext/http/00_serve.js
@@ -37,14 +37,15 @@ import {
import { TcpConn } from "ext:deno_net/01_net.js";
const {
ObjectPrototypeIsPrototypeOf,
+ PromisePrototypeCatch,
SafeSet,
SafeSetIterator,
SetPrototypeAdd,
SetPrototypeDelete,
Symbol,
TypeError,
- Uint8ArrayPrototype,
Uint8Array,
+ Uint8ArrayPrototype,
} = primordials;
const {
@@ -667,7 +668,7 @@ async function serve(arg1, arg2) {
if (req === 0xffffffff) {
break;
}
- callback(req).catch((error) => {
+ PromisePrototypeCatch(callback(req), (error) => {
// Abnormal exit
console.error(
"Terminating Deno.serve loop due to unexpected error",
diff --git a/ext/http/01_http.js b/ext/http/01_http.js
index 0048eedeb..f41a2beed 100644
--- a/ext/http/01_http.js
+++ b/ext/http/01_http.js
@@ -54,8 +54,9 @@ const {
SetPrototypeDelete,
StringPrototypeCharCodeAt,
StringPrototypeIncludes,
- StringPrototypeToLowerCase,
StringPrototypeSplit,
+ StringPrototypeToLowerCase,
+ StringPrototypeToUpperCase,
Symbol,
SymbolAsyncIterator,
TypeError,
@@ -497,17 +498,20 @@ function buildCaseInsensitiveCommaValueFinder(checkText) {
StringPrototypeToLowerCase(checkText),
"",
),
- (c) => [c.charCodeAt(0), c.toUpperCase().charCodeAt(0)],
+ (c) => [
+ StringPrototypeCharCodeAt(c, 0),
+ StringPrototypeCharCodeAt(StringPrototypeToUpperCase(c), 0),
+ ],
);
/** @type {number} */
let i;
/** @type {number} */
let char;
- /** @param value {string} */
+ /** @param {string} value */
return function (value) {
for (i = 0; i < value.length; i++) {
- char = value.charCodeAt(i);
+ char = StringPrototypeCharCodeAt(value, i);
skipWhitespace(value);
if (hasWord(value)) {