fix
This commit is contained in:
parent
225fe84a6b
commit
a4cb2922fa
18
main.go
18
main.go
@ -27,14 +27,9 @@ var (
|
||||
noauth = flag.Bool("a", false, "dont use basic auth")
|
||||
)
|
||||
|
||||
var (
|
||||
fileServer http.Handler
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
fileServer = http.FileServer(http.Dir(""))
|
||||
http.HandleFunc("/", handler)
|
||||
|
||||
dockerhealth.Healthy = true
|
||||
@ -94,8 +89,14 @@ func get(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
r.URL.Path = path
|
||||
fileServer.ServeHTTP(w, r)
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
handleError(w, r, err)
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
io.Copy(w, file)
|
||||
}
|
||||
|
||||
func put(w http.ResponseWriter, r *http.Request) {
|
||||
@ -143,9 +144,6 @@ func head(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("File-Owner", username)
|
||||
w.Header().Add("Group-Owner", groupname)
|
||||
}
|
||||
|
||||
r.URL.Path = path
|
||||
fileServer.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func delete(w http.ResponseWriter, r *http.Request) {
|
||||
|
Loading…
Reference in New Issue
Block a user