mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-30 18:22:49 -04:00 
			
		
		
		
	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)
 | |
| )
 |