Start of stripping www.

This commit is contained in:
Brad Fitzpatrick 2011-01-25 22:48:15 -08:00
parent 6132d7f9e7
commit c321d481a4
1 changed files with 10 additions and 1 deletions

View File

@ -170,6 +170,15 @@ func (h *gitwebHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
}
}
type noWwwHandler struct {
Handler http.Handler
}
func (h *noWwwHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
// TODO: strip www.
h.Handler.ServeHTTP(rw, r)
}
func main() {
flag.Parse()
readTemplates()
@ -208,7 +217,7 @@ func main() {
}
mux.HandleFunc("/", mainHandler)
if err := http.ListenAndServe(*httpAddr, mux); err != nil {
if err := http.ListenAndServe(*httpAddr, &noWwwHandler{Handler: mux}); err != nil {
log.Exitf("ListenAndServe %s: %v", *httpAddr, err)
}
}