From 5caa1ab57cfc9231ca8bce4954a7c608e7292b25 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Wed, 5 Jan 2022 19:50:52 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Matt Holt --- modules/caddyhttp/app.go | 2 +- modules/caddyhttp/httpredirectlistener.go | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/caddyhttp/app.go b/modules/caddyhttp/app.go index 17f4147c3fe..67f9d1d68fc 100644 --- a/modules/caddyhttp/app.go +++ b/modules/caddyhttp/app.go @@ -346,7 +346,7 @@ func (app *App) Start() error { // create HTTP redirect wrapper, which detects if // the request had HTTP bytes on the HTTPS port, and // triggers a redirect if so. - ln = NewHttpRedirectListener(ln) + ln = &httpRedirectListener{Listener: ln} // create TLS listener tlsCfg := srv.TLSConnPolicies.TLSConfig(app.ctx) diff --git a/modules/caddyhttp/httpredirectlistener.go b/modules/caddyhttp/httpredirectlistener.go index ac67573680f..38225a3d262 100644 --- a/modules/caddyhttp/httpredirectlistener.go +++ b/modules/caddyhttp/httpredirectlistener.go @@ -29,12 +29,6 @@ type httpRedirectListener struct { net.Listener } -// NewHttpRedirectListener wraps inner, handling -func NewHttpRedirectListener(inner net.Listener) net.Listener { - l := &httpRedirectListener{Listener: inner} - return l -} - // Accept waits for and returns the next connection to the listener, // wrapping it with a httpRedirectConn. func (l *httpRedirectListener) Accept() (net.Conn, error) {