mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:37:24 -04:00 
			
		
		
		
	* WIP * HTTP2/Push for golang 1.8 * Push plugin completed for review * Correct build tag * Move push plugin position * Add build tags to tests * Gofmt that code * Add header/method validations * Load push plugin * Fixes for wrapping writers * Push after delivering file * Fixes, review changes * Remove build tags, support new syntax * Fix spelling * gofmt -s -w . * Gogland time * Add interface guards * gofmt * After review fixes
		
			
				
	
	
		
			31 lines
		
	
	
		
			486 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			486 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
 | |
| 	}
 | |
| 
 | |
| 	ruleOp func([]Resource)
 | |
| )
 |