2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

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).
This commit is contained in:
Alexander Neumann 2018-03-18 20:30:02 +01:00
parent 360ff1806a
commit 0b776e63e7

View File

@ -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
}