From 0b776e63e781ea03df8d20673d19aa5663d82e58 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 18 Mar 2018 20:30:02 +0100 Subject: [PATCH] backend/rclone: Request random file name When `/` is requested, rclone returns the list of all files in the remote, which is not what we want (and it can take quite some time). --- internal/backend/rclone/backend.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/backend/rclone/backend.go b/internal/backend/rclone/backend.go index 9431119e0..e431ec5a9 100644 --- a/internal/backend/rclone/backend.go +++ b/internal/backend/rclone/backend.go @@ -5,6 +5,7 @@ import ( "context" "crypto/tls" "fmt" + "math/rand" "net" "net/http" "net/url" @@ -174,7 +175,11 @@ func New(cfg Config) (*Backend, error) { Timeout: 60 * time.Second, } - req, err := http.NewRequest(http.MethodGet, "http://localhost/", nil) + // request a random file which does not exist. we just want to test when + // rclone is able to accept HTTP requests. + url := fmt.Sprintf("http://localhost/file-%d", rand.Uint64()) + + req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { return nil, err }