Stop reading all rejected uploads and close stalled transfers

Guard the export, save, mod and stream routes with one middleware that
closes the connection of an upload answered before its body was read,
and of a transfer that has made no progress for the new
controller.transfer_idle_timeout.

The save and mod uploads share one handler that responds on the first
error instead of reading the rest of the upload, and uploads cut short
now fail the transfer instead of leaving it hanging.

Node's 5 minute limit on receiving a request is turned off so large
uploads over slow connections are not cut off.
This commit is contained in:
Danielv123 committed 2026-11-10 21:59:03 +01:00
1 parent 60a4b103ab
commit 49ddc9ebd1
6 files changed
+617 -257

No files matched your search

+2 -1
View File
@@ -473,7 +473,7 @@ export default class Controller {
// Only start listening for connections after all plugins have loaded
if (httpPort) {
this.httpServer = http.createServer(this.app);
this.httpServer = http.createServer(routes.httpServerOptions, this.app);
this.httpServerCloser = new HttpCloser(this.httpServer);
await this.listen(this.httpServer, httpPort, bindAddress);
logger.info(`Listening for HTTP on port ${(this.httpServer.address() as AddressInfo).port}`);
@@ -492,6 +492,7 @@ export default class Controller {
}
this.httpsServer = https.createServer({
...routes.httpServerOptions,
key: privateKey,
cert: certificate,
}, this.app);