mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-04 03:27:23 -05:00 
			
		
		
		
	Add support for Alt-Svc headers (#892)
This commit is contained in:
		
							parent
							
								
									1fdc46e571
								
							
						
					
					
						commit
						81c4ea6be7
					
				@ -71,6 +71,7 @@ func NewServer(addr string, group []*SiteConfig) (*Server, error) {
 | 
				
			|||||||
	// Enable QUIC if desired
 | 
						// Enable QUIC if desired
 | 
				
			||||||
	if QUIC {
 | 
						if QUIC {
 | 
				
			||||||
		s.quicServer = &h2quic.Server{Server: s.Server}
 | 
							s.quicServer = &h2quic.Server{Server: s.Server}
 | 
				
			||||||
 | 
							s.Server.Handler = s.wrapWithSvcHeaders(s.Server.Handler)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// We have to bound our wg with one increment
 | 
						// We have to bound our wg with one increment
 | 
				
			||||||
@ -105,6 +106,13 @@ func NewServer(addr string, group []*SiteConfig) (*Server, error) {
 | 
				
			|||||||
	return s, nil
 | 
						return s, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (s *Server) wrapWithSvcHeaders(previousHandler http.Handler) http.HandlerFunc {
 | 
				
			||||||
 | 
						return func(w http.ResponseWriter, r *http.Request) {
 | 
				
			||||||
 | 
							s.quicServer.SetQuicHeaders(w.Header())
 | 
				
			||||||
 | 
							previousHandler.ServeHTTP(w, r)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Listen creates an active listener for s that can be
 | 
					// Listen creates an active listener for s that can be
 | 
				
			||||||
// used to serve requests.
 | 
					// used to serve requests.
 | 
				
			||||||
func (s *Server) Listen() (net.Listener, error) {
 | 
					func (s *Server) Listen() (net.Listener, error) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user