Update upload.go

This commit is contained in:
ZizzyDizzyMC 2021-02-21 22:41:34 -05:00
parent bab8916372
commit 4b755bafea
1 changed files with 18 additions and 0 deletions

View File

@ -53,6 +53,15 @@ type Upload struct {
} }
func uploadPostHandler(c web.C, w http.ResponseWriter, r *http.Request) { 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"}) { if !strictReferrerCheck(r, getSiteURL(r), []string{"Linx-Delete-Key", "Linx-Expiry", "Linx-Randomize", "X-Requested-With"}) {
badRequestHandler(c, w, r, RespAUTO, "") badRequestHandler(c, w, r, RespAUTO, "")
return 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) { 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{} upReq := UploadRequest{}
uploadHeaderProcess(r, &upReq) uploadHeaderProcess(r, &upReq)