Skip to content

Commit

Permalink
refactor: return HTTP 400 upon invalid request overlap
Browse files Browse the repository at this point in the history
In both cases, the error comes from the client as it should not send
multiple concurrent requests, so a HTTP 4xx code is mandated.

Related: #650
  • Loading branch information
darrachequesne committed May 1, 2023
1 parent bd6d471 commit 911d0e3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/transports/polling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ export class Polling extends Transport {
debug("request overlap");
// assert: this.res, '.req and .res should be (un)set together'
this.onError("overlap from client");
// TODO for the next major release: use an HTTP 400 status code (https://github.com/socketio/engine.io/issues/650)
res.writeHead(500);
res.writeHead(400);
res.end();
return;
}
Expand Down Expand Up @@ -117,8 +116,7 @@ export class Polling extends Transport {
if (this.dataReq) {
// assert: this.dataRes, '.dataReq and .dataRes should be (un)set together'
this.onError("data request overlap from client");
// TODO for the next major release: use an HTTP 400 status code (https://github.com/socketio/engine.io/issues/650)
res.writeHead(500);
res.writeHead(400);
res.end();
return;
}
Expand Down

0 comments on commit 911d0e3

Please sign in to comment.