mirror of
https://github.com/ZizzyDizzyMC/linx-server.git
synced 2026-01-23 02:14:33 +00:00
Basic auth: Fix #201 - broken uploads
This commit is contained in:
parent
7ca3331044
commit
773eb877bd
3 changed files with 4 additions and 6 deletions
|
|
@ -196,20 +196,18 @@ func setup() *web.Mux {
|
|||
AuthFile: Config.authFile,
|
||||
UnauthMethods: []string{},
|
||||
}
|
||||
okFunc := func (w http.ResponseWriter, r *http.Request) {
|
||||
okFunc := func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Location", Config.sitePath)
|
||||
w.WriteHeader(http.StatusFound)
|
||||
}
|
||||
authHandler := auth {
|
||||
authHandler := auth{
|
||||
successHandler: http.HandlerFunc(okFunc),
|
||||
failureHandler: http.HandlerFunc(badAuthorizationHandler),
|
||||
authKeys: readAuthKeys(Config.authFile),
|
||||
o: options,
|
||||
}
|
||||
mux.Head(Config.sitePath+"auth", authHandler)
|
||||
mux.Head(Config.sitePath+"auth/", authHandler)
|
||||
mux.Get(Config.sitePath+"auth", authHandler)
|
||||
mux.Get(Config.sitePath+"auth/", authHandler)
|
||||
}
|
||||
|
||||
mux.Post(Config.sitePath+"upload", uploadPostHandler)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue