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

serve http: Fix timeouts

Nick Craig-Wood2740c965c08f
diff --git a/cmd/serve/http/http.go b/cmd/serve/http/http.go
index 0e7cf9ae6..ab99423c4 100644
--- a/cmd/serve/http/http.go
+++ b/cmd/serve/http/http.go
@@ -75,11 +75,11 @@ func (s *server) serve() {
mux.HandleFunc("/", s.handler)
// FIXME make a transport?
httpServer := &http.Server{
- Addr: s.bindAddress,
- Handler: mux,
- ReadTimeout: 10 * time.Second,
- WriteTimeout: 10 * time.Second,
- MaxHeaderBytes: 1 << 20,
+ Addr: s.bindAddress,
+ Handler: mux,
+ ReadHeaderTimeout: 10 * time.Second, // time to send the headers
+ IdleTimeout: 60 * time.Second, // time to keep idle connections open
+ MaxHeaderBytes: 1 << 20,
}
fs.Logf(s.f, "Serving on http://%s/", bindAddress)
log.Fatal(httpServer.ListenAndServe())