|
|
@ -10,11 +10,11 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
type StaticContent struct { |
|
|
|
Type string |
|
|
|
Content []byte |
|
|
|
ETag string |
|
|
|
Type string |
|
|
|
Content []byte |
|
|
|
ETag string |
|
|
|
GZIPContent []byte |
|
|
|
GZIPETag string |
|
|
|
GZIPETag string |
|
|
|
} |
|
|
|
|
|
|
|
func (sc *StaticContent) Init() { |
|
|
@ -40,7 +40,7 @@ func (sc *StaticContent) Init() { |
|
|
|
|
|
|
|
// Using gzip encoding adds a minimum of 24 characters to the HTTP
|
|
|
|
// header, so only accept gzip encoding if we save that much or more
|
|
|
|
if (buf.Len()+24) < len(sc.Content) { |
|
|
|
if (buf.Len() + 24) < len(sc.Content) { |
|
|
|
sc.GZIPContent = buf.Bytes() |
|
|
|
sc.GZIPETag = fmt.Sprintf("%x", md5.Sum(sc.GZIPContent)) |
|
|
|
} |
|
|
|