Skip to content

Commit

Permalink
fix: raise default request timeout to support massive file transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Oct 22, 2023
1 parent 3261840 commit 0601fa8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
68 changes: 34 additions & 34 deletions packages/nephele-serve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,44 +152,44 @@ Usage: nephele-serve [options] [directory]
Run Nephele WebDAV server to serve local files.
Arguments:
directory The path of the directory to use as the server root.
directory The path of the directory to use as the server root.
Options:
-v, --version Print the current version
-h, --host <host> A host address to listen on. The default is to listen on all external hosts. (default: "::")
-r, --realm <realm> The realm reported to the user by the server when authentication is requested. Defaults to the system hostname.
--cert <cert_file> The filename of a certificate to use for HTTPS in PEM format.
--key <key_file> The filename of a private key to use for HTTPS in PEM format.
-p, --port <port> The port to listen on. Defaults to 443 if a cert is provided, 80 otherwise.
--redirect-port <redirect_port> The port to redirect HTTP traffic to HTTPS. Set this to 80 if you want to redirect plain HTTP requests.
-t, --timeout <milliseconds> The request timeout. Requests will be terminated if they take longer than this time.
-k, --keep-alive-timeout <milliseconds> The keep alive timeout. Server will wait this long for additional data after writing its last response.
--home-directories Serve users' home directories to them when they log in.
--user-directories Serve users their own directory under the server root when they log in.
--serve-indexes Serve index.html and index.htm files when the user requests a directory.
--serve-listings Serve directory listings with file management forms when the user requests a directory.
--no-auth Don't require authorization. (Not compatible with serving home directories or user directories.)
--no-update-check Don't check for updates.
--help display help for command
-v, --version Print the current version
-h, --host <host> A host address to listen on. The default is to listen on all external hosts. (default: "::")
-r, --realm <realm> The realm reported to the user by the server when authentication is requested. Defaults to the system hostname.
--cert <cert_file> The filename of a certificate to use for HTTPS in PEM format.
--key <key_file> The filename of a private key to use for HTTPS in PEM format.
-p, --port <port> The port to listen on. Defaults to 443 if a cert is provided, 80 otherwise.
--redirect-port <redirect_port> The port to redirect HTTP traffic to HTTPS. Set this to 80 if you want to redirect plain HTTP requests.
-t, --timeout <milliseconds> Request timeout. Requests will be terminated if they take longer than this time. Defaults to 7200000, or 2 hours.
--keep-alive-timeout <milliseconds> Server will wait this long for additional data after writing its last response.
--home-directories Serve users' home directories to them when they log in.
--user-directories Serve users their own directory under the server root when they log in.
--serve-indexes Serve index.html and index.htm files when the user requests a directory.
--serve-listings Serve directory listings with file management forms when the user requests a directory.
--no-auth Don't require authorization. (Not compatible with serving home directories or user directories.)
--no-update-check Don't check for updates.
--help display help for command
Environment Variables:
HOST Same as --host.
PORT Same as --port.
REDIRECT_PORT Same as --redirect-port.
TIMEOUT Same as --timeout.
KEEPALIVETIMEOUT Same as --keep-alive-timeout.
REALM Same as --realm.
CERT_FILE Same as --cert.
CERT Text of a cert in PEM format.
KEY_FILE Same as --key.
KEY Text of a key in PEM format.
HOME_DIRECTORIES Same as --home-directories when set to "true", "on" or "1".
USER_DIRECTORIES Same as --user-directories when set to "true", "on" or "1".
SERVE_INDEXES Same as --serve-indexes when set to "true", "on" or "1".
SERVE_LISTINGS Same as --serve-listings when set to "true", "on" or "1".
AUTH Same as --no-auth when set to "false", "off" or "0".
UPDATE_CHECK Same as --no-update-check when set to "false", "off" or "0".
SERVER_ROOT Same as [directory].
HOST Same as --host.
PORT Same as --port.
REDIRECT_PORT Same as --redirect-port.
TIMEOUT Same as --timeout.
KEEPALIVETIMEOUT Same as --keep-alive-timeout.
REALM Same as --realm.
CERT_FILE Same as --cert.
CERT Text of a cert in PEM format.
KEY_FILE Same as --key.
KEY Text of a key in PEM format.
HOME_DIRECTORIES Same as --home-directories when set to "true", "on" or "1".
USER_DIRECTORIES Same as --user-directories when set to "true", "on" or "1".
SERVE_INDEXES Same as --serve-indexes when set to "true", "on" or "1".
SERVE_LISTINGS Same as --serve-listings when set to "true", "on" or "1".
AUTH Same as --no-auth when set to "false", "off" or "0".
UPDATE_CHECK Same as --no-update-check when set to "false", "off" or "0".
SERVER_ROOT Same as [directory].
Options given on the command line take precedence over options from an environment variable.
Expand Down
8 changes: 4 additions & 4 deletions packages/nephele-serve/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ program
.addOption(
new Option(
'-t, --timeout <milliseconds>',
'The request timeout. Requests will be terminated if they take longer than this time.'
'Request timeout. Requests will be terminated if they take longer than this time. Defaults to 7200000, or 2 hours.'
).argParser(parseInt)
)
.addOption(
new Option(
'-k, --keep-alive-timeout <milliseconds>',
'The keep alive timeout. Server will wait this long for additional data after writing its last response.'
'--keep-alive-timeout <milliseconds>',
'Server will wait this long for additional data after writing its last response.'
).argParser(parseInt)
)
.option(
Expand Down Expand Up @@ -234,7 +234,7 @@ try {
}

if (timeout == null) {
timeout = parseInt(process.env.TIMEOUT || '1800000') || 0;
timeout = parseInt(process.env.TIMEOUT || '7200000') || 0;
}

if (timeout != null && timeout < 0) {
Expand Down

0 comments on commit 0601fa8

Please sign in to comment.