From 102b19da4106306d55f1391f5f283637bd612b59 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 3 Jul 2013 11:16:13 -0400 Subject: [PATCH] adding a default favicon handler. no more 404's for that --- httplog.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/httplog.go b/httplog.go index b511093..fbe2bdb 100644 --- a/httplog.go +++ b/httplog.go @@ -7,6 +7,24 @@ import ( "time" ) +var ( + /* This default icon is empty with a long lived cache */ + DefaultFavIcon FavIcon = defaultFavIcon{} +) + +type defaultFavIcon struct { +} + +func (dfi defaultFavIcon) Route(w http.ResponseWriter, r *http.Request) { + LogRequest(r, 200) + w.Header().Set("Cache-Control", "max-age=315360000") +} + +/* simple interface for a favicon */ +type FavIcon interface { + Route(w http.ResponseWriter, r *http.Request) +} + // for debugging request headers func LogHeaders(r *http.Request) { fmt.Printf("HEADERS:\n")