Skip to content

Commit

Permalink
server reads ignored request body #1270
Browse files Browse the repository at this point in the history
  • Loading branch information
phoddie committed Dec 15, 2023
1 parent a185988 commit ecf05a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/network/http/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ function server(message, value, etc) {

let request = this.callback(Server.headersComplete); // headers complete... let's see what to do with the request body
if (false === request)
delete this.total; // ignore request body and just send response
socket.ignore = true; // ignore request body before sending response

if (undefined !== this.total) {
// start to receive request body
Expand Down Expand Up @@ -615,7 +615,11 @@ function server(message, value, etc) {
let count = (value < this.total) ? value : this.total;
if (0 === count) return;

if (true === this.request)
if (socket.ignore) {
socket.read(null, count);
this.total -= count;
}
else if (true === this.request)
this.callback(Server.requestFragment, socket.read()); // callback reads the data
else {
this.buffers.push(socket.read(this.request, count)); // http server reads the data
Expand Down

0 comments on commit ecf05a8

Please sign in to comment.