Commit d9d8d4c6 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

cmd/godoc: don't warn about HEAD requests

Fixes #5451

R=gri
CC=dsymonds, gobot, golang-dev
https://golang.org/cl/9388043
parent 2eeab323
...@@ -642,7 +642,9 @@ func servePage(w http.ResponseWriter, page Page) { ...@@ -642,7 +642,9 @@ func servePage(w http.ResponseWriter, page Page) {
page.SearchBox = *indexEnabled page.SearchBox = *indexEnabled
page.Playground = *showPlayground page.Playground = *showPlayground
page.Version = runtime.Version() page.Version = runtime.Version()
if err := godocHTML.Execute(w, page); err != nil { if err := godocHTML.Execute(w, page); err != nil && err != http.ErrBodyNotAllowed {
// Only log if there's an error that's not about writing on HEAD requests.
// See Issues 5451 and 5454.
log.Printf("godocHTML.Execute: %s", err) log.Printf("godocHTML.Execute: %s", err)
} }
} }
...@@ -860,7 +862,9 @@ func serveSearchDesc(w http.ResponseWriter, r *http.Request) { ...@@ -860,7 +862,9 @@ func serveSearchDesc(w http.ResponseWriter, r *http.Request) {
data := map[string]interface{}{ data := map[string]interface{}{
"BaseURL": fmt.Sprintf("http://%s", r.Host), "BaseURL": fmt.Sprintf("http://%s", r.Host),
} }
if err := searchDescXML.Execute(w, &data); err != nil { if err := searchDescXML.Execute(w, &data); err != nil && err != http.ErrBodyNotAllowed {
// Only log if there's an error that's not about writing on HEAD requests.
// See Issues 5451 and 5454.
log.Printf("searchDescXML.Execute: %s", err) log.Printf("searchDescXML.Execute: %s", err)
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment