mirror of
https://github.com/caddyserver/caddy.git
synced 2024-11-29 20:24:11 +08: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.
32 lines
510 B
Go
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)
|
|
)
|