From f91f42464d79364fa7de990d380d06dbd003fc6c Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 25 Nov 2020 21:43:50 -0800 Subject: [PATCH] Use case insensitive comparison when matching vhost --- config.go | 2 ++ server.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/config.go b/config.go index bb2a768..ff877d6 100644 --- a/config.go +++ b/config.go @@ -152,6 +152,8 @@ func readconfig(configPath string) error { config.fcgiPools = make(map[string]gofast.ConnFactory) for hostname, host := range config.Hosts { + hostname = strings.ToLower(hostname) + if defaultHost != nil { if host.Cert == "" { host.Cert = defaultHost.Cert diff --git a/server.go b/server.go index 4025483..e1ab0f0 100644 --- a/server.go +++ b/server.go @@ -389,6 +389,10 @@ func handleConn(c *tls.Conn) { return } + if request.Scheme == "gemini" { + request.Host = strings.ToLower(request.Host) + } + status, size, logPath = handleRequest(c, request, requestData) }