Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

fshttp: add --expect-continue-timeout default 1s - fixes #3835

Nick Craig-Wood277d94feac56
diff --git a/docs/content/docs.md b/docs/content/docs.md
index f2cf1d72e..02dc47f4b 100644
--- a/docs/content/docs.md
+++ b/docs/content/docs.md
@@ -539,6 +539,19 @@ Do a trial run with no permanent changes. Use this to see what rclone
would do without actually doing it. Useful when setting up the `sync`
command which deletes files in the destination.
+### --expect-continue-timeout=TIME ###
+
+This specifies the amount of time to wait for a server's first
+response headers after fully writing the request headers if the
+request has an "Expect: 100-continue" header. Not all backends support
+using this.
+
+Zero means no timeout and causes the body to be sent immediately,
+without waiting for the server to approve. This time does not include
+the time to send the request header.
+
+The default is `1s`. Set to 0 to disable.
+
### --ignore-case-sync ###
Using this option will cause rclone to ignore the case of the files
diff --git a/fs/config.go b/fs/config.go
index b497ac7dd..54675ffab 100644
--- a/fs/config.go
+++ b/fs/config.go
@@ -54,6 +54,7 @@ type ConfigInfo struct {
Transfers int
ConnectTimeout time.Duration // Connect timeout
Timeout time.Duration // Data channel timeout
+ ExpectContinueTimeout time.Duration
Dump DumpFlags
InsecureSkipVerify bool // Skip server certificate verification
DeleteMode DeleteMode
@@ -121,6 +122,7 @@ func NewConfig() *ConfigInfo {
c.Transfers = 4
c.ConnectTimeout = 60 * time.Second
c.Timeout = 5 * 60 * time.Second
+ c.ExpectContinueTimeout = 1 * time.Second
c.DeleteMode = DeleteModeDefault
c.MaxDelete = -1
c.LowLevelRetries = 10
diff --git a/fs/config/configflags/configflags.go b/fs/config/configflags/configflags.go
index 3ae0cbf64..16ad272d9 100644
--- a/fs/config/configflags/configflags.go
+++ b/fs/config/configflags/configflags.go
@@ -50,6 +50,7 @@ func AddFlags(flagSet *pflag.FlagSet) {
flags.BoolVarP(flagSet, &fs.Config.DryRun, "dry-run", "n", fs.Config.DryRun, "Do a trial run with no permanent changes")
flags.DurationVarP(flagSet, &fs.Config.ConnectTimeout, "contimeout", "", fs.Config.ConnectTimeout, "Connect timeout")
flags.DurationVarP(flagSet, &fs.Config.Timeout, "timeout", "", fs.Config.Timeout, "IO idle timeout")
+ flags.DurationVarP(flagSet, &fs.Config.ExpectContinueTimeout, "expect-continue-timeout", "", fs.Config.ExpectContinueTimeout, "Timeout when using expect / 100-continue in HTTP")
flags.BoolVarP(flagSet, &dumpHeaders, "dump-headers", "", false, "Dump HTTP headers - may contain sensitive info")
flags.BoolVarP(flagSet, &dumpBodies, "dump-bodies", "", false, "Dump HTTP headers and bodies - may contain sensitive info")
flags.BoolVarP(flagSet, &fs.Config.InsecureSkipVerify, "no-check-certificate", "", fs.Config.InsecureSkipVerify, "Do not verify the server SSL certificate. Insecure.")
diff --git a/fs/fshttp/http.go b/fs/fshttp/http.go
index db1face8b..1414426be 100644
--- a/fs/fshttp/http.go
+++ b/fs/fshttp/http.go
@@ -178,7 +178,7 @@ func NewTransportCustom(ci *fs.ConfigInfo, customize func(*http.Transport)) http
return dialContextTimeout(ctx, network, addr, ci)
}
t.IdleConnTimeout = 60 * time.Second
- t.ExpectContinueTimeout = ci.ConnectTimeout
+ t.ExpectContinueTimeout = ci.ExpectContinueTimeout
// customize the transport if required
if customize != nil {