mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 21:15:56 +00:00
Cleanup of some old code
Remove the StaticCacheDuration unused package-level variable from context/context.go and /core/router/api_builder.go it should be removed a year ago, now all the cache funcs and middlewares accept their own options | Remove duplicated header keys that are used on both context/context.go and core/router/fs.go by exporting context's one. Former-commit-id: 2a5c840d26b32144d2b5b3173a1e4bb4324cecba
This commit is contained in:
@@ -549,23 +549,6 @@ func (api *APIBuilder) Any(relativePath string, handlers ...context.Handler) (ro
|
||||
return
|
||||
}
|
||||
|
||||
// StaticCacheDuration expiration duration for INACTIVE file handlers, it's the only one global configuration
|
||||
// which can be changed.
|
||||
var StaticCacheDuration = 20 * time.Second
|
||||
|
||||
const (
|
||||
lastModifiedHeaderKey = "Last-Modified"
|
||||
ifModifiedSinceHeaderKey = "If-Modified-Since"
|
||||
contentDispositionHeaderKey = "Content-Disposition"
|
||||
cacheControlHeaderKey = "Cache-Control"
|
||||
contentEncodingHeaderKey = "Content-Encoding"
|
||||
acceptEncodingHeaderKey = "Accept-Encoding"
|
||||
// contentLengthHeaderKey represents the header["Content-Length"]
|
||||
contentLengthHeaderKey = "Content-Length"
|
||||
contentTypeHeaderKey = "Content-Type"
|
||||
varyHeaderKey = "Vary"
|
||||
)
|
||||
|
||||
func (api *APIBuilder) registerResourceRoute(reqPath string, h context.Handler) *Route {
|
||||
api.Head(reqPath, h)
|
||||
return api.Get(reqPath, h)
|
||||
|
||||
@@ -517,8 +517,8 @@ func serveContent(ctx context.Context, name string, modtime time.Time, sizeFunc
|
||||
}()
|
||||
}
|
||||
ctx.Header("Accept-Ranges", "bytes")
|
||||
if ctx.ResponseWriter().Header().Get(contentEncodingHeaderKey) == "" {
|
||||
ctx.Header(contentLengthHeaderKey, strconv.FormatInt(sendSize, 10))
|
||||
if ctx.ResponseWriter().Header().Get(context.ContentEncodingHeaderKey) == "" {
|
||||
ctx.Header(context.ContentLengthHeaderKey, strconv.FormatInt(sendSize, 10))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user