summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/headers
diff options
context:
space:
mode:
authorMatt Holt <mholt@users.noreply.github.com>2020-07-20 12:28:40 -0600
committerGitHub <noreply@github.com>2020-07-20 12:28:40 -0600
commit6cea1f239d01fc065bc6f4b22d765d89b6db0152 (patch)
tree3ba2664e1beeb1034f400038749845fa7c08e243 /modules/caddyhttp/headers
parent2ae8c119279826ef81223e3b2155a08779f3ee8b (diff)
push: Implement HTTP/2 server push (#3573)
* push: Implement HTTP/2 server push (close #3551) * push: Abstract header ops by embedding into new struct type This will allow us to add more fields to customize headers in push-specific ways in the future. * push: Ensure Link resources are pushed before response is written * Change header name from X-Caddy-Push to Caddy-Push
Diffstat (limited to 'modules/caddyhttp/headers')
-rw-r--r--modules/caddyhttp/headers/headers.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/caddyhttp/headers/headers.go b/modules/caddyhttp/headers/headers.go
index 681c21f..3571dd9 100644
--- a/modules/caddyhttp/headers/headers.go
+++ b/modules/caddyhttp/headers/headers.go
@@ -54,15 +54,15 @@ func (Handler) CaddyModule() caddy.ModuleInfo {
}
// Provision sets up h's configuration.
-func (h *Handler) Provision(_ caddy.Context) error {
+func (h *Handler) Provision(ctx caddy.Context) error {
if h.Request != nil {
- err := h.Request.provision()
+ err := h.Request.Provision(ctx)
if err != nil {
return err
}
}
if h.Response != nil {
- err := h.Response.provision()
+ err := h.Response.Provision(ctx)
if err != nil {
return err
}
@@ -125,7 +125,8 @@ type HeaderOps struct {
Replace map[string][]Replacement `json:"replace,omitempty"`
}
-func (ops *HeaderOps) provision() error {
+// Provision sets up the header operations.
+func (ops *HeaderOps) Provision(_ caddy.Context) error {
for fieldName, replacements := range ops.Replace {
for i, r := range replacements {
if r.SearchRegexp != "" {