mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-01 09:02:50 +08:00
Fix more lint warnings
This commit is contained in:
@ -10,7 +10,7 @@ import (
|
||||
"github.com/mholt/caddy/middleware/browse"
|
||||
)
|
||||
|
||||
// This FileServer is adapted from the one in net/http by
|
||||
// FileServer is adapted from the one in net/http by
|
||||
// the Go authors. Significant modifications have been made.
|
||||
//
|
||||
//
|
||||
@ -28,15 +28,16 @@ type fileHandler struct {
|
||||
hide []string // list of files to treat as "Not Found"
|
||||
}
|
||||
|
||||
func (f *fileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
func (fh *fileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
upath := r.URL.Path
|
||||
if !strings.HasPrefix(upath, "/") {
|
||||
upath = "/" + upath
|
||||
r.URL.Path = upath
|
||||
}
|
||||
return f.serveFile(w, r, path.Clean(upath))
|
||||
return fh.serveFile(w, r, path.Clean(upath))
|
||||
}
|
||||
|
||||
// serveFile writes the specified file to the HTTP response.
|
||||
// name is '/'-separated, not filepath.Separator.
|
||||
func (fh *fileHandler) serveFile(w http.ResponseWriter, r *http.Request, name string) (int, error) {
|
||||
f, err := fh.root.Open(name)
|
||||
|
@ -97,9 +97,8 @@ func (s *Server) Serve() error {
|
||||
tlsConfigs = append(tlsConfigs, vh.config.TLS)
|
||||
}
|
||||
return ListenAndServeTLSWithSNI(server, tlsConfigs)
|
||||
} else {
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
|
||||
// ListenAndServeTLSWithSNI serves TLS with Server Name Indication (SNI) support, which allows
|
||||
|
Reference in New Issue
Block a user