mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-23 22:27:38 -05:00
20f76a256e
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.
31 lines
510 B
Go
31 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)
|
|
)
|