diff --git a/vtqe/httpserver/http.go b/vtqe/httpserver/http.go index 01cbda4..4228e69 100644 --- a/vtqe/httpserver/http.go +++ b/vtqe/httpserver/http.go @@ -55,8 +55,8 @@ func RunHttpServer(listenIp, port, auth, folderPath, certKey, version, indexFile func (v VtqeHttpServer) httpListen(w http.ResponseWriter, r *http.Request) { log := starlog.Std.NewFlag() - w.Header().Set("Server", "Vicorique") - w.Header().Set("Powered By", "B612.ME") + w.Header().Set("Server", "Victorique") + w.Header().Set("Powered", "B612.ME") write401 := func() { w.Header().Set("WWW-Authenticate", ` Basic realm="Please Enter Passwd"`) w.WriteHeader(401) @@ -138,7 +138,7 @@ func (v VtqeHttpServer) httpListen(w http.ResponseWriter, r *http.Request) { } fpinfo, _ := os.Stat(fullpath) name := filepath.Base(fullpath) - ext := filepath.Ext(name)[1:] + ext := filepath.Ext(name) mime := GetMIME(ext) if mime == "" || v.stopMime { w.Header().Set("Content-Type", "application/download") diff --git a/vtqe/httpserver/mime.go b/vtqe/httpserver/mime.go index 39136a9..1f1ad79 100644 --- a/vtqe/httpserver/mime.go +++ b/vtqe/httpserver/mime.go @@ -1,6 +1,10 @@ package httpserver func GetMIME(ext string) string { + if len(ext) == 0 || ext == "." { + return "" + } + ext = ext[1:] switch ext { case "123": return "application/vnd.lotus-1-2-3"