@nocobase/plugin-idp-oauth 2.1.0-alpha.16 → 2.1.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.config.ts +1 -1
- package/dist/externalVersion.js +4 -4
- package/dist/node_modules/light-my-request/package.json +1 -1
- package/dist/node_modules/undici/LICENSE +21 -0
- package/dist/node_modules/undici/README.md +741 -0
- package/dist/node_modules/undici/docs/docs/api/Agent.md +84 -0
- package/dist/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
- package/dist/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
- package/dist/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
- package/dist/node_modules/undici/docs/docs/api/Client.md +285 -0
- package/dist/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
- package/dist/node_modules/undici/docs/docs/api/Connector.md +115 -0
- package/dist/node_modules/undici/docs/docs/api/ContentType.md +57 -0
- package/dist/node_modules/undici/docs/docs/api/Cookies.md +101 -0
- package/dist/node_modules/undici/docs/docs/api/Debug.md +62 -0
- package/dist/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
- package/dist/node_modules/undici/docs/docs/api/Dispatcher.md +1392 -0
- package/dist/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
- package/dist/node_modules/undici/docs/docs/api/Errors.md +49 -0
- package/dist/node_modules/undici/docs/docs/api/EventSource.md +45 -0
- package/dist/node_modules/undici/docs/docs/api/Fetch.md +60 -0
- package/dist/node_modules/undici/docs/docs/api/GlobalInstallation.md +139 -0
- package/dist/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
- package/dist/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
- package/dist/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
- package/dist/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
- package/dist/node_modules/undici/docs/docs/api/MockClient.md +81 -0
- package/dist/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
- package/dist/node_modules/undici/docs/docs/api/MockPool.md +555 -0
- package/dist/node_modules/undici/docs/docs/api/Pool.md +84 -0
- package/dist/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
- package/dist/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
- package/dist/node_modules/undici/docs/docs/api/RedirectHandler.md +93 -0
- package/dist/node_modules/undici/docs/docs/api/RetryAgent.md +50 -0
- package/dist/node_modules/undici/docs/docs/api/RetryHandler.md +118 -0
- package/dist/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
- package/dist/node_modules/undici/docs/docs/api/SnapshotAgent.md +616 -0
- package/dist/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +274 -0
- package/dist/node_modules/undici/docs/docs/api/Util.md +25 -0
- package/dist/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
- package/dist/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
- package/dist/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
- package/dist/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
- package/dist/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
- package/dist/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
- package/dist/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
- package/dist/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
- package/dist/node_modules/undici/index-fetch.js +65 -0
- package/dist/node_modules/undici/index.d.ts +3 -0
- package/dist/node_modules/undici/index.js +234 -0
- package/dist/node_modules/undici/lib/api/abort-signal.js +59 -0
- package/dist/node_modules/undici/lib/api/api-connect.js +110 -0
- package/dist/node_modules/undici/lib/api/api-pipeline.js +252 -0
- package/dist/node_modules/undici/lib/api/api-request.js +214 -0
- package/dist/node_modules/undici/lib/api/api-stream.js +209 -0
- package/dist/node_modules/undici/lib/api/api-upgrade.js +111 -0
- package/dist/node_modules/undici/lib/api/index.js +7 -0
- package/dist/node_modules/undici/lib/api/readable.js +580 -0
- package/dist/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
- package/dist/node_modules/undici/lib/cache/sqlite-cache-store.js +461 -0
- package/dist/node_modules/undici/lib/core/connect.js +137 -0
- package/dist/node_modules/undici/lib/core/constants.js +143 -0
- package/dist/node_modules/undici/lib/core/diagnostics.js +227 -0
- package/dist/node_modules/undici/lib/core/errors.js +477 -0
- package/dist/node_modules/undici/lib/core/request.js +438 -0
- package/dist/node_modules/undici/lib/core/socks5-client.js +407 -0
- package/dist/node_modules/undici/lib/core/socks5-utils.js +203 -0
- package/dist/node_modules/undici/lib/core/symbols.js +75 -0
- package/dist/node_modules/undici/lib/core/tree.js +160 -0
- package/dist/node_modules/undici/lib/core/util.js +992 -0
- package/dist/node_modules/undici/lib/dispatcher/agent.js +158 -0
- package/dist/node_modules/undici/lib/dispatcher/balanced-pool.js +219 -0
- package/dist/node_modules/undici/lib/dispatcher/client-h1.js +1610 -0
- package/dist/node_modules/undici/lib/dispatcher/client-h2.js +995 -0
- package/dist/node_modules/undici/lib/dispatcher/client.js +659 -0
- package/dist/node_modules/undici/lib/dispatcher/dispatcher-base.js +165 -0
- package/dist/node_modules/undici/lib/dispatcher/dispatcher.js +48 -0
- package/dist/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
- package/dist/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
- package/dist/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
- package/dist/node_modules/undici/lib/dispatcher/pool-base.js +214 -0
- package/dist/node_modules/undici/lib/dispatcher/pool.js +118 -0
- package/dist/node_modules/undici/lib/dispatcher/proxy-agent.js +318 -0
- package/dist/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
- package/dist/node_modules/undici/lib/dispatcher/round-robin-pool.js +137 -0
- package/dist/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +249 -0
- package/dist/node_modules/undici/lib/encoding/index.js +33 -0
- package/dist/node_modules/undici/lib/global.js +50 -0
- package/dist/node_modules/undici/lib/handler/cache-handler.js +578 -0
- package/dist/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
- package/dist/node_modules/undici/lib/handler/decorator-handler.js +67 -0
- package/dist/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
- package/dist/node_modules/undici/lib/handler/redirect-handler.js +238 -0
- package/dist/node_modules/undici/lib/handler/retry-handler.js +394 -0
- package/dist/node_modules/undici/lib/handler/unwrap-handler.js +100 -0
- package/dist/node_modules/undici/lib/handler/wrap-handler.js +105 -0
- package/dist/node_modules/undici/lib/interceptor/cache.js +495 -0
- package/dist/node_modules/undici/lib/interceptor/decompress.js +259 -0
- package/dist/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
- package/dist/node_modules/undici/lib/interceptor/dns.js +571 -0
- package/dist/node_modules/undici/lib/interceptor/dump.js +112 -0
- package/dist/node_modules/undici/lib/interceptor/redirect.js +21 -0
- package/dist/node_modules/undici/lib/interceptor/response-error.js +95 -0
- package/dist/node_modules/undici/lib/interceptor/retry.js +19 -0
- package/dist/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/dist/node_modules/undici/lib/llhttp/constants.d.ts +195 -0
- package/dist/node_modules/undici/lib/llhttp/constants.js +531 -0
- package/dist/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
- package/dist/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
- package/dist/node_modules/undici/lib/llhttp/utils.d.ts +2 -0
- package/dist/node_modules/undici/lib/llhttp/utils.js +12 -0
- package/dist/node_modules/undici/lib/mock/mock-agent.js +232 -0
- package/dist/node_modules/undici/lib/mock/mock-call-history.js +248 -0
- package/dist/node_modules/undici/lib/mock/mock-client.js +68 -0
- package/dist/node_modules/undici/lib/mock/mock-errors.js +29 -0
- package/dist/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
- package/dist/node_modules/undici/lib/mock/mock-pool.js +68 -0
- package/dist/node_modules/undici/lib/mock/mock-symbols.js +32 -0
- package/dist/node_modules/undici/lib/mock/mock-utils.js +486 -0
- package/dist/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
- package/dist/node_modules/undici/lib/mock/snapshot-agent.js +353 -0
- package/dist/node_modules/undici/lib/mock/snapshot-recorder.js +588 -0
- package/dist/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
- package/dist/node_modules/undici/lib/util/cache.js +407 -0
- package/dist/node_modules/undici/lib/util/date.js +653 -0
- package/dist/node_modules/undici/lib/util/promise.js +28 -0
- package/dist/node_modules/undici/lib/util/runtime-features.js +124 -0
- package/dist/node_modules/undici/lib/util/stats.js +32 -0
- package/dist/node_modules/undici/lib/util/timers.js +425 -0
- package/dist/node_modules/undici/lib/web/cache/cache.js +864 -0
- package/dist/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
- package/dist/node_modules/undici/lib/web/cache/util.js +45 -0
- package/dist/node_modules/undici/lib/web/cookies/constants.js +12 -0
- package/dist/node_modules/undici/lib/web/cookies/index.js +199 -0
- package/dist/node_modules/undici/lib/web/cookies/parse.js +322 -0
- package/dist/node_modules/undici/lib/web/cookies/util.js +282 -0
- package/dist/node_modules/undici/lib/web/eventsource/eventsource-stream.js +399 -0
- package/dist/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
- package/dist/node_modules/undici/lib/web/eventsource/util.js +29 -0
- package/dist/node_modules/undici/lib/web/fetch/LICENSE +21 -0
- package/dist/node_modules/undici/lib/web/fetch/body.js +509 -0
- package/dist/node_modules/undici/lib/web/fetch/constants.js +131 -0
- package/dist/node_modules/undici/lib/web/fetch/data-url.js +596 -0
- package/dist/node_modules/undici/lib/web/fetch/formdata-parser.js +575 -0
- package/dist/node_modules/undici/lib/web/fetch/formdata.js +259 -0
- package/dist/node_modules/undici/lib/web/fetch/global.js +40 -0
- package/dist/node_modules/undici/lib/web/fetch/headers.js +719 -0
- package/dist/node_modules/undici/lib/web/fetch/index.js +2397 -0
- package/dist/node_modules/undici/lib/web/fetch/request.js +1115 -0
- package/dist/node_modules/undici/lib/web/fetch/response.js +641 -0
- package/dist/node_modules/undici/lib/web/fetch/util.js +1520 -0
- package/dist/node_modules/undici/lib/web/infra/index.js +229 -0
- package/dist/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
- package/dist/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
- package/dist/node_modules/undici/lib/web/webidl/index.js +1006 -0
- package/dist/node_modules/undici/lib/web/websocket/connection.js +329 -0
- package/dist/node_modules/undici/lib/web/websocket/constants.js +126 -0
- package/dist/node_modules/undici/lib/web/websocket/events.js +331 -0
- package/dist/node_modules/undici/lib/web/websocket/frame.js +133 -0
- package/dist/node_modules/undici/lib/web/websocket/permessage-deflate.js +118 -0
- package/dist/node_modules/undici/lib/web/websocket/receiver.js +450 -0
- package/dist/node_modules/undici/lib/web/websocket/sender.js +109 -0
- package/dist/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
- package/dist/node_modules/undici/lib/web/websocket/stream/websocketstream.js +497 -0
- package/dist/node_modules/undici/lib/web/websocket/util.js +347 -0
- package/dist/node_modules/undici/lib/web/websocket/websocket.js +751 -0
- package/dist/node_modules/undici/package.json +152 -0
- package/dist/node_modules/undici/scripts/strip-comments.js +10 -0
- package/dist/node_modules/undici/types/README.md +6 -0
- package/dist/node_modules/undici/types/agent.d.ts +32 -0
- package/dist/node_modules/undici/types/api.d.ts +43 -0
- package/dist/node_modules/undici/types/balanced-pool.d.ts +30 -0
- package/dist/node_modules/undici/types/cache-interceptor.d.ts +179 -0
- package/dist/node_modules/undici/types/cache.d.ts +36 -0
- package/dist/node_modules/undici/types/client-stats.d.ts +15 -0
- package/dist/node_modules/undici/types/client.d.ts +123 -0
- package/dist/node_modules/undici/types/connector.d.ts +36 -0
- package/dist/node_modules/undici/types/content-type.d.ts +21 -0
- package/dist/node_modules/undici/types/cookies.d.ts +30 -0
- package/dist/node_modules/undici/types/diagnostics-channel.d.ts +74 -0
- package/dist/node_modules/undici/types/dispatcher.d.ts +273 -0
- package/dist/node_modules/undici/types/env-http-proxy-agent.d.ts +22 -0
- package/dist/node_modules/undici/types/errors.d.ts +177 -0
- package/dist/node_modules/undici/types/eventsource.d.ts +66 -0
- package/dist/node_modules/undici/types/fetch.d.ts +231 -0
- package/dist/node_modules/undici/types/formdata.d.ts +114 -0
- package/dist/node_modules/undici/types/global-dispatcher.d.ts +9 -0
- package/dist/node_modules/undici/types/global-origin.d.ts +7 -0
- package/dist/node_modules/undici/types/h2c-client.d.ts +73 -0
- package/dist/node_modules/undici/types/handlers.d.ts +14 -0
- package/dist/node_modules/undici/types/header.d.ts +160 -0
- package/dist/node_modules/undici/types/index.d.ts +91 -0
- package/dist/node_modules/undici/types/interceptors.d.ts +80 -0
- package/dist/node_modules/undici/types/mock-agent.d.ts +68 -0
- package/dist/node_modules/undici/types/mock-call-history.d.ts +111 -0
- package/dist/node_modules/undici/types/mock-client.d.ts +27 -0
- package/dist/node_modules/undici/types/mock-errors.d.ts +12 -0
- package/dist/node_modules/undici/types/mock-interceptor.d.ts +94 -0
- package/dist/node_modules/undici/types/mock-pool.d.ts +27 -0
- package/dist/node_modules/undici/types/patch.d.ts +29 -0
- package/dist/node_modules/undici/types/pool-stats.d.ts +19 -0
- package/dist/node_modules/undici/types/pool.d.ts +41 -0
- package/dist/node_modules/undici/types/proxy-agent.d.ts +29 -0
- package/dist/node_modules/undici/types/readable.d.ts +68 -0
- package/dist/node_modules/undici/types/retry-agent.d.ts +8 -0
- package/dist/node_modules/undici/types/retry-handler.d.ts +125 -0
- package/dist/node_modules/undici/types/round-robin-pool.d.ts +41 -0
- package/dist/node_modules/undici/types/snapshot-agent.d.ts +109 -0
- package/dist/node_modules/undici/types/socks5-proxy-agent.d.ts +25 -0
- package/dist/node_modules/undici/types/util.d.ts +18 -0
- package/dist/node_modules/undici/types/utility.d.ts +7 -0
- package/dist/node_modules/undici/types/webidl.d.ts +347 -0
- package/dist/node_modules/undici/types/websocket.d.ts +188 -0
- package/dist/server/plugin.d.ts +1 -0
- package/dist/server/plugin.js +13 -0
- package/dist/server/service.js +11 -3
- package/package.json +2 -2
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SPECIAL_HEADERS = exports.MINOR = exports.MAJOR = exports.HTAB_SP_VCHAR_OBS_TEXT = exports.QUOTED_STRING = exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS = exports.TOKEN = exports.HEX = exports.URL_CHAR = exports.USERINFO_CHARS = exports.MARK = exports.ALPHANUM = exports.NUM = exports.HEX_MAP = exports.NUM_MAP = exports.ALPHA = exports.STATUSES_HTTP = exports.H_METHOD_MAP = exports.METHOD_MAP = exports.METHODS_RTSP = exports.METHODS_ICE = exports.METHODS_HTTP = exports.HEADER_STATE = exports.FINISH = exports.STATUSES = exports.METHODS = exports.LENIENT_FLAGS = exports.FLAGS = exports.TYPE = exports.ERROR = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
// Emums
|
|
6
|
+
exports.ERROR = {
|
|
7
|
+
OK: 0,
|
|
8
|
+
INTERNAL: 1,
|
|
9
|
+
STRICT: 2,
|
|
10
|
+
CR_EXPECTED: 25,
|
|
11
|
+
LF_EXPECTED: 3,
|
|
12
|
+
UNEXPECTED_CONTENT_LENGTH: 4,
|
|
13
|
+
UNEXPECTED_SPACE: 30,
|
|
14
|
+
CLOSED_CONNECTION: 5,
|
|
15
|
+
INVALID_METHOD: 6,
|
|
16
|
+
INVALID_URL: 7,
|
|
17
|
+
INVALID_CONSTANT: 8,
|
|
18
|
+
INVALID_VERSION: 9,
|
|
19
|
+
INVALID_HEADER_TOKEN: 10,
|
|
20
|
+
INVALID_CONTENT_LENGTH: 11,
|
|
21
|
+
INVALID_CHUNK_SIZE: 12,
|
|
22
|
+
INVALID_STATUS: 13,
|
|
23
|
+
INVALID_EOF_STATE: 14,
|
|
24
|
+
INVALID_TRANSFER_ENCODING: 15,
|
|
25
|
+
CB_MESSAGE_BEGIN: 16,
|
|
26
|
+
CB_HEADERS_COMPLETE: 17,
|
|
27
|
+
CB_MESSAGE_COMPLETE: 18,
|
|
28
|
+
CB_CHUNK_HEADER: 19,
|
|
29
|
+
CB_CHUNK_COMPLETE: 20,
|
|
30
|
+
PAUSED: 21,
|
|
31
|
+
PAUSED_UPGRADE: 22,
|
|
32
|
+
PAUSED_H2_UPGRADE: 23,
|
|
33
|
+
USER: 24,
|
|
34
|
+
CB_URL_COMPLETE: 26,
|
|
35
|
+
CB_STATUS_COMPLETE: 27,
|
|
36
|
+
CB_METHOD_COMPLETE: 32,
|
|
37
|
+
CB_VERSION_COMPLETE: 33,
|
|
38
|
+
CB_HEADER_FIELD_COMPLETE: 28,
|
|
39
|
+
CB_HEADER_VALUE_COMPLETE: 29,
|
|
40
|
+
CB_CHUNK_EXTENSION_NAME_COMPLETE: 34,
|
|
41
|
+
CB_CHUNK_EXTENSION_VALUE_COMPLETE: 35,
|
|
42
|
+
CB_RESET: 31,
|
|
43
|
+
CB_PROTOCOL_COMPLETE: 38,
|
|
44
|
+
};
|
|
45
|
+
exports.TYPE = {
|
|
46
|
+
BOTH: 0, // default
|
|
47
|
+
REQUEST: 1,
|
|
48
|
+
RESPONSE: 2,
|
|
49
|
+
};
|
|
50
|
+
exports.FLAGS = {
|
|
51
|
+
CONNECTION_KEEP_ALIVE: 1 << 0,
|
|
52
|
+
CONNECTION_CLOSE: 1 << 1,
|
|
53
|
+
CONNECTION_UPGRADE: 1 << 2,
|
|
54
|
+
CHUNKED: 1 << 3,
|
|
55
|
+
UPGRADE: 1 << 4,
|
|
56
|
+
CONTENT_LENGTH: 1 << 5,
|
|
57
|
+
SKIPBODY: 1 << 6,
|
|
58
|
+
TRAILING: 1 << 7,
|
|
59
|
+
// 1 << 8 is unused
|
|
60
|
+
TRANSFER_ENCODING: 1 << 9,
|
|
61
|
+
};
|
|
62
|
+
exports.LENIENT_FLAGS = {
|
|
63
|
+
HEADERS: 1 << 0,
|
|
64
|
+
CHUNKED_LENGTH: 1 << 1,
|
|
65
|
+
KEEP_ALIVE: 1 << 2,
|
|
66
|
+
TRANSFER_ENCODING: 1 << 3,
|
|
67
|
+
VERSION: 1 << 4,
|
|
68
|
+
DATA_AFTER_CLOSE: 1 << 5,
|
|
69
|
+
OPTIONAL_LF_AFTER_CR: 1 << 6,
|
|
70
|
+
OPTIONAL_CRLF_AFTER_CHUNK: 1 << 7,
|
|
71
|
+
OPTIONAL_CR_BEFORE_LF: 1 << 8,
|
|
72
|
+
SPACES_AFTER_CHUNK_SIZE: 1 << 9,
|
|
73
|
+
};
|
|
74
|
+
exports.METHODS = {
|
|
75
|
+
'DELETE': 0,
|
|
76
|
+
'GET': 1,
|
|
77
|
+
'HEAD': 2,
|
|
78
|
+
'POST': 3,
|
|
79
|
+
'PUT': 4,
|
|
80
|
+
/* pathological */
|
|
81
|
+
'CONNECT': 5,
|
|
82
|
+
'OPTIONS': 6,
|
|
83
|
+
'TRACE': 7,
|
|
84
|
+
/* WebDAV */
|
|
85
|
+
'COPY': 8,
|
|
86
|
+
'LOCK': 9,
|
|
87
|
+
'MKCOL': 10,
|
|
88
|
+
'MOVE': 11,
|
|
89
|
+
'PROPFIND': 12,
|
|
90
|
+
'PROPPATCH': 13,
|
|
91
|
+
'SEARCH': 14,
|
|
92
|
+
'UNLOCK': 15,
|
|
93
|
+
'BIND': 16,
|
|
94
|
+
'REBIND': 17,
|
|
95
|
+
'UNBIND': 18,
|
|
96
|
+
'ACL': 19,
|
|
97
|
+
/* subversion */
|
|
98
|
+
'REPORT': 20,
|
|
99
|
+
'MKACTIVITY': 21,
|
|
100
|
+
'CHECKOUT': 22,
|
|
101
|
+
'MERGE': 23,
|
|
102
|
+
/* upnp */
|
|
103
|
+
'M-SEARCH': 24,
|
|
104
|
+
'NOTIFY': 25,
|
|
105
|
+
'SUBSCRIBE': 26,
|
|
106
|
+
'UNSUBSCRIBE': 27,
|
|
107
|
+
/* RFC-5789 */
|
|
108
|
+
'PATCH': 28,
|
|
109
|
+
'PURGE': 29,
|
|
110
|
+
/* CalDAV */
|
|
111
|
+
'MKCALENDAR': 30,
|
|
112
|
+
/* RFC-2068, section 19.6.1.2 */
|
|
113
|
+
'LINK': 31,
|
|
114
|
+
'UNLINK': 32,
|
|
115
|
+
/* icecast */
|
|
116
|
+
'SOURCE': 33,
|
|
117
|
+
/* RFC-7540, section 11.6 */
|
|
118
|
+
'PRI': 34,
|
|
119
|
+
/* RFC-2326 RTSP */
|
|
120
|
+
'DESCRIBE': 35,
|
|
121
|
+
'ANNOUNCE': 36,
|
|
122
|
+
'SETUP': 37,
|
|
123
|
+
'PLAY': 38,
|
|
124
|
+
'PAUSE': 39,
|
|
125
|
+
'TEARDOWN': 40,
|
|
126
|
+
'GET_PARAMETER': 41,
|
|
127
|
+
'SET_PARAMETER': 42,
|
|
128
|
+
'REDIRECT': 43,
|
|
129
|
+
'RECORD': 44,
|
|
130
|
+
/* RAOP */
|
|
131
|
+
'FLUSH': 45,
|
|
132
|
+
/* DRAFT https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-02.html */
|
|
133
|
+
'QUERY': 46,
|
|
134
|
+
};
|
|
135
|
+
exports.STATUSES = {
|
|
136
|
+
CONTINUE: 100,
|
|
137
|
+
SWITCHING_PROTOCOLS: 101,
|
|
138
|
+
PROCESSING: 102,
|
|
139
|
+
EARLY_HINTS: 103,
|
|
140
|
+
RESPONSE_IS_STALE: 110, // Unofficial
|
|
141
|
+
REVALIDATION_FAILED: 111, // Unofficial
|
|
142
|
+
DISCONNECTED_OPERATION: 112, // Unofficial
|
|
143
|
+
HEURISTIC_EXPIRATION: 113, // Unofficial
|
|
144
|
+
MISCELLANEOUS_WARNING: 199, // Unofficial
|
|
145
|
+
OK: 200,
|
|
146
|
+
CREATED: 201,
|
|
147
|
+
ACCEPTED: 202,
|
|
148
|
+
NON_AUTHORITATIVE_INFORMATION: 203,
|
|
149
|
+
NO_CONTENT: 204,
|
|
150
|
+
RESET_CONTENT: 205,
|
|
151
|
+
PARTIAL_CONTENT: 206,
|
|
152
|
+
MULTI_STATUS: 207,
|
|
153
|
+
ALREADY_REPORTED: 208,
|
|
154
|
+
TRANSFORMATION_APPLIED: 214, // Unofficial
|
|
155
|
+
IM_USED: 226,
|
|
156
|
+
MISCELLANEOUS_PERSISTENT_WARNING: 299, // Unofficial
|
|
157
|
+
MULTIPLE_CHOICES: 300,
|
|
158
|
+
MOVED_PERMANENTLY: 301,
|
|
159
|
+
FOUND: 302,
|
|
160
|
+
SEE_OTHER: 303,
|
|
161
|
+
NOT_MODIFIED: 304,
|
|
162
|
+
USE_PROXY: 305,
|
|
163
|
+
SWITCH_PROXY: 306, // No longer used
|
|
164
|
+
TEMPORARY_REDIRECT: 307,
|
|
165
|
+
PERMANENT_REDIRECT: 308,
|
|
166
|
+
BAD_REQUEST: 400,
|
|
167
|
+
UNAUTHORIZED: 401,
|
|
168
|
+
PAYMENT_REQUIRED: 402,
|
|
169
|
+
FORBIDDEN: 403,
|
|
170
|
+
NOT_FOUND: 404,
|
|
171
|
+
METHOD_NOT_ALLOWED: 405,
|
|
172
|
+
NOT_ACCEPTABLE: 406,
|
|
173
|
+
PROXY_AUTHENTICATION_REQUIRED: 407,
|
|
174
|
+
REQUEST_TIMEOUT: 408,
|
|
175
|
+
CONFLICT: 409,
|
|
176
|
+
GONE: 410,
|
|
177
|
+
LENGTH_REQUIRED: 411,
|
|
178
|
+
PRECONDITION_FAILED: 412,
|
|
179
|
+
PAYLOAD_TOO_LARGE: 413,
|
|
180
|
+
URI_TOO_LONG: 414,
|
|
181
|
+
UNSUPPORTED_MEDIA_TYPE: 415,
|
|
182
|
+
RANGE_NOT_SATISFIABLE: 416,
|
|
183
|
+
EXPECTATION_FAILED: 417,
|
|
184
|
+
IM_A_TEAPOT: 418,
|
|
185
|
+
PAGE_EXPIRED: 419, // Unofficial
|
|
186
|
+
ENHANCE_YOUR_CALM: 420, // Unofficial
|
|
187
|
+
MISDIRECTED_REQUEST: 421,
|
|
188
|
+
UNPROCESSABLE_ENTITY: 422,
|
|
189
|
+
LOCKED: 423,
|
|
190
|
+
FAILED_DEPENDENCY: 424,
|
|
191
|
+
TOO_EARLY: 425,
|
|
192
|
+
UPGRADE_REQUIRED: 426,
|
|
193
|
+
PRECONDITION_REQUIRED: 428,
|
|
194
|
+
TOO_MANY_REQUESTS: 429,
|
|
195
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL: 430, // Unofficial
|
|
196
|
+
REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
|
|
197
|
+
LOGIN_TIMEOUT: 440, // Unofficial
|
|
198
|
+
NO_RESPONSE: 444, // Unofficial
|
|
199
|
+
RETRY_WITH: 449, // Unofficial
|
|
200
|
+
BLOCKED_BY_PARENTAL_CONTROL: 450, // Unofficial
|
|
201
|
+
UNAVAILABLE_FOR_LEGAL_REASONS: 451,
|
|
202
|
+
CLIENT_CLOSED_LOAD_BALANCED_REQUEST: 460, // Unofficial
|
|
203
|
+
INVALID_X_FORWARDED_FOR: 463, // Unofficial
|
|
204
|
+
REQUEST_HEADER_TOO_LARGE: 494, // Unofficial
|
|
205
|
+
SSL_CERTIFICATE_ERROR: 495, // Unofficial
|
|
206
|
+
SSL_CERTIFICATE_REQUIRED: 496, // Unofficial
|
|
207
|
+
HTTP_REQUEST_SENT_TO_HTTPS_PORT: 497, // Unofficial
|
|
208
|
+
INVALID_TOKEN: 498, // Unofficial
|
|
209
|
+
CLIENT_CLOSED_REQUEST: 499, // Unofficial
|
|
210
|
+
INTERNAL_SERVER_ERROR: 500,
|
|
211
|
+
NOT_IMPLEMENTED: 501,
|
|
212
|
+
BAD_GATEWAY: 502,
|
|
213
|
+
SERVICE_UNAVAILABLE: 503,
|
|
214
|
+
GATEWAY_TIMEOUT: 504,
|
|
215
|
+
HTTP_VERSION_NOT_SUPPORTED: 505,
|
|
216
|
+
VARIANT_ALSO_NEGOTIATES: 506,
|
|
217
|
+
INSUFFICIENT_STORAGE: 507,
|
|
218
|
+
LOOP_DETECTED: 508,
|
|
219
|
+
BANDWIDTH_LIMIT_EXCEEDED: 509,
|
|
220
|
+
NOT_EXTENDED: 510,
|
|
221
|
+
NETWORK_AUTHENTICATION_REQUIRED: 511,
|
|
222
|
+
WEB_SERVER_UNKNOWN_ERROR: 520, // Unofficial
|
|
223
|
+
WEB_SERVER_IS_DOWN: 521, // Unofficial
|
|
224
|
+
CONNECTION_TIMEOUT: 522, // Unofficial
|
|
225
|
+
ORIGIN_IS_UNREACHABLE: 523, // Unofficial
|
|
226
|
+
TIMEOUT_OCCURED: 524, // Unofficial
|
|
227
|
+
SSL_HANDSHAKE_FAILED: 525, // Unofficial
|
|
228
|
+
INVALID_SSL_CERTIFICATE: 526, // Unofficial
|
|
229
|
+
RAILGUN_ERROR: 527, // Unofficial
|
|
230
|
+
SITE_IS_OVERLOADED: 529, // Unofficial
|
|
231
|
+
SITE_IS_FROZEN: 530, // Unofficial
|
|
232
|
+
IDENTITY_PROVIDER_AUTHENTICATION_ERROR: 561, // Unofficial
|
|
233
|
+
NETWORK_READ_TIMEOUT: 598, // Unofficial
|
|
234
|
+
NETWORK_CONNECT_TIMEOUT: 599, // Unofficial
|
|
235
|
+
};
|
|
236
|
+
exports.FINISH = {
|
|
237
|
+
SAFE: 0,
|
|
238
|
+
SAFE_WITH_CB: 1,
|
|
239
|
+
UNSAFE: 2,
|
|
240
|
+
};
|
|
241
|
+
exports.HEADER_STATE = {
|
|
242
|
+
GENERAL: 0,
|
|
243
|
+
CONNECTION: 1,
|
|
244
|
+
CONTENT_LENGTH: 2,
|
|
245
|
+
TRANSFER_ENCODING: 3,
|
|
246
|
+
UPGRADE: 4,
|
|
247
|
+
CONNECTION_KEEP_ALIVE: 5,
|
|
248
|
+
CONNECTION_CLOSE: 6,
|
|
249
|
+
CONNECTION_UPGRADE: 7,
|
|
250
|
+
TRANSFER_ENCODING_CHUNKED: 8,
|
|
251
|
+
};
|
|
252
|
+
// C headers
|
|
253
|
+
exports.METHODS_HTTP = [
|
|
254
|
+
exports.METHODS.DELETE,
|
|
255
|
+
exports.METHODS.GET,
|
|
256
|
+
exports.METHODS.HEAD,
|
|
257
|
+
exports.METHODS.POST,
|
|
258
|
+
exports.METHODS.PUT,
|
|
259
|
+
exports.METHODS.CONNECT,
|
|
260
|
+
exports.METHODS.OPTIONS,
|
|
261
|
+
exports.METHODS.TRACE,
|
|
262
|
+
exports.METHODS.COPY,
|
|
263
|
+
exports.METHODS.LOCK,
|
|
264
|
+
exports.METHODS.MKCOL,
|
|
265
|
+
exports.METHODS.MOVE,
|
|
266
|
+
exports.METHODS.PROPFIND,
|
|
267
|
+
exports.METHODS.PROPPATCH,
|
|
268
|
+
exports.METHODS.SEARCH,
|
|
269
|
+
exports.METHODS.UNLOCK,
|
|
270
|
+
exports.METHODS.BIND,
|
|
271
|
+
exports.METHODS.REBIND,
|
|
272
|
+
exports.METHODS.UNBIND,
|
|
273
|
+
exports.METHODS.ACL,
|
|
274
|
+
exports.METHODS.REPORT,
|
|
275
|
+
exports.METHODS.MKACTIVITY,
|
|
276
|
+
exports.METHODS.CHECKOUT,
|
|
277
|
+
exports.METHODS.MERGE,
|
|
278
|
+
exports.METHODS['M-SEARCH'],
|
|
279
|
+
exports.METHODS.NOTIFY,
|
|
280
|
+
exports.METHODS.SUBSCRIBE,
|
|
281
|
+
exports.METHODS.UNSUBSCRIBE,
|
|
282
|
+
exports.METHODS.PATCH,
|
|
283
|
+
exports.METHODS.PURGE,
|
|
284
|
+
exports.METHODS.MKCALENDAR,
|
|
285
|
+
exports.METHODS.LINK,
|
|
286
|
+
exports.METHODS.UNLINK,
|
|
287
|
+
exports.METHODS.PRI,
|
|
288
|
+
// TODO(indutny): should we allow it with HTTP?
|
|
289
|
+
exports.METHODS.SOURCE,
|
|
290
|
+
exports.METHODS.QUERY,
|
|
291
|
+
];
|
|
292
|
+
exports.METHODS_ICE = [
|
|
293
|
+
exports.METHODS.SOURCE,
|
|
294
|
+
];
|
|
295
|
+
exports.METHODS_RTSP = [
|
|
296
|
+
exports.METHODS.OPTIONS,
|
|
297
|
+
exports.METHODS.DESCRIBE,
|
|
298
|
+
exports.METHODS.ANNOUNCE,
|
|
299
|
+
exports.METHODS.SETUP,
|
|
300
|
+
exports.METHODS.PLAY,
|
|
301
|
+
exports.METHODS.PAUSE,
|
|
302
|
+
exports.METHODS.TEARDOWN,
|
|
303
|
+
exports.METHODS.GET_PARAMETER,
|
|
304
|
+
exports.METHODS.SET_PARAMETER,
|
|
305
|
+
exports.METHODS.REDIRECT,
|
|
306
|
+
exports.METHODS.RECORD,
|
|
307
|
+
exports.METHODS.FLUSH,
|
|
308
|
+
// For AirPlay
|
|
309
|
+
exports.METHODS.GET,
|
|
310
|
+
exports.METHODS.POST,
|
|
311
|
+
];
|
|
312
|
+
exports.METHOD_MAP = (0, utils_1.enumToMap)(exports.METHODS);
|
|
313
|
+
exports.H_METHOD_MAP = Object.fromEntries(Object.entries(exports.METHODS).filter(([k]) => k.startsWith('H')));
|
|
314
|
+
exports.STATUSES_HTTP = [
|
|
315
|
+
exports.STATUSES.CONTINUE,
|
|
316
|
+
exports.STATUSES.SWITCHING_PROTOCOLS,
|
|
317
|
+
exports.STATUSES.PROCESSING,
|
|
318
|
+
exports.STATUSES.EARLY_HINTS,
|
|
319
|
+
exports.STATUSES.RESPONSE_IS_STALE,
|
|
320
|
+
exports.STATUSES.REVALIDATION_FAILED,
|
|
321
|
+
exports.STATUSES.DISCONNECTED_OPERATION,
|
|
322
|
+
exports.STATUSES.HEURISTIC_EXPIRATION,
|
|
323
|
+
exports.STATUSES.MISCELLANEOUS_WARNING,
|
|
324
|
+
exports.STATUSES.OK,
|
|
325
|
+
exports.STATUSES.CREATED,
|
|
326
|
+
exports.STATUSES.ACCEPTED,
|
|
327
|
+
exports.STATUSES.NON_AUTHORITATIVE_INFORMATION,
|
|
328
|
+
exports.STATUSES.NO_CONTENT,
|
|
329
|
+
exports.STATUSES.RESET_CONTENT,
|
|
330
|
+
exports.STATUSES.PARTIAL_CONTENT,
|
|
331
|
+
exports.STATUSES.MULTI_STATUS,
|
|
332
|
+
exports.STATUSES.ALREADY_REPORTED,
|
|
333
|
+
exports.STATUSES.TRANSFORMATION_APPLIED,
|
|
334
|
+
exports.STATUSES.IM_USED,
|
|
335
|
+
exports.STATUSES.MISCELLANEOUS_PERSISTENT_WARNING,
|
|
336
|
+
exports.STATUSES.MULTIPLE_CHOICES,
|
|
337
|
+
exports.STATUSES.MOVED_PERMANENTLY,
|
|
338
|
+
exports.STATUSES.FOUND,
|
|
339
|
+
exports.STATUSES.SEE_OTHER,
|
|
340
|
+
exports.STATUSES.NOT_MODIFIED,
|
|
341
|
+
exports.STATUSES.USE_PROXY,
|
|
342
|
+
exports.STATUSES.SWITCH_PROXY,
|
|
343
|
+
exports.STATUSES.TEMPORARY_REDIRECT,
|
|
344
|
+
exports.STATUSES.PERMANENT_REDIRECT,
|
|
345
|
+
exports.STATUSES.BAD_REQUEST,
|
|
346
|
+
exports.STATUSES.UNAUTHORIZED,
|
|
347
|
+
exports.STATUSES.PAYMENT_REQUIRED,
|
|
348
|
+
exports.STATUSES.FORBIDDEN,
|
|
349
|
+
exports.STATUSES.NOT_FOUND,
|
|
350
|
+
exports.STATUSES.METHOD_NOT_ALLOWED,
|
|
351
|
+
exports.STATUSES.NOT_ACCEPTABLE,
|
|
352
|
+
exports.STATUSES.PROXY_AUTHENTICATION_REQUIRED,
|
|
353
|
+
exports.STATUSES.REQUEST_TIMEOUT,
|
|
354
|
+
exports.STATUSES.CONFLICT,
|
|
355
|
+
exports.STATUSES.GONE,
|
|
356
|
+
exports.STATUSES.LENGTH_REQUIRED,
|
|
357
|
+
exports.STATUSES.PRECONDITION_FAILED,
|
|
358
|
+
exports.STATUSES.PAYLOAD_TOO_LARGE,
|
|
359
|
+
exports.STATUSES.URI_TOO_LONG,
|
|
360
|
+
exports.STATUSES.UNSUPPORTED_MEDIA_TYPE,
|
|
361
|
+
exports.STATUSES.RANGE_NOT_SATISFIABLE,
|
|
362
|
+
exports.STATUSES.EXPECTATION_FAILED,
|
|
363
|
+
exports.STATUSES.IM_A_TEAPOT,
|
|
364
|
+
exports.STATUSES.PAGE_EXPIRED,
|
|
365
|
+
exports.STATUSES.ENHANCE_YOUR_CALM,
|
|
366
|
+
exports.STATUSES.MISDIRECTED_REQUEST,
|
|
367
|
+
exports.STATUSES.UNPROCESSABLE_ENTITY,
|
|
368
|
+
exports.STATUSES.LOCKED,
|
|
369
|
+
exports.STATUSES.FAILED_DEPENDENCY,
|
|
370
|
+
exports.STATUSES.TOO_EARLY,
|
|
371
|
+
exports.STATUSES.UPGRADE_REQUIRED,
|
|
372
|
+
exports.STATUSES.PRECONDITION_REQUIRED,
|
|
373
|
+
exports.STATUSES.TOO_MANY_REQUESTS,
|
|
374
|
+
exports.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL,
|
|
375
|
+
exports.STATUSES.REQUEST_HEADER_FIELDS_TOO_LARGE,
|
|
376
|
+
exports.STATUSES.LOGIN_TIMEOUT,
|
|
377
|
+
exports.STATUSES.NO_RESPONSE,
|
|
378
|
+
exports.STATUSES.RETRY_WITH,
|
|
379
|
+
exports.STATUSES.BLOCKED_BY_PARENTAL_CONTROL,
|
|
380
|
+
exports.STATUSES.UNAVAILABLE_FOR_LEGAL_REASONS,
|
|
381
|
+
exports.STATUSES.CLIENT_CLOSED_LOAD_BALANCED_REQUEST,
|
|
382
|
+
exports.STATUSES.INVALID_X_FORWARDED_FOR,
|
|
383
|
+
exports.STATUSES.REQUEST_HEADER_TOO_LARGE,
|
|
384
|
+
exports.STATUSES.SSL_CERTIFICATE_ERROR,
|
|
385
|
+
exports.STATUSES.SSL_CERTIFICATE_REQUIRED,
|
|
386
|
+
exports.STATUSES.HTTP_REQUEST_SENT_TO_HTTPS_PORT,
|
|
387
|
+
exports.STATUSES.INVALID_TOKEN,
|
|
388
|
+
exports.STATUSES.CLIENT_CLOSED_REQUEST,
|
|
389
|
+
exports.STATUSES.INTERNAL_SERVER_ERROR,
|
|
390
|
+
exports.STATUSES.NOT_IMPLEMENTED,
|
|
391
|
+
exports.STATUSES.BAD_GATEWAY,
|
|
392
|
+
exports.STATUSES.SERVICE_UNAVAILABLE,
|
|
393
|
+
exports.STATUSES.GATEWAY_TIMEOUT,
|
|
394
|
+
exports.STATUSES.HTTP_VERSION_NOT_SUPPORTED,
|
|
395
|
+
exports.STATUSES.VARIANT_ALSO_NEGOTIATES,
|
|
396
|
+
exports.STATUSES.INSUFFICIENT_STORAGE,
|
|
397
|
+
exports.STATUSES.LOOP_DETECTED,
|
|
398
|
+
exports.STATUSES.BANDWIDTH_LIMIT_EXCEEDED,
|
|
399
|
+
exports.STATUSES.NOT_EXTENDED,
|
|
400
|
+
exports.STATUSES.NETWORK_AUTHENTICATION_REQUIRED,
|
|
401
|
+
exports.STATUSES.WEB_SERVER_UNKNOWN_ERROR,
|
|
402
|
+
exports.STATUSES.WEB_SERVER_IS_DOWN,
|
|
403
|
+
exports.STATUSES.CONNECTION_TIMEOUT,
|
|
404
|
+
exports.STATUSES.ORIGIN_IS_UNREACHABLE,
|
|
405
|
+
exports.STATUSES.TIMEOUT_OCCURED,
|
|
406
|
+
exports.STATUSES.SSL_HANDSHAKE_FAILED,
|
|
407
|
+
exports.STATUSES.INVALID_SSL_CERTIFICATE,
|
|
408
|
+
exports.STATUSES.RAILGUN_ERROR,
|
|
409
|
+
exports.STATUSES.SITE_IS_OVERLOADED,
|
|
410
|
+
exports.STATUSES.SITE_IS_FROZEN,
|
|
411
|
+
exports.STATUSES.IDENTITY_PROVIDER_AUTHENTICATION_ERROR,
|
|
412
|
+
exports.STATUSES.NETWORK_READ_TIMEOUT,
|
|
413
|
+
exports.STATUSES.NETWORK_CONNECT_TIMEOUT,
|
|
414
|
+
];
|
|
415
|
+
exports.ALPHA = [];
|
|
416
|
+
for (let i = 'A'.charCodeAt(0); i <= 'Z'.charCodeAt(0); i++) {
|
|
417
|
+
// Upper case
|
|
418
|
+
exports.ALPHA.push(String.fromCharCode(i));
|
|
419
|
+
// Lower case
|
|
420
|
+
exports.ALPHA.push(String.fromCharCode(i + 0x20));
|
|
421
|
+
}
|
|
422
|
+
exports.NUM_MAP = {
|
|
423
|
+
0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
|
|
424
|
+
5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
|
|
425
|
+
};
|
|
426
|
+
exports.HEX_MAP = {
|
|
427
|
+
0: 0, 1: 1, 2: 2, 3: 3, 4: 4,
|
|
428
|
+
5: 5, 6: 6, 7: 7, 8: 8, 9: 9,
|
|
429
|
+
A: 0XA, B: 0XB, C: 0XC, D: 0XD, E: 0XE, F: 0XF,
|
|
430
|
+
a: 0xa, b: 0xb, c: 0xc, d: 0xd, e: 0xe, f: 0xf,
|
|
431
|
+
};
|
|
432
|
+
exports.NUM = [
|
|
433
|
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
|
434
|
+
];
|
|
435
|
+
exports.ALPHANUM = exports.ALPHA.concat(exports.NUM);
|
|
436
|
+
exports.MARK = ['-', '_', '.', '!', '~', '*', '\'', '(', ')'];
|
|
437
|
+
exports.USERINFO_CHARS = exports.ALPHANUM
|
|
438
|
+
.concat(exports.MARK)
|
|
439
|
+
.concat(['%', ';', ':', '&', '=', '+', '$', ',']);
|
|
440
|
+
// TODO(indutny): use RFC
|
|
441
|
+
exports.URL_CHAR = [
|
|
442
|
+
'!', '"', '$', '%', '&', '\'',
|
|
443
|
+
'(', ')', '*', '+', ',', '-', '.', '/',
|
|
444
|
+
':', ';', '<', '=', '>',
|
|
445
|
+
'@', '[', '\\', ']', '^', '_',
|
|
446
|
+
'`',
|
|
447
|
+
'{', '|', '}', '~',
|
|
448
|
+
].concat(exports.ALPHANUM);
|
|
449
|
+
exports.HEX = exports.NUM.concat(['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']);
|
|
450
|
+
/* Tokens as defined by rfc 2616. Also lowercases them.
|
|
451
|
+
* token = 1*<any CHAR except CTLs or separators>
|
|
452
|
+
* separators = "(" | ")" | "<" | ">" | "@"
|
|
453
|
+
* | "," | ";" | ":" | "\" | <">
|
|
454
|
+
* | "/" | "[" | "]" | "?" | "="
|
|
455
|
+
* | "{" | "}" | SP | HT
|
|
456
|
+
*/
|
|
457
|
+
exports.TOKEN = [
|
|
458
|
+
'!', '#', '$', '%', '&', '\'',
|
|
459
|
+
'*', '+', '-', '.',
|
|
460
|
+
'^', '_', '`',
|
|
461
|
+
'|', '~',
|
|
462
|
+
].concat(exports.ALPHANUM);
|
|
463
|
+
/*
|
|
464
|
+
* Verify that a char is a valid visible (printable) US-ASCII
|
|
465
|
+
* character or %x80-FF
|
|
466
|
+
*/
|
|
467
|
+
exports.HEADER_CHARS = ['\t'];
|
|
468
|
+
for (let i = 32; i <= 255; i++) {
|
|
469
|
+
if (i !== 127) {
|
|
470
|
+
exports.HEADER_CHARS.push(i);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
// ',' = \x44
|
|
474
|
+
exports.CONNECTION_TOKEN_CHARS = exports.HEADER_CHARS.filter((c) => c !== 44);
|
|
475
|
+
exports.QUOTED_STRING = ['\t', ' '];
|
|
476
|
+
for (let i = 0x21; i <= 0xff; i++) {
|
|
477
|
+
if (i !== 0x22 && i !== 0x5c) { // All characters in ASCII except \ and "
|
|
478
|
+
exports.QUOTED_STRING.push(i);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
exports.HTAB_SP_VCHAR_OBS_TEXT = ['\t', ' '];
|
|
482
|
+
// VCHAR: https://tools.ietf.org/html/rfc5234#appendix-B.1
|
|
483
|
+
for (let i = 0x21; i <= 0x7E; i++) {
|
|
484
|
+
exports.HTAB_SP_VCHAR_OBS_TEXT.push(i);
|
|
485
|
+
}
|
|
486
|
+
// OBS_TEXT: https://datatracker.ietf.org/doc/html/rfc9110#name-collected-abnf
|
|
487
|
+
for (let i = 0x80; i <= 0xff; i++) {
|
|
488
|
+
exports.HTAB_SP_VCHAR_OBS_TEXT.push(i);
|
|
489
|
+
}
|
|
490
|
+
exports.MAJOR = exports.NUM_MAP;
|
|
491
|
+
exports.MINOR = exports.MAJOR;
|
|
492
|
+
exports.SPECIAL_HEADERS = {
|
|
493
|
+
'connection': exports.HEADER_STATE.CONNECTION,
|
|
494
|
+
'content-length': exports.HEADER_STATE.CONTENT_LENGTH,
|
|
495
|
+
'proxy-connection': exports.HEADER_STATE.CONNECTION,
|
|
496
|
+
'transfer-encoding': exports.HEADER_STATE.TRANSFER_ENCODING,
|
|
497
|
+
'upgrade': exports.HEADER_STATE.UPGRADE,
|
|
498
|
+
};
|
|
499
|
+
exports.default = {
|
|
500
|
+
ERROR: exports.ERROR,
|
|
501
|
+
TYPE: exports.TYPE,
|
|
502
|
+
FLAGS: exports.FLAGS,
|
|
503
|
+
LENIENT_FLAGS: exports.LENIENT_FLAGS,
|
|
504
|
+
METHODS: exports.METHODS,
|
|
505
|
+
STATUSES: exports.STATUSES,
|
|
506
|
+
FINISH: exports.FINISH,
|
|
507
|
+
HEADER_STATE: exports.HEADER_STATE,
|
|
508
|
+
ALPHA: exports.ALPHA,
|
|
509
|
+
NUM_MAP: exports.NUM_MAP,
|
|
510
|
+
HEX_MAP: exports.HEX_MAP,
|
|
511
|
+
NUM: exports.NUM,
|
|
512
|
+
ALPHANUM: exports.ALPHANUM,
|
|
513
|
+
MARK: exports.MARK,
|
|
514
|
+
USERINFO_CHARS: exports.USERINFO_CHARS,
|
|
515
|
+
URL_CHAR: exports.URL_CHAR,
|
|
516
|
+
HEX: exports.HEX,
|
|
517
|
+
TOKEN: exports.TOKEN,
|
|
518
|
+
HEADER_CHARS: exports.HEADER_CHARS,
|
|
519
|
+
CONNECTION_TOKEN_CHARS: exports.CONNECTION_TOKEN_CHARS,
|
|
520
|
+
QUOTED_STRING: exports.QUOTED_STRING,
|
|
521
|
+
HTAB_SP_VCHAR_OBS_TEXT: exports.HTAB_SP_VCHAR_OBS_TEXT,
|
|
522
|
+
MAJOR: exports.MAJOR,
|
|
523
|
+
MINOR: exports.MINOR,
|
|
524
|
+
SPECIAL_HEADERS: exports.SPECIAL_HEADERS,
|
|
525
|
+
METHODS_HTTP: exports.METHODS_HTTP,
|
|
526
|
+
METHODS_ICE: exports.METHODS_ICE,
|
|
527
|
+
METHODS_RTSP: exports.METHODS_RTSP,
|
|
528
|
+
METHOD_MAP: exports.METHOD_MAP,
|
|
529
|
+
H_METHOD_MAP: exports.H_METHOD_MAP,
|
|
530
|
+
STATUSES_HTTP: exports.STATUSES_HTTP,
|
|
531
|
+
};
|