From 4b755bafea7f9b7c0878338e81c7375a675daeb2 Mon Sep 17 00:00:00 2001 From: ZizzyDizzyMC Date: Sun, 21 Feb 2021 22:41:34 -0500 Subject: [PATCH] Update upload.go --- upload.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/upload.go b/upload.go index e1911d3..3d81082 100644 --- a/upload.go +++ b/upload.go @@ -53,6 +53,15 @@ type Upload struct { } func uploadPostHandler(c web.C, w http.ResponseWriter, r *http.Request) { + contentSize, err := strconv.ParseInt(r.Header.Get("Content-Length"), 10, 64) + if err != nil { + upReq.contentSize = 0 + log.Printf("error on content size conversion") + } else { + upReq.contentSize = contentSize + log.Printf("content size assigned") + log.Print(contentSize) + } if !strictReferrerCheck(r, getSiteURL(r), []string{"Linx-Delete-Key", "Linx-Expiry", "Linx-Randomize", "X-Requested-With"}) { badRequestHandler(c, w, r, RespAUTO, "") return @@ -127,6 +136,15 @@ func uploadPostHandler(c web.C, w http.ResponseWriter, r *http.Request) { } func uploadPutHandler(c web.C, w http.ResponseWriter, r *http.Request) { + contentSize, err := strconv.ParseInt(r.Header.Get("Content-Length"), 10, 64) + if err != nil { + upReq.contentSize = 0 + log.Printf("error on content size conversion") + } else { + upReq.contentSize = contentSize + log.Printf("content size assigned") + log.Print(contentSize) + } upReq := UploadRequest{} uploadHeaderProcess(r, &upReq)