mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-04 03:27:23 -05:00 
			
		
		
		
	templates: Fix httpInclude (fix #5698)
Allowable during feature freeze because this is a simple, non-invasive bug fix only.
This commit is contained in:
		
							parent
							
								
									a8cc5d1a7d
								
							
						
					
					
						commit
						431adc0980
					
				@ -245,14 +245,16 @@ type Server struct {
 | 
			
		||||
// ServeHTTP is the entry point for all HTTP requests.
 | 
			
		||||
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 | 
			
		||||
	// If there are listener wrappers that process tls connections but don't return a *tls.Conn, this field will be nil.
 | 
			
		||||
	// Can be removed if https://github.com/golang/go/pull/56110 is ever merged.
 | 
			
		||||
	// TODO: Can be removed if https://github.com/golang/go/pull/56110 is ever merged.
 | 
			
		||||
	if r.TLS == nil {
 | 
			
		||||
		conn := r.Context().Value(ConnCtxKey).(net.Conn)
 | 
			
		||||
		// not all requests have a conn (like virtual requests) - see #5698
 | 
			
		||||
		if conn, ok := r.Context().Value(ConnCtxKey).(net.Conn); ok {
 | 
			
		||||
			if csc, ok := conn.(connectionStateConn); ok {
 | 
			
		||||
				r.TLS = new(tls.ConnectionState)
 | 
			
		||||
				*r.TLS = csc.ConnectionState()
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	w.Header().Set("Server", "Caddy")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user