caddy/caddyhttp/push/push.go
Thomas De Keulenaer 20f76a256e Push resources for indexFiles when surfing to directories
Use httpserver.IndexFile() to determine index files

Test if middleware pushes indexfile when requesting directory

Fix codereview issues

Serve original request first, push later

Revert "Serve original request first, push later"

This reverts commit 2c66f01115747e5665ba7f2d33e2fd551dc31877.
2017-07-24 12:36:07 +02:00

32 lines
510 B
Go

package push
import (
"net/http"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
type (
// Rule describes conditions on which resources will be pushed
Rule struct {
Path string
Resources []Resource
}
// Resource describes resource to be pushed
Resource struct {
Path string
Method string
Header http.Header
}
// Middleware supports pushing resources to clients
Middleware struct {
Next httpserver.Handler
Rules []Rule
Root http.FileSystem
}
ruleOp func([]Resource)
)