summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_http_common.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-12 01:52:08 +0100
committerGitHub <noreply@github.com>2024-09-12 00:52:08 +0000
commitf794781ffba941085343b95dd5a9c1ad74a322a2 (patch)
tree395ad9feae6a3bf4078d0f03053eed8ce85b3396 /ext/node/polyfills/_http_common.ts
parent8476bbff9af28408bc6a9b0a7b2303cb3803422e (diff)
feat(ext/node): expose ES modules for _ modules (#25588)
Exposes following modules: - `"node:_http_agent"` - `"node:_http_common"` - `"node:_http_outgoing"` - `"node:_http_server"` - `"node:_stream_duplex"` - `"node:_stream_passthrough"` - `"node:_stream_readable"` - `"node:_stream_transform"` - `"node:_stream_writable"` - `"node:_tls_common"` - `"node:_tls_wrap"`
Diffstat (limited to 'ext/node/polyfills/_http_common.ts')
-rw-r--r--ext/node/polyfills/_http_common.ts61
1 files changed, 60 insertions, 1 deletions
diff --git a/ext/node/polyfills/_http_common.ts b/ext/node/polyfills/_http_common.ts
index 24dae6f30..8fb7758a5 100644
--- a/ext/node/polyfills/_http_common.ts
+++ b/ext/node/polyfills/_http_common.ts
@@ -2,8 +2,53 @@
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
import { primordials } from "ext:core/mod.js";
-const { RegExpPrototypeTest, SafeRegExp } = primordials;
+const {
+ RegExpPrototypeTest,
+ SafeRegExp,
+ Symbol,
+} = primordials;
+
+export const CRLF = "\r\n";
+export const kIncomingMessage = Symbol("IncomingMessage");
const tokenRegExp = new SafeRegExp(/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/);
+
+export const methods = [
+ "ACL",
+ "BIND",
+ "CHECKOUT",
+ "CONNECT",
+ "COPY",
+ "DELETE",
+ "GET",
+ "HEAD",
+ "LINK",
+ "LOCK",
+ "M-SEARCH",
+ "MERGE",
+ "MKACTIVITY",
+ "MKCALENDAR",
+ "MKCOL",
+ "MOVE",
+ "NOTIFY",
+ "OPTIONS",
+ "PATCH",
+ "POST",
+ "PROPFIND",
+ "PROPPATCH",
+ "PURGE",
+ "PUT",
+ "REBIND",
+ "REPORT",
+ "SEARCH",
+ "SOURCE",
+ "SUBSCRIBE",
+ "TRACE",
+ "UNBIND",
+ "UNLINK",
+ "UNLOCK",
+ "UNSUBSCRIBE",
+];
+
/**
* Verifies that the given val is a valid HTTP token
* per the rules defined in RFC 7230
@@ -25,7 +70,21 @@ function checkInvalidHeaderChar(val: string) {
}
export const chunkExpression = new SafeRegExp(/(?:^|\W)chunked(?:$|\W)/i);
+export const continueExpression = new SafeRegExp(
+ /(?:^|\W)100-continue(?:$|\W)/i,
+);
+
export {
checkInvalidHeaderChar as _checkInvalidHeaderChar,
checkIsHttpToken as _checkIsHttpToken,
};
+
+export default {
+ _checkInvalidHeaderChar: checkInvalidHeaderChar,
+ _checkIsHttpToken: checkIsHttpToken,
+ chunkExpression,
+ CRLF,
+ continueExpression,
+ kIncomingMessage,
+ methods,
+};