From c321d481a45834bf085a8b53256c6d16b41c6577 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 25 Jan 2011 22:48:15 -0800 Subject: [PATCH] Start of stripping www. --- website/camweb.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website/camweb.go b/website/camweb.go index 89f7aff1d..229312fbb 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -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) } }