1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:07:58 -07:00

http: set content type for fileserver directory listings

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4815062
This commit is contained in:
Robert Griesemer 2011-07-26 11:30:11 -07:00
parent 12a5774cde
commit e21f69338b

View File

@ -78,6 +78,7 @@ func isText(b []byte) bool {
} }
func dirList(w ResponseWriter, f File) { func dirList(w ResponseWriter, f File) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
fmt.Fprintf(w, "<pre>\n") fmt.Fprintf(w, "<pre>\n")
for { for {
dirs, err := f.Readdir(100) dirs, err := f.Readdir(100)