From 0e0fdacf7cad590b9437db5764979e741d06d270 Mon Sep 17 00:00:00 2001 From: abraunegg Date: Fri, 1 Jul 2022 15:09:11 +1000 Subject: [PATCH] Switch to using curl defaults for HTTP/2 operations (#2026) * Switch to using curl defaults for HTTP/2 operations --- config | 2 +- docs/USAGE.md | 12 +++++++++--- onedrive.1.in | 6 +++--- src/config.d | 8 ++++---- src/onedrive.d | 13 ++++++------- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/config b/config index 0514a86d..c9632224 100644 --- a/config +++ b/config @@ -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" diff --git a/docs/USAGE.md b/docs/USAGE.md index 2d498c06..21f8f98f 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -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 diff --git a/onedrive.1.in b/onedrive.1.in index e06568fe..0bfbfcba 100644 --- a/onedrive.1.in +++ b/onedrive.1.in @@ -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 diff --git a/src/config.d b/src/config.d index c0d0968e..ef1db2fc 100644 --- a/src/config.d +++ b/src/config.d @@ -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"], diff --git a/src/onedrive.d b/src/onedrive.d index b22b5cda..2ead0774 100644 --- a/src/onedrive.d +++ b/src/onedrive.d @@ -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