func (cfg Config) httpsHandler(httpHandler, httpsRedirectHandler http.Handler, p Parameters, template *template.Template, monitor http.Handler) http.HandlerFunc {
	getHandler := p.getHandler(cfg, template, monitor)
	postHandler := p.postHandler()
	return func(w http.ResponseWriter, r *http.Request) {
		switch {
		case r.TLS == nil && !cfg.NoTLSRedirect:
			httpHandler.ServeHTTP(w, r)
		case r.TLS == nil && cfg.NoTLSRedirect && !hasSecHeader(r):
			httpsRedirectHandler.ServeHTTP(w, r)
		case r.Method == "GET":
			getHandler.ServeHTTP(w, r)
		case r.Method == "POST":
			postHandler.ServeHTTP(w, r)
		default:
			httpError(w, http.StatusMethodNotAllowed)
		}
	}
}
// httpsHandler creates a handler for HTTPS endpoints.
// Non-TLS requests are redirected to HTTPS.  GET and POST requests are handled by more specific handlers.
httpsHandler creates a handler for HTTPS endpoints.
Non-TLS requests are redirected to HTTPS.  GET and POST requests are handled by more specific handlers.
// httpsHandler creates a handler for HTTPS endpoints . // Non - TLS requests are redirected to HTTPS . GET and POST requests are handled by more specific handlers .
func (cfg Config) httpsHandler(httpHandler, httpsRedirectHandler http.Handler, p Parameters, template *template.Template, monitor http.Handler) http.HandlerFunc {
	getHandler := p.getHandler(cfg, template, monitor)
	postHandler := p.postHandler()
	return func(w http.ResponseWriter, r *http.Request) {
		switch {
		case r.TLS == nil && !cfg.NoTLSRedirect:
			httpHandler.ServeHTTP(w, r)
		case r.TLS == nil && cfg.NoTLSRedirect && !hasSecHeader(r):
			httpsRedirectHandler.ServeHTTP(w, r)
		case r.Method == "GET":
			getHandler.ServeHTTP(w, r)
		case r.Method == "POST":
			postHandler.ServeHTTP(w, r)
		default:
			httpError(w, http.StatusMethodNotAllowed)
		}
	}
}
func ( cfg Config ) httpsHandler ( httpHandler , httpsRedirectHandler http . Handler , p Parameters , template * template . Template , monitor http . Handler ) http . HandlerFunc { getHandler := p . getHandler ( cfg , template , monitor ) postHandler := p . postHandler ( ) return func ( w http . ResponseWriter , r * http . Request ) { switch { case r . TLS == nil && ! cfg . NoTLSRedirect : httpHandler . ServeHTTP ( w , r ) case r . TLS == nil && cfg . NoTLSRedirect && ! hasSecHeader ( r ) : httpsRedirectHandler . ServeHTTP ( w , r ) case r . Method == " " : getHandler . ServeHTTP ( w , r ) case r . Method == " " : postHandler . ServeHTTP ( w , r ) default : httpError ( w , http . StatusMethodNotAllowed ) } } }
httpsHandler creates a handler for HTTPS endpoints.
httpsHandler creates a handler for HTTPS endpoints .