diff options
Diffstat (limited to 'ext/http')
-rw-r--r-- | ext/http/00_serve.js | 69 | ||||
-rw-r--r-- | ext/http/01_http.js | 72 |
2 files changed, 75 insertions, 66 deletions
diff --git a/ext/http/00_serve.js b/ext/http/00_serve.js index 131f056a7..1bdcbd5d3 100644 --- a/ext/http/00_serve.js +++ b/ext/http/00_serve.js @@ -1,8 +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, +} = core; +const { + op_http_close_after_finish, + op_http_get_request_headers, + op_http_get_request_method_and_url, + op_http_read_request_body, + op_http_serve, + op_http_serve_on, + op_http_set_promise_complete, + op_http_set_response_body_bytes, + op_http_set_response_body_resource, + op_http_set_response_body_text, + op_http_set_response_header, + op_http_set_response_headers, + op_http_set_response_trailers, + op_http_upgrade_raw, + op_http_upgrade_websocket_next, + op_http_try_wait, + op_http_wait, + op_http_cancel, + op_http_close, +} = core.ensureFastOps(); +const { + ArrayPrototypePush, + ObjectHasOwn, + ObjectPrototypeIsPrototypeOf, + PromisePrototypeCatch, + PromisePrototypeThen, + Symbol, + TypeError, + TypedArrayPrototypeGetSymbolToStringTag, + Uint8Array, +} = primordials; -const { BadResourcePrototype, InterruptedPrototype } = core; import { InnerBody } from "ext:deno_fetch/22_body.js"; import { Event } from "ext:deno_web/02_event.js"; import { @@ -36,39 +71,7 @@ import { import { listen, listenOptionApiName, TcpConn } from "ext:deno_net/01_net.js"; import { listenTls } from "ext:deno_net/02_tls.js"; import { SymbolAsyncDispose } from "ext:deno_web/00_infra.js"; -const { - ArrayPrototypePush, - ObjectHasOwn, - ObjectPrototypeIsPrototypeOf, - PromisePrototypeCatch, - PromisePrototypeThen, - Symbol, - TypeError, - TypedArrayPrototypeGetSymbolToStringTag, - Uint8Array, -} = primordials; -const { - op_http_close_after_finish, - op_http_get_request_headers, - op_http_get_request_method_and_url, - op_http_read_request_body, - op_http_serve, - op_http_serve_on, - op_http_set_promise_complete, - op_http_set_response_body_bytes, - op_http_set_response_body_resource, - op_http_set_response_body_text, - op_http_set_response_header, - op_http_set_response_headers, - op_http_set_response_trailers, - op_http_upgrade_raw, - op_http_upgrade_websocket_next, - op_http_try_wait, - op_http_wait, - op_http_cancel, - op_http_close, -} = core.ensureFastOps(); const _upgraded = Symbol("_upgraded"); function internalServerError() { 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 = [ |