Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement HTTP/2 downgrade by default #549

Merged
merged 4 commits into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# disable_upload_validation = "false"
# enable_logging = "false"
# force_http_11 = "false"
# force_http_2 = "false"
# local_first = "false"
# no_remote_delete = "false"
# skip_symlinks = "false"
Expand Down
6 changes: 4 additions & 2 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ skip_file = "~*|.~*|*.tmp"
Do not use a skip_file entry of `.*` as this will prevent correct searching of local changes to process.

### Important - curl compatibility
If your system utilises curl >= 7.62.0 you may need to use `--force-http-1.1` in order for the client to work correctly due to changes in curl to prefer HTTP/2 over HTTP/1.1 by default.
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.

### First run :zap:
After installing the application you must run it at least once from the terminal to authorize it.
Expand Down Expand Up @@ -492,7 +492,9 @@ Options:
--enable-logging
Enable client activity to a separate log file
--force-http-1.1
Force the use of HTTP 1.1 for all operations
Force the use of HTTP/1.1 for all operations (DEPRECIATED)
--force-http-2
Force the use of HTTP/2 for all operations where applicable
--get-O365-drive-id ARG
Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library
--help -h
Expand Down
7 changes: 6 additions & 1 deletion onedrive.1.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ Enable client activity to a separate log file
Configuration file key: \fBenable_logging\fP (default: \fBfalse\fP)
.TP
\fB\-\-force\-http\-1.1\fP
Force the use of HTTP 1.1 for all operations
Force the use of HTTP 1.1 for all operations (DEPRACIATED)
.br
Configuration file key: \fBforce_http_11\fP (default: \fBfalse\fP)
.TP
\fB\-\-force\-http\-2\fP
Force the use of HTTP/2 for all operations where applicable
.br
Configuration file key: \fBforce_http_2\fP (default: \fBfalse\fP)
.TP
\fB\-\-get\-O365\-drive\-id\fP ARG
Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library
.TP
Expand Down
6 changes: 5 additions & 1 deletion src/config.d
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ final class Config
boolValues["disable_upload_validation"] = false;
boolValues["enable_logging"] = false;
boolValues["force_http_11"] = false;
boolValues["force_http_2"] = false;
boolValues["local_first"] = false;
boolValues["no_remote_delete"] = false;
boolValues["skip_symlinks"] = false;
Expand Down Expand Up @@ -210,8 +211,11 @@ final class Config
"Enable client activity to a separate log file",
&boolValues["enable_logging"],
"force-http-1.1",
"Force the use of HTTP 1.1 for all operations",
"Force the use of HTTP/1.1 for all operations (DEPRECIATED)",
&boolValues["force_http_11"],
"force-http-2",
"Force the use of HTTP/2 for all operations where applicable",
&boolValues["force_http_2"],
"get-O365-drive-id",
"Query and return the Office 365 Drive ID for a given Office 365 SharePoint Shared Library",
&stringValues["get_o365_drive_id"],
Expand Down
4 changes: 4 additions & 0 deletions src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ int main(string[] args)
return EXIT_SUCCESS;
}

if (cfg.getValueBool("force_http_11")) {
log.log("NOTE: The use of --force-http-1.1 is depreciated");
}

log.vlog("Initializing the OneDrive API ...");
try {
online = testNetwork();
Expand Down
9 changes: 7 additions & 2 deletions src/onedrive.d
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ 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_11")) {
log.vdebug("Downgrading all HTTP operations to HTTP 1.1");
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");
// Downgrade to HTTP 1.1 - yes version = 2 is HTTP 1.1
http.handle.set(CurlOption.http_version,2);
}
Expand Down