Updated the files.
This commit is contained in:
parent
1553e6b971
commit
753967d4f5
23418 changed files with 3784666 additions and 0 deletions
7
my-app/node_modules/engine.io/build/transports-uws/index.d.ts
generated
vendored
Executable file
7
my-app/node_modules/engine.io/build/transports-uws/index.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,7 @@
|
|||
import { Polling } from "./polling";
|
||||
import { WebSocket } from "./websocket";
|
||||
declare const _default: {
|
||||
polling: typeof Polling;
|
||||
websocket: typeof WebSocket;
|
||||
};
|
||||
export default _default;
|
8
my-app/node_modules/engine.io/build/transports-uws/index.js
generated
vendored
Executable file
8
my-app/node_modules/engine.io/build/transports-uws/index.js
generated
vendored
Executable file
|
@ -0,0 +1,8 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const polling_1 = require("./polling");
|
||||
const websocket_1 = require("./websocket");
|
||||
exports.default = {
|
||||
polling: polling_1.Polling,
|
||||
websocket: websocket_1.WebSocket,
|
||||
};
|
103
my-app/node_modules/engine.io/build/transports-uws/polling.d.ts
generated
vendored
Executable file
103
my-app/node_modules/engine.io/build/transports-uws/polling.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,103 @@
|
|||
import { Transport } from "../transport";
|
||||
export declare class Polling extends Transport {
|
||||
maxHttpBufferSize: number;
|
||||
httpCompression: any;
|
||||
private res;
|
||||
private dataReq;
|
||||
private dataRes;
|
||||
private shouldClose;
|
||||
private readonly closeTimeout;
|
||||
/**
|
||||
* HTTP polling constructor.
|
||||
*
|
||||
* @api public.
|
||||
*/
|
||||
constructor(req: any);
|
||||
/**
|
||||
* Transport name
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get name(): string;
|
||||
get supportsFraming(): boolean;
|
||||
/**
|
||||
* Overrides onRequest.
|
||||
*
|
||||
* @param req
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onRequest(req: any): void;
|
||||
/**
|
||||
* The client sends a request awaiting for us to send data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onPollRequest(req: any, res: any): void;
|
||||
/**
|
||||
* The client sends a request with data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onDataRequest(req: any, res: any): void;
|
||||
/**
|
||||
* Cleanup request.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
private onDataRequestCleanup;
|
||||
/**
|
||||
* Processes the incoming data payload.
|
||||
*
|
||||
* @param {String} encoded payload
|
||||
* @api private
|
||||
*/
|
||||
onData(data: any): void;
|
||||
/**
|
||||
* Overrides onClose.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onClose(): void;
|
||||
/**
|
||||
* Writes a packet payload.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
send(packets: any): void;
|
||||
/**
|
||||
* Writes data as response to poll request.
|
||||
*
|
||||
* @param {String} data
|
||||
* @param {Object} options
|
||||
* @api private
|
||||
*/
|
||||
write(data: any, options: any): void;
|
||||
/**
|
||||
* Performs the write.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
doWrite(data: any, options: any, callback: any): void;
|
||||
/**
|
||||
* Compresses data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
compress(data: any, encoding: any, callback: any): void;
|
||||
/**
|
||||
* Closes the transport.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
doClose(fn: any): void;
|
||||
/**
|
||||
* Returns headers for a response.
|
||||
*
|
||||
* @param req - request
|
||||
* @param {Object} extra headers
|
||||
* @api private
|
||||
*/
|
||||
headers(req: any, headers: any): any;
|
||||
}
|
370
my-app/node_modules/engine.io/build/transports-uws/polling.js
generated
vendored
Executable file
370
my-app/node_modules/engine.io/build/transports-uws/polling.js
generated
vendored
Executable file
|
@ -0,0 +1,370 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Polling = void 0;
|
||||
const transport_1 = require("../transport");
|
||||
const zlib_1 = require("zlib");
|
||||
const accepts = require("accepts");
|
||||
const debug_1 = require("debug");
|
||||
const debug = (0, debug_1.default)("engine:polling");
|
||||
const compressionMethods = {
|
||||
gzip: zlib_1.createGzip,
|
||||
deflate: zlib_1.createDeflate,
|
||||
};
|
||||
class Polling extends transport_1.Transport {
|
||||
/**
|
||||
* HTTP polling constructor.
|
||||
*
|
||||
* @api public.
|
||||
*/
|
||||
constructor(req) {
|
||||
super(req);
|
||||
this.closeTimeout = 30 * 1000;
|
||||
}
|
||||
/**
|
||||
* Transport name
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get name() {
|
||||
return "polling";
|
||||
}
|
||||
get supportsFraming() {
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Overrides onRequest.
|
||||
*
|
||||
* @param req
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onRequest(req) {
|
||||
const res = req.res;
|
||||
// remove the reference to the ServerResponse object (as the first request of the session is kept in memory by default)
|
||||
req.res = null;
|
||||
if (req.getMethod() === "get") {
|
||||
this.onPollRequest(req, res);
|
||||
}
|
||||
else if (req.getMethod() === "post") {
|
||||
this.onDataRequest(req, res);
|
||||
}
|
||||
else {
|
||||
res.writeStatus("500 Internal Server Error");
|
||||
res.end();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The client sends a request awaiting for us to send data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onPollRequest(req, res) {
|
||||
if (this.req) {
|
||||
debug("request overlap");
|
||||
// assert: this.res, '.req and .res should be (un)set together'
|
||||
this.onError("overlap from client");
|
||||
res.writeStatus("500 Internal Server Error");
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
debug("setting request");
|
||||
this.req = req;
|
||||
this.res = res;
|
||||
const onClose = () => {
|
||||
this.writable = false;
|
||||
this.onError("poll connection closed prematurely");
|
||||
};
|
||||
const cleanup = () => {
|
||||
this.req = this.res = null;
|
||||
};
|
||||
req.cleanup = cleanup;
|
||||
res.onAborted(onClose);
|
||||
this.writable = true;
|
||||
this.emit("drain");
|
||||
// if we're still writable but had a pending close, trigger an empty send
|
||||
if (this.writable && this.shouldClose) {
|
||||
debug("triggering empty send to append close packet");
|
||||
this.send([{ type: "noop" }]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The client sends a request with data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onDataRequest(req, res) {
|
||||
if (this.dataReq) {
|
||||
// assert: this.dataRes, '.dataReq and .dataRes should be (un)set together'
|
||||
this.onError("data request overlap from client");
|
||||
res.writeStatus("500 Internal Server Error");
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
const expectedContentLength = Number(req.headers["content-length"]);
|
||||
if (!expectedContentLength) {
|
||||
this.onError("content-length header required");
|
||||
res.writeStatus("411 Length Required").end();
|
||||
return;
|
||||
}
|
||||
if (expectedContentLength > this.maxHttpBufferSize) {
|
||||
this.onError("payload too large");
|
||||
res.writeStatus("413 Payload Too Large").end();
|
||||
return;
|
||||
}
|
||||
const isBinary = "application/octet-stream" === req.headers["content-type"];
|
||||
if (isBinary && this.protocol === 4) {
|
||||
return this.onError("invalid content");
|
||||
}
|
||||
this.dataReq = req;
|
||||
this.dataRes = res;
|
||||
let buffer;
|
||||
let offset = 0;
|
||||
const headers = {
|
||||
// text/html is required instead of text/plain to avoid an
|
||||
// unwanted download dialog on certain user-agents (GH-43)
|
||||
"Content-Type": "text/html",
|
||||
};
|
||||
this.headers(req, headers);
|
||||
for (let key in headers) {
|
||||
res.writeHeader(key, String(headers[key]));
|
||||
}
|
||||
const onEnd = (buffer) => {
|
||||
this.onData(buffer.toString());
|
||||
this.onDataRequestCleanup();
|
||||
res.cork(() => {
|
||||
res.end("ok");
|
||||
});
|
||||
};
|
||||
res.onAborted(() => {
|
||||
this.onDataRequestCleanup();
|
||||
this.onError("data request connection closed prematurely");
|
||||
});
|
||||
res.onData((arrayBuffer, isLast) => {
|
||||
const totalLength = offset + arrayBuffer.byteLength;
|
||||
if (totalLength > expectedContentLength) {
|
||||
this.onError("content-length mismatch");
|
||||
res.close(); // calls onAborted
|
||||
return;
|
||||
}
|
||||
if (!buffer) {
|
||||
if (isLast) {
|
||||
onEnd(Buffer.from(arrayBuffer));
|
||||
return;
|
||||
}
|
||||
buffer = Buffer.allocUnsafe(expectedContentLength);
|
||||
}
|
||||
Buffer.from(arrayBuffer).copy(buffer, offset);
|
||||
if (isLast) {
|
||||
if (totalLength != expectedContentLength) {
|
||||
this.onError("content-length mismatch");
|
||||
res.writeStatus("400 Content-Length Mismatch").end();
|
||||
this.onDataRequestCleanup();
|
||||
return;
|
||||
}
|
||||
onEnd(buffer);
|
||||
return;
|
||||
}
|
||||
offset = totalLength;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Cleanup request.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onDataRequestCleanup() {
|
||||
this.dataReq = this.dataRes = null;
|
||||
}
|
||||
/**
|
||||
* Processes the incoming data payload.
|
||||
*
|
||||
* @param {String} encoded payload
|
||||
* @api private
|
||||
*/
|
||||
onData(data) {
|
||||
debug('received "%s"', data);
|
||||
const callback = (packet) => {
|
||||
if ("close" === packet.type) {
|
||||
debug("got xhr close packet");
|
||||
this.onClose();
|
||||
return false;
|
||||
}
|
||||
this.onPacket(packet);
|
||||
};
|
||||
if (this.protocol === 3) {
|
||||
this.parser.decodePayload(data, callback);
|
||||
}
|
||||
else {
|
||||
this.parser.decodePayload(data).forEach(callback);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Overrides onClose.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
onClose() {
|
||||
if (this.writable) {
|
||||
// close pending poll request
|
||||
this.send([{ type: "noop" }]);
|
||||
}
|
||||
super.onClose();
|
||||
}
|
||||
/**
|
||||
* Writes a packet payload.
|
||||
*
|
||||
* @param {Object} packet
|
||||
* @api private
|
||||
*/
|
||||
send(packets) {
|
||||
this.writable = false;
|
||||
if (this.shouldClose) {
|
||||
debug("appending close packet to payload");
|
||||
packets.push({ type: "close" });
|
||||
this.shouldClose();
|
||||
this.shouldClose = null;
|
||||
}
|
||||
const doWrite = (data) => {
|
||||
const compress = packets.some((packet) => {
|
||||
return packet.options && packet.options.compress;
|
||||
});
|
||||
this.write(data, { compress });
|
||||
};
|
||||
if (this.protocol === 3) {
|
||||
this.parser.encodePayload(packets, this.supportsBinary, doWrite);
|
||||
}
|
||||
else {
|
||||
this.parser.encodePayload(packets, doWrite);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Writes data as response to poll request.
|
||||
*
|
||||
* @param {String} data
|
||||
* @param {Object} options
|
||||
* @api private
|
||||
*/
|
||||
write(data, options) {
|
||||
debug('writing "%s"', data);
|
||||
this.doWrite(data, options, () => {
|
||||
this.req.cleanup();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Performs the write.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
doWrite(data, options, callback) {
|
||||
// explicit UTF-8 is required for pages not served under utf
|
||||
const isString = typeof data === "string";
|
||||
const contentType = isString
|
||||
? "text/plain; charset=UTF-8"
|
||||
: "application/octet-stream";
|
||||
const headers = {
|
||||
"Content-Type": contentType,
|
||||
};
|
||||
const respond = (data) => {
|
||||
this.headers(this.req, headers);
|
||||
this.res.cork(() => {
|
||||
Object.keys(headers).forEach((key) => {
|
||||
this.res.writeHeader(key, String(headers[key]));
|
||||
});
|
||||
this.res.end(data);
|
||||
});
|
||||
callback();
|
||||
};
|
||||
if (!this.httpCompression || !options.compress) {
|
||||
respond(data);
|
||||
return;
|
||||
}
|
||||
const len = isString ? Buffer.byteLength(data) : data.length;
|
||||
if (len < this.httpCompression.threshold) {
|
||||
respond(data);
|
||||
return;
|
||||
}
|
||||
const encoding = accepts(this.req).encodings(["gzip", "deflate"]);
|
||||
if (!encoding) {
|
||||
respond(data);
|
||||
return;
|
||||
}
|
||||
this.compress(data, encoding, (err, data) => {
|
||||
if (err) {
|
||||
this.res.writeStatus("500 Internal Server Error");
|
||||
this.res.end();
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
headers["Content-Encoding"] = encoding;
|
||||
respond(data);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Compresses data.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
compress(data, encoding, callback) {
|
||||
debug("compressing");
|
||||
const buffers = [];
|
||||
let nread = 0;
|
||||
compressionMethods[encoding](this.httpCompression)
|
||||
.on("error", callback)
|
||||
.on("data", function (chunk) {
|
||||
buffers.push(chunk);
|
||||
nread += chunk.length;
|
||||
})
|
||||
.on("end", function () {
|
||||
callback(null, Buffer.concat(buffers, nread));
|
||||
})
|
||||
.end(data);
|
||||
}
|
||||
/**
|
||||
* Closes the transport.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
doClose(fn) {
|
||||
debug("closing");
|
||||
let closeTimeoutTimer;
|
||||
const onClose = () => {
|
||||
clearTimeout(closeTimeoutTimer);
|
||||
fn();
|
||||
this.onClose();
|
||||
};
|
||||
if (this.writable) {
|
||||
debug("transport writable - closing right away");
|
||||
this.send([{ type: "close" }]);
|
||||
onClose();
|
||||
}
|
||||
else if (this.discarded) {
|
||||
debug("transport discarded - closing right away");
|
||||
onClose();
|
||||
}
|
||||
else {
|
||||
debug("transport not writable - buffering orderly close");
|
||||
this.shouldClose = onClose;
|
||||
closeTimeoutTimer = setTimeout(onClose, this.closeTimeout);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns headers for a response.
|
||||
*
|
||||
* @param req - request
|
||||
* @param {Object} extra headers
|
||||
* @api private
|
||||
*/
|
||||
headers(req, headers) {
|
||||
headers = headers || {};
|
||||
// prevent XSS warnings on IE
|
||||
// https://github.com/LearnBoost/socket.io/pull/1333
|
||||
const ua = req.headers["user-agent"];
|
||||
if (ua && (~ua.indexOf(";MSIE") || ~ua.indexOf("Trident/"))) {
|
||||
headers["X-XSS-Protection"] = "0";
|
||||
}
|
||||
headers["cache-control"] = "no-store";
|
||||
this.emit("headers", headers, req);
|
||||
return headers;
|
||||
}
|
||||
}
|
||||
exports.Polling = Polling;
|
43
my-app/node_modules/engine.io/build/transports-uws/websocket.d.ts
generated
vendored
Executable file
43
my-app/node_modules/engine.io/build/transports-uws/websocket.d.ts
generated
vendored
Executable file
|
@ -0,0 +1,43 @@
|
|||
import { Transport } from "../transport";
|
||||
export declare class WebSocket extends Transport {
|
||||
protected perMessageDeflate: any;
|
||||
private socket;
|
||||
/**
|
||||
* WebSocket transport
|
||||
*
|
||||
* @param req
|
||||
* @api public
|
||||
*/
|
||||
constructor(req: any);
|
||||
/**
|
||||
* Transport name
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get name(): string;
|
||||
/**
|
||||
* Advertise upgrade support.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get handlesUpgrades(): boolean;
|
||||
/**
|
||||
* Advertise framing support.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get supportsFraming(): boolean;
|
||||
/**
|
||||
* Writes a packet payload.
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @api private
|
||||
*/
|
||||
send(packets: any): void;
|
||||
/**
|
||||
* Closes the transport.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
doClose(fn: any): void;
|
||||
}
|
85
my-app/node_modules/engine.io/build/transports-uws/websocket.js
generated
vendored
Executable file
85
my-app/node_modules/engine.io/build/transports-uws/websocket.js
generated
vendored
Executable file
|
@ -0,0 +1,85 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WebSocket = void 0;
|
||||
const transport_1 = require("../transport");
|
||||
const debug_1 = require("debug");
|
||||
const debug = (0, debug_1.default)("engine:ws");
|
||||
class WebSocket extends transport_1.Transport {
|
||||
/**
|
||||
* WebSocket transport
|
||||
*
|
||||
* @param req
|
||||
* @api public
|
||||
*/
|
||||
constructor(req) {
|
||||
super(req);
|
||||
this.writable = false;
|
||||
this.perMessageDeflate = null;
|
||||
}
|
||||
/**
|
||||
* Transport name
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get name() {
|
||||
return "websocket";
|
||||
}
|
||||
/**
|
||||
* Advertise upgrade support.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get handlesUpgrades() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Advertise framing support.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
get supportsFraming() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Writes a packet payload.
|
||||
*
|
||||
* @param {Array} packets
|
||||
* @api private
|
||||
*/
|
||||
send(packets) {
|
||||
this.writable = false;
|
||||
for (let i = 0; i < packets.length; i++) {
|
||||
const packet = packets[i];
|
||||
const isLast = i + 1 === packets.length;
|
||||
const send = (data) => {
|
||||
const isBinary = typeof data !== "string";
|
||||
const compress = this.perMessageDeflate &&
|
||||
Buffer.byteLength(data) > this.perMessageDeflate.threshold;
|
||||
debug('writing "%s"', data);
|
||||
this.socket.send(data, isBinary, compress);
|
||||
if (isLast) {
|
||||
this.writable = true;
|
||||
this.emit("drain");
|
||||
}
|
||||
};
|
||||
if (packet.options && typeof packet.options.wsPreEncoded === "string") {
|
||||
send(packet.options.wsPreEncoded);
|
||||
}
|
||||
else {
|
||||
this.parser.encodePacket(packet, this.supportsBinary, send);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Closes the transport.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
doClose(fn) {
|
||||
debug("closing");
|
||||
fn && fn();
|
||||
// call fn first since socket.end() immediately emits a "close" event
|
||||
this.socket.end();
|
||||
}
|
||||
}
|
||||
exports.WebSocket = WebSocket;
|
Loading…
Add table
Add a link
Reference in a new issue