summaryrefslogtreecommitdiff
path: root/includes/external/pair/node_modules/ws/lib/subprotocol.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
commit5860551daa0f60103ad24e93da29f401a653f144 (patch)
tree9ad97e04152a6edc11d5096c87880978df39086a /includes/external/pair/node_modules/ws/lib/subprotocol.js
parenta51979ad60074db84af78a06d30fcb888ccb0b03 (diff)
downloadpluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'includes/external/pair/node_modules/ws/lib/subprotocol.js')
-rw-r--r--includes/external/pair/node_modules/ws/lib/subprotocol.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/includes/external/pair/node_modules/ws/lib/subprotocol.js b/includes/external/pair/node_modules/ws/lib/subprotocol.js
deleted file mode 100644
index d4381e8..0000000
--- a/includes/external/pair/node_modules/ws/lib/subprotocol.js
+++ /dev/null
@@ -1,62 +0,0 @@
-'use strict';
-
-const { tokenChars } = require('./validation');
-
-/**
- * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
- *
- * @param {String} header The field value of the header
- * @return {Set} The subprotocol names
- * @public
- */
-function parse(header) {
- const protocols = new Set();
- let start = -1;
- let end = -1;
- let i = 0;
-
- for (i; i < header.length; i++) {
- const code = header.charCodeAt(i);
-
- if (end === -1 && tokenChars[code] === 1) {
- if (start === -1) start = i;
- } else if (
- i !== 0 &&
- (code === 0x20 /* ' ' */ || code === 0x09) /* '\t' */
- ) {
- if (end === -1 && start !== -1) end = i;
- } else if (code === 0x2c /* ',' */) {
- if (start === -1) {
- throw new SyntaxError(`Unexpected character at index ${i}`);
- }
-
- if (end === -1) end = i;
-
- const protocol = header.slice(start, end);
-
- if (protocols.has(protocol)) {
- throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
- }
-
- protocols.add(protocol);
- start = end = -1;
- } else {
- throw new SyntaxError(`Unexpected character at index ${i}`);
- }
- }
-
- if (start === -1 || end !== -1) {
- throw new SyntaxError('Unexpected end of input');
- }
-
- const protocol = header.slice(start, i);
-
- if (protocols.has(protocol)) {
- throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
- }
-
- protocols.add(protocol);
- return protocols;
-}
-
-module.exports = { parse };