From e2c4f65c626e1d8018b80b9c559eca9e3a568b5f Mon Sep 17 00:00:00 2001 From: 5HT2 Date: Mon, 8 Jan 2024 01:37:28 +0000 Subject: [PATCH] =?UTF-8?q?cleanup:=20Unnecessary=20use=20of=20bytes=20?= =?UTF-8?q?=CB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/main.go b/main.go index 90c0efc..4f6078f 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "flag" "fmt" "io/fs" @@ -116,7 +115,7 @@ func (ln tcpKeepaliveListener) Accept() (net.Conn, error) { func RequestHandler(ctx *fasthttp.RequestCtx) { // The authentication key provided with said Auth header - auth := ctx.Request.Header.Peek("Auth") + auth := string(ctx.Request.Header.Peek("Auth")) method := string(ctx.Request.Header.Method()) // requestPath is prefixed with a / @@ -139,7 +138,7 @@ func RequestHandler(ctx *fasthttp.RequestCtx) { } // Make sure Auth key is correct, or that we have an allowable user token - if !bytes.Equal(auth, authToken) && !VerifyUserToken(string(auth), method, path, ctx.FormValue("dir")) { + if (auth != authToken) && !VerifyUserToken(auth, method, path, ctx.FormValue("dir")) { HandleForbidden(ctx) return }