summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/encode
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-12-23 12:45:35 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-12-23 12:45:35 -0700
commit95ed603de79c66ff76bfe7e42986a2fc8c7a1fa4 (patch)
tree1a788b8eba98f0c2e69e5816bac9c7cc09aca96f /modules/caddyhttp/encode
parentcbb405f6aaee046c9de9ffb4f07ca824d9eedeb1 (diff)
Improve godocs all around
These will be used in the new automated documentation system
Diffstat (limited to 'modules/caddyhttp/encode')
-rw-r--r--modules/caddyhttp/encode/brotli/brotli.go4
-rw-r--r--modules/caddyhttp/encode/encode.go12
2 files changed, 11 insertions, 5 deletions
diff --git a/modules/caddyhttp/encode/brotli/brotli.go b/modules/caddyhttp/encode/brotli/brotli.go
index 52bb205..fababd3 100644
--- a/modules/caddyhttp/encode/brotli/brotli.go
+++ b/modules/caddyhttp/encode/brotli/brotli.go
@@ -29,7 +29,9 @@ func init() {
}
// Brotli can create brotli encoders. Note that brotli
-// is not known for great encoding performance.
+// is not known for great encoding performance, and
+// its use during requests is discouraged; instead,
+// pre-compress the content instead.
type Brotli struct {
Quality *int `json:"quality,omitempty"`
}
diff --git a/modules/caddyhttp/encode/encode.go b/modules/caddyhttp/encode/encode.go
index c68f507..c3a1c23 100644
--- a/modules/caddyhttp/encode/encode.go
+++ b/modules/caddyhttp/encode/encode.go
@@ -39,9 +39,15 @@ func init() {
// Encode is a middleware which can encode responses.
type Encode struct {
+ // Selection of compression algorithms to choose from. The best one
+ // will be chosen based on the client's Accept-Encoding header.
EncodingsRaw caddy.ModuleMap `json:"encodings,omitempty" caddy:"namespace=http.encoders"`
- Prefer []string `json:"prefer,omitempty"`
- MinLength int `json:"minimum_length,omitempty"`
+
+ // If the client has no strong preference, choose this encoding. TODO: Not yet implemented
+ // Prefer []string `json:"prefer,omitempty"`
+
+ // Only encode responses that are at least this many bytes long.
+ MinLength int `json:"minimum_length,omitempty"`
writerPools map[string]*sync.Pool // TODO: these pools do not get reused through config reloads...
}
@@ -66,11 +72,9 @@ func (enc *Encode) Provision(ctx caddy.Context) error {
return fmt.Errorf("adding encoding %s: %v", modName, err)
}
}
-
if enc.MinLength == 0 {
enc.MinLength = defaultMinLength
}
-
return nil
}