Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Commit

Permalink
add uploadTimeout option - #430
Browse files Browse the repository at this point in the history
  • Loading branch information
silverwind committed Aug 18, 2020
1 parent fd54c00 commit 07354ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ By default, the server listens on all IPv4 and IPv6 interfaces on port 8989. On
- `updateInterval` *number* - Interval in milliseconds in which a single client can receive update messages through changes in the file system. Default: `1000`.
- `pollingInterval` *number* - Interval in milliseconds in which the file system is polled for changes, which **may necessary for files on external or network-mapped drives**. Corresponds to chokidar's [usePolling](https://github.com/paulmillr/chokidar#performance) option. This is CPU-intensive. `0` disables polling. Default: `0`.
- `keepAlive` *number* - Interval in milliseconds in which the server sends websocket keepalive messages, which may be necessary when proxies are involved. `0` disables keepalive messages. Default: `20000`.
- `uploadTimeout` *number* - Request timeout for upload requests in milliseconds. Default: `604800000` which is 7 days.
- `allowFrame` *boolean* - Allow the page to be loaded into a `<frame>` or `<iframe>`. Default: `false`.
- `readOnly` *boolean* - Treat all files as being read-only. Default: `false`.
- `dev` *boolean* - Enable developer mode, skipping resource minification and enabling live reload. Default: `false`.
Expand Down
1 change: 1 addition & 0 deletions server/cfg.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const defaults = {
updateInterval: 1000,
pollingInterval: 0,
keepAlive: 20000,
uploadTimeout: 604800000,
allowFrame: false,
readOnly: false,
ignorePatterns: [],
Expand Down
5 changes: 3 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -1122,8 +1122,9 @@ function handleUploadRequest(req, res) {
return;
}

// Set huge timeout for big file uploads and/or slow connection
res.setTimeout(24 * 60 * 60 * 1000);
if (req.setTimeout) req.setTimeout(config.uploadTimeout);
if (req.connection.setTimeout) req.connection.setTimeout(config.uploadTimeout);
if (res.setTimeout) res.setTimeout(config.uploadTimeout);

req.query = qs.parse(req.url.substring("/!/upload?".length));
const vId = req.query.vId;
Expand Down

0 comments on commit 07354ab

Please sign in to comment.