diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2024-01-11 07:37:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 15:37:25 -0700 |
commit | 515a34b4de222e35c7ade1b92614d746e73d4c2e (patch) | |
tree | 8284201fc826a33f12597959a8a8be14e0f524bd /ext/http/01_http.js | |
parent | d4893eb51a01c5a692d8ca74a3b8ff95c5fd1d9f (diff) |
refactor: use `core.ensureFastOps()` (#21888)
Diffstat (limited to 'ext/http/01_http.js')
-rw-r--r-- | ext/http/01_http.js | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/ext/http/01_http.js b/ext/http/01_http.js index 64951ee0f..92f1fd03e 100644 --- a/ext/http/01_http.js +++ b/ext/http/01_http.js @@ -1,7 +1,43 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. import { core, internals, primordials } from "ext:core/mod.js"; -const { BadResourcePrototype, InterruptedPrototype, ops } = core; +const { + BadResourcePrototype, + InterruptedPrototype, +} = core; +const { + op_http_accept, + op_http_headers, + op_http_shutdown, + op_http_upgrade, + op_http_upgrade_websocket, + op_http_websocket_accept_header, + op_http_write, + op_http_write_headers, + op_http_write_resource, +} = core.ensureFastOps(); +const { + ArrayPrototypeIncludes, + ArrayPrototypeMap, + ArrayPrototypePush, + Error, + ObjectPrototypeIsPrototypeOf, + SafeSet, + SafeSetIterator, + SetPrototypeAdd, + SetPrototypeDelete, + StringPrototypeCharCodeAt, + StringPrototypeIncludes, + StringPrototypeSplit, + StringPrototypeToLowerCase, + StringPrototypeToUpperCase, + Symbol, + SymbolAsyncIterator, + TypeError, + TypedArrayPrototypeGetSymbolToStringTag, + Uint8Array, +} = primordials; + import { InnerBody } from "ext:deno_fetch/22_body.js"; import { Event, setEventTargetData } from "ext:deno_web/02_event.js"; import { BlobPrototype } from "ext:deno_web/09_file.js"; @@ -42,36 +78,6 @@ import { } from "ext:deno_web/06_streams.js"; import { serve } from "ext:deno_http/00_serve.js"; import { SymbolDispose } from "ext:deno_web/00_infra.js"; -const { - ArrayPrototypeIncludes, - ArrayPrototypeMap, - ArrayPrototypePush, - Error, - ObjectPrototypeIsPrototypeOf, - SafeSet, - SafeSetIterator, - SetPrototypeAdd, - SetPrototypeDelete, - StringPrototypeCharCodeAt, - StringPrototypeIncludes, - StringPrototypeSplit, - StringPrototypeToLowerCase, - StringPrototypeToUpperCase, - Symbol, - SymbolAsyncIterator, - TypeError, - TypedArrayPrototypeGetSymbolToStringTag, - Uint8Array, -} = primordials; -const { - op_http_accept, - op_http_shutdown, - op_http_upgrade, - op_http_write, - op_http_upgrade_websocket, - op_http_write_headers, - op_http_write_resource, -} = core.ensureFastOps(); const connErrorSymbol = Symbol("connError"); const _deferred = Symbol("upgradeHttpDeferred"); @@ -152,7 +158,7 @@ class HttpConn { const innerRequest = newInnerRequest( method, url, - () => ops.op_http_headers(streamRid), + () => op_http_headers(streamRid), body !== null ? new InnerBody(body) : null, false, ); @@ -455,7 +461,7 @@ function upgradeWebSocket(request, options = {}) { ); } - const accept = ops.op_http_websocket_accept_header(websocketKey); + const accept = op_http_websocket_accept_header(websocketKey); const r = newInnerResponse(101); r.headerList = [ |