Switch to using curl defaults for HTTP/2 operations (#2026)

* Switch to using curl defaults for HTTP/2 operations
This commit is contained in:
abraunegg 2022-07-01 15:09:11 +10:00 committed by GitHub
parent ca984eba70
commit 0e0fdacf7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 18 deletions

2
config
View file

@ -18,7 +18,7 @@
# disable_notifications = "false"
# disable_upload_validation = "false"
# enable_logging = "false"
# force_http_2 = "false"
# force_http_11 = "false"
# local_first = "false"
# no_remote_delete = "false"
# skip_symlinks = "false"

View file

@ -85,7 +85,13 @@ The files and directories in the synchronization directory must follow the [Wind
The application will attempt to handle instances where you have two files with the same names but with different capitalization. Where there is a namespace clash, the file name which clashes will not be synced. This is expected behavior and won't be fixed.
### curl compatibility
If your system utilises curl >= 7.62.0 curl defaults to prefer HTTP/2 over HTTP/1.1 by default. If you wish to use HTTP/2 for some operations you will need to use the `--force-http-2` config option to enable otherwise all operations will use HTTP/1.1.
If your system utilises curl < 7.47.0, curl defaults to HTTP/1.1 for HTTPS operations. The client will use HTTP/1.1.
If your system utilises curl >= 7.47.0 and < 7.62.0, curl will prefer HTTP/2 for HTTPS but will stick to HTTP/1.1 by default. The client will use HTTP/1.1 for HTTPS operations.
If your system utilises curl >= 7.62.0, curl defaults to prefer HTTP/2 over HTTP/1.1 by default. The client will utilse HTTP/2 for most HTTPS operations and HTTP/1.1 for others. This difference is governed by the OneDrive platform and not this client.
If you wish to explicitly use HTTP/1.1 you will need to use the `--force-http-11` flag or set the config option `force_http_11 = "true"` to force the application to use HTTP/1.1 otherwise all client operations will use whatever is the curl default for your distribution.
### Authorize the application with your OneDrive Account
After installing the application you must authorize the application with your OneDrive Account. This is done by running the application without any additional command switches.
@ -1165,8 +1171,8 @@ Options:
Enable client activity to a separate log file
--force
Force the deletion of data when a 'big delete' is detected
--force-http-2
Force the use of HTTP/2 for all operations where applicable
--force-http-11
Force the use of HTTP 1.1 for all operations
--force-sync
Force a synchronization of a specific folder, only when using --single-directory and ignoring all non-default skip_dir and skip_file rules
--get-O365-drive-id ARG

View file

@ -97,10 +97,10 @@ Configuration file key: \fBenable_logging\fP (default: \fBfalse\fP)
\fB\-\-force\fP
Force the deletion of data when a 'big delete' is detected
.TP
\fB\-\-force\-http\-2\fP
Force the use of HTTP/2 for all operations where applicable
\fB\-\-force\-http\-11\fP
Force the use of HTTP 1.1 for all operations
.br
Configuration file key: \fBforce_http_2\fP (default: \fBfalse\fP)
Configuration file key: \fBforce_http_11\fP (default: \fBfalse\fP)
.TP
\fB\-\-force\-sync\fP
Force a synchronization of a specific folder, only when using --synchronize --single-directory and ignore

View file

@ -62,7 +62,7 @@ final class Config
boolValues["disable_download_validation"] = false;
boolValues["disable_upload_validation"] = false;
boolValues["enable_logging"] = false;
boolValues["force_http_2"] = false;
boolValues["force_http_11"] = false;
boolValues["local_first"] = false;
boolValues["no_remote_delete"] = false;
boolValues["skip_symlinks"] = false;
@ -373,9 +373,9 @@ final class Config
"enable-logging",
"Enable client activity to a separate log file",
&boolValues["enable_logging"],
"force-http-2",
"Force the use of HTTP/2 for all operations where applicable",
&boolValues["force_http_2"],
"force-http-11",
"Force the use of HTTP 1.1 for all operations",
&boolValues["force_http_11"],
"force",
"Force the deletion of data when a 'big delete' is detected",
&boolValues["force"],

View file

@ -424,15 +424,14 @@ final class OneDriveApi
// What version of HTTP protocol do we use?
// Curl >= 7.62.0 defaults to http2 for a significant number of operations
if (cfg.getValueBool("force_http_2")) {
// Use curl defaults
log.vdebug("Upgrading all HTTP operations to HTTP/2 where applicable");
} else {
// Downgrade curl by default due to silent exist issues when using http/2
// See issue #501 for details and discussion
log.vdebug("Downgrading all HTTP operations to HTTP/1.1 by default");
if (cfg.getValueBool("force_http_11")) {
// Downgrade to curl to use HTTP 1.1 for all operations
log.vlog("Downgrading all HTTP operations to HTTP/1.1 due to user configuration");
// Downgrade to HTTP 1.1 - yes version = 2 is HTTP 1.1
http.handle.set(CurlOption.http_version,2);
} else {
// Use curl defaults
log.vlog("Using Curl defaults for all HTTP operations");
}
// Configure upload / download rate limits if configured