X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=tls.go;h=0fb4ae14c2c69dddc554b77f16861ec00005e10a;hb=df6f0b184c5689eab0a4b4be4769902200f2b241;hp=05d21db2fc6dffc8ea117e3808a4ba0a10f5b152;hpb=12ef431d87442cac2111a0d3af3d13017e695348;p=tofuproxy.git diff --git a/tls.go b/tls.go index 05d21db..0fb4ae1 100644 --- a/tls.go +++ b/tls.go @@ -25,8 +25,9 @@ import ( "fmt" "log" "net/http" - "strings" "time" + + ttls "go.stargrave.org/tofuproxy/tls" ) var ( @@ -57,7 +58,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request) { req.Proto, http.StatusOK, http.StatusText(http.StatusOK), ))) - host := strings.Split(req.Host, ":")[0] + host, _, _ := ttls.SplitHostPort(req.Host) hostCertsM.Lock() keypair, ok := hostCerts[host] if !ok || !keypair.cert.NotAfter.After(time.Now().Add(time.Hour)) {