implemented responses for PUT and OPTIONS

This commit is contained in:
Altair-sh
2026-11-06 03:09:01 +01:00
parent 7a43e7f8c9
commit 2098082aa6
11 changed files with 206 additions and 33 deletions
+3 -3
View File
@@ -11,7 +11,7 @@ import (
type ShareAccess uint8
const (
AccessDenied ShareAccess = iota
AccessIncorrectPassword ShareAccess = iota
AccessReadOnly
AccessReadWrite
)
@@ -22,7 +22,7 @@ func checkSharePasswords(share *SharedLocation, req *http.Request,
) ShareAccess {
reqPass := getBasicAuthPassword(req)
canWrite := share.WritePassword != "" &&
(reqPass != "" && passwordMatches(reqPass, share.WritePassword))
reqPass != "" && passwordMatches(reqPass, share.WritePassword)
if canWrite {
return AccessReadWrite
}
@@ -31,7 +31,7 @@ func checkSharePasswords(share *SharedLocation, req *http.Request,
if canRead {
return AccessReadOnly
}
return AccessDenied
return AccessIncorrectPassword
}
func getBasicAuthPassword(req *http.Request) string {