]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/godoc: don't warn about HEAD requests
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 15 May 2013 04:21:11 +0000 (21:21 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 15 May 2013 04:21:11 +0000 (21:21 -0700)
Fixes #5451

R=gri
CC=dsymonds, gobot, golang-dev
https://golang.org/cl/9388043

src/cmd/godoc/godoc.go

index 26b0b97e179d43ffba67ec4ee4caea78ecc6906b..79d485b93d4aae7da5f097703fad376551690073 100644 (file)
@@ -642,7 +642,9 @@ func servePage(w http.ResponseWriter, page Page) {
        page.SearchBox = *indexEnabled
        page.Playground = *showPlayground
        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)
        }
 }
@@ -860,7 +862,9 @@ func serveSearchDesc(w http.ResponseWriter, r *http.Request) {
        data := map[string]interface{}{
                "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)
        }
 }