Compare commits

..

2 Commits

Author SHA1 Message Date
Damien Arrachequesne
d6e9d43e6b fix 2026-04-17 09:40:52 +02:00
Damien Arrachequesne
0898a49a35 refactor(eio): use plain IncomingMessage in the public API 2026-04-17 09:30:45 +02:00
8 changed files with 7 additions and 78 deletions

View File

@@ -296,7 +296,7 @@ A payload is a series of encoded packets tied together. The payload encoding for
<length1>:<packet1>[<length2>:<packet2>[...]]
```
* length: length of the packet in __characters__
* packet: actual packets as described above
* packet: actual packets as descriped above
When XHR2 is not supported, the same encoding principle is used also when
binary data is sent, but it is sent as base64 encoded strings. For the purposes of decoding, an identifier `b` is

View File

@@ -48,23 +48,6 @@
| [3.4.2](#342-2020-06-04) | June 2020 | `"` |
| [3.4.1](#341-2020-04-17) | April 2020 | `^7.1.2` |
## [6.6.7](https://github.com/socketio/socket.io/compare/engine.io@6.6.6...engine.io@6.6.7) (2026-04-27)
### Bug Fixes
* close HTTP requests with invalid content type ([fc11285](https://github.com/socketio/socket.io/commit/fc11285e14964c2132d122164bf130c355f60671))
* handle invalid packets when upgrading to WebTransport ([1fa1f46](https://github.com/socketio/socket.io/commit/1fa1f46cd420ac5b57bb4c04c959b58f3c79158c))
* prevent WebTransport connections when a middleware is registered ([d1f5aa9](https://github.com/socketio/socket.io/commit/d1f5aa93722a7f1ed729b96f771daf92a3dfdaf7))
### Dependencies
- [`ws@~8.18.3`](https://github.com/websockets/ws/releases/tag/8.18.3) (no change)
## [6.6.6](https://github.com/socketio/socket.io/compare/engine.io@6.6.5...engine.io@6.6.6) (2026-03-10)

View File

@@ -136,8 +136,7 @@ export class Polling extends Transport {
const isBinary = "application/octet-stream" === req.headers["content-type"];
if (isBinary && this.protocol === 4) {
this.onError("invalid content");
return res.writeStatus("400 Bad Request").end();
return this.onError("invalid content");
}
this.dataReq = req;

View File

@@ -122,8 +122,7 @@ export class Polling extends Transport {
const isBinary = "application/octet-stream" === req.headers["content-type"];
if (isBinary && this.protocol === 4) {
this.onError("invalid content");
return res.writeHead(400).end();
return this.onError("invalid content");
}
this.dataReq = req;

View File

@@ -1,6 +1,6 @@
{
"name": "engine.io",
"version": "6.6.7",
"version": "6.6.6",
"description": "The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server",
"type": "commonjs",
"main": "./build/engine.io.js",

View File

@@ -60,32 +60,6 @@ exports.listen = (opts, fn) => {
return e;
};
exports.listenAsync = function listenAsync(opts = {}) {
return new Promise((resolve) => {
const engine = exports.listen(opts, (port) => {
resolve({
port,
close: () => {
engine.close();
if (engine.httpServer) {
engine.httpServer.close();
}
},
});
});
});
};
exports.runHandshake = async function runHandshake(port) {
const res = await fetch(
`http://localhost:${port}/engine.io/?EIO=4&transport=polling`,
);
const data = await res.text();
return {
sid: JSON.parse(data.substring(1)).sid,
};
};
exports.ClientSocket = Socket;
exports.createPartialDone = (done, count) => {

View File

@@ -7,13 +7,7 @@ const path = require("path");
const exec = require("child_process").exec;
const zlib = require("zlib");
const { Server, Socket, attach } = require("..");
const {
ClientSocket,
listen,
listenAsync,
runHandshake,
createPartialDone,
} = require("./common");
const { ClientSocket, listen, createPartialDone } = require("./common");
const expect = require("expect.js");
const request = require("superagent");
const cookieMod = require("cookie");
@@ -587,7 +581,7 @@ describe("server", () => {
});
});
it("should not suggest upgrades when none are available", (done) => {
it("should not suggest upgrades when none are availble", (done) => {
listen({ transports: ["polling"] }, (port) => {
const socket = new ClientSocket(`ws://localhost:${port}`, {});
socket.on("handshake", (obj) => {
@@ -1464,26 +1458,6 @@ describe("server", () => {
},
);
it("should abort the polling data request if the content type is invalid", async () => {
const { port, close } = await listenAsync();
const { sid } = await runHandshake(port);
const res = await fetch(
`http://localhost:${port}/engine.io/?EIO=4&transport=polling&sid=${sid}`,
{
method: "POST",
headers: {
"content-type": "application/octet-stream",
},
body: Buffer.of(1, 2, 3),
},
);
expect(res.status).to.eql(400);
close();
});
// tests https://github.com/LearnBoost/engine.io-client/issues/207
// websocket test, transport error
it("should trigger transport close before open for ws", (done) => {

View File

@@ -444,7 +444,7 @@ describe("server", () => {
nio.emit<"noArgs">,
);
expectType<ToEmit<ServerToClientEventsNoAck, "helloFromServer">>(
// These errors will disappear once the TS version is updated from 4.7.4
// These errors will dissapear once the TS version is updated from 4.7.4
// the TSD instance is using a newer version of TS than the workspace version
// to enable the ability to compare against `any`
sio.emit<"helloFromServer">,