From 57be489b8bf8ee1231e549876388740946fc3df3 Mon Sep 17 00:00:00 2001 From: Marius Date: Sun, 29 Sep 2019 20:12:50 +0200 Subject: [PATCH] fixup! core: Allow writing data to storage after request is cancelled --- pkg/handler/unrouted_handler.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkg/handler/unrouted_handler.go b/pkg/handler/unrouted_handler.go index 34e03d6..b90cd67 100644 --- a/pkg/handler/unrouted_handler.go +++ b/pkg/handler/unrouted_handler.go @@ -26,10 +26,6 @@ var ( reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+\.]+$`) ) -var ( - requestTimeoutDuration = 3 * time.Second -) - // HTTPError represents an error with an additional status code attached // which may be used when this error is sent in a HTTP response. // See the net/http package for standardized status codes. @@ -418,8 +414,7 @@ func (handler *UnroutedHandler) PostFile(w http.ResponseWriter, r *http.Request) // HeadFile returns the length and offset for the HEAD request func (handler *UnroutedHandler) HeadFile(w http.ResponseWriter, r *http.Request) { - ctx, cancel := context.WithTimeout(context.Background(), requestTimeoutDuration) - defer cancel() + ctx := context.Background() id, err := extractIDFromPath(r.URL.Path) if err != nil { @@ -819,8 +814,7 @@ func filterContentType(info FileInfo) (contentType string, contentDisposition st // DelFile terminates an upload permanently. func (handler *UnroutedHandler) DelFile(w http.ResponseWriter, r *http.Request) { - ctx, cancel := context.WithTimeout(context.Background(), requestTimeoutDuration) - defer cancel() + ctx := context.Background() // Abort the request handling if the required interface is not implemented if !handler.composer.UsesTerminater {