Skip to content

Commit c906d1d

Browse files
naltatisandig
authored andcommitted
etags
1 parent 54842b3 commit c906d1d

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

go.mod

+6
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ require (
9797
gorm.io/gorm v1.24.1
9898
)
9999

100+
require (
101+
github.com/go-http-utils/fresh v0.0.0-20161124030543-7231e26a4b27 // indirect
102+
github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a // indirect
103+
)
104+
100105
require (
101106
cloud.google.com/go/compute v1.12.1 // indirect
102107
cloud.google.com/go/compute/metadata v0.2.1 // indirect
@@ -114,6 +119,7 @@ require (
114119
github.com/felixge/httpsnoop v1.0.3 // indirect
115120
github.com/fsnotify/fsnotify v1.6.0 // indirect
116121
github.com/glebarez/go-sqlite v1.19.2 // indirect
122+
github.com/go-http-utils/etag v0.0.0-20161124023236-513ea8f21eb1
117123
github.com/go-kit/log v0.2.1 // indirect
118124
github.com/go-logfmt/logfmt v0.5.1 // indirect
119125
github.com/go-playground/locales v0.14.0 // indirect

go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,12 @@ github.com/glebarez/sqlite v1.5.0/go.mod h1:0wzXzTvfVJIN2GqRhCdMbnYd+m+aH5/QV7B3
264264
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
265265
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
266266
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
267+
github.com/go-http-utils/etag v0.0.0-20161124023236-513ea8f21eb1 h1:zga7zaRE8HCbWjcXMDlfvmQtH0/kMVLo7cQ48dy6kWg=
268+
github.com/go-http-utils/etag v0.0.0-20161124023236-513ea8f21eb1/go.mod h1:PumS+5d59wmAGsZo6IfRpVNaJUq+6xjC4Utt/k8GO6Q=
269+
github.com/go-http-utils/fresh v0.0.0-20161124030543-7231e26a4b27 h1:O6yi4xa9b2DMosGsXzlMe2E9qXgXCVkRLCoRX+5amxI=
270+
github.com/go-http-utils/fresh v0.0.0-20161124030543-7231e26a4b27/go.mod h1:AYvN8omj7nKLmbcXS2dyABYU6JB1Lz1bHmkkq1kf4I4=
271+
github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a h1:v6zMvHuY9yue4+QkG/HQ/W67wvtQmWJ4SDo9aK/GIno=
272+
github.com/go-http-utils/headers v0.0.0-20181008091004-fed159eddc2a/go.mod h1:I79BieaU4fxrw4LMXby6q5OS9XnoR9UIKLOzDFjUmuw=
267273
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
268274
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
269275
github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=

server/http.go

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/evcc-io/evcc/core/site"
1010
"github.com/evcc-io/evcc/util"
1111
"github.com/evcc-io/evcc/util/telemetry"
12+
"github.com/go-http-utils/etag"
1213
"github.com/gorilla/handlers"
1314
"github.com/gorilla/mux"
1415
)
@@ -56,6 +57,9 @@ func NewHTTPd(addr string, hub *SocketHub) *HTTPd {
5657
// static - individual handlers per root and folders
5758
static := router.PathPrefix("/").Subrouter()
5859
static.Use(handlers.CompressHandler)
60+
static.Use(handlers.CompressHandler, func(h http.Handler) http.Handler {
61+
return etag.Handler(h, false)
62+
})
5963

6064
static.HandleFunc("/", indexHandler())
6165
for _, dir := range []string{"assets", "meta"} {

0 commit comments

Comments
 (0)