fix (chunked): chunked upload connection close

only close connection when using chunked upload. This is key if you must
use something like to work with Cloudflare
This commit is contained in:
MickaelK
2024-11-28 01:32:32 +11:00
parent de5e2d9583
commit 0dea98d4bd

View File

@ -438,7 +438,6 @@ func FileSave(ctx *App, res http.ResponseWriter, req *http.Request) {
return return
} }
} }
res.Header().Set("Connection", "Close")
// There is 2 ways to save something: // There is 2 ways to save something:
// - case1: regular upload, we just insert the file in the pipe // - case1: regular upload, we just insert the file in the pipe
@ -461,6 +460,7 @@ func FileSave(ctx *App, res http.ResponseWriter, req *http.Request) {
SendErrorResult(res, NewError(err.Error(), 403)) SendErrorResult(res, NewError(err.Error(), 403))
} }
ctx.Session["path"] = path ctx.Session["path"] = path
res.Header().Set("Connection", "Close")
var uploader *chunkedUpload var uploader *chunkedUpload
if c := chunkedUploadCache.Get(ctx.Session); c == nil { if c := chunkedUploadCache.Get(ctx.Session); c == nil {