diff options
author | Matt Holt <mholt@users.noreply.github.com> | 2020-03-13 11:06:08 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-13 11:06:08 -0600 |
commit | 5a19db5dc2db7c02d0f99630a07a64cacb7f7b44 (patch) | |
tree | d820ee2920d97d7cf2faf0fd9541156e20c88d60 /caddyconfig/httpcaddyfile/addresses.go | |
parent | cfe85a9fe625fea55dc4f809fd91b5c061064508 (diff) |
v2: Implement 'pki' app powered by Smallstep for localhost certificates (#3125)
* pki: Initial commit of PKI app (WIP) (see #2502 and #3021)
* pki: Ability to use root/intermediates, and sign with root
* pki: Fix benign misnamings left over from copy+paste
* pki: Only install root if not already trusted
* Make HTTPS port the default; all names use auto-HTTPS; bug fixes
* Fix build - what happened to our CI tests??
* Fix go.mod
Diffstat (limited to 'caddyconfig/httpcaddyfile/addresses.go')
-rw-r--r-- | caddyconfig/httpcaddyfile/addresses.go | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/caddyconfig/httpcaddyfile/addresses.go b/caddyconfig/httpcaddyfile/addresses.go index 64c5d4f..2d17833 100644 --- a/caddyconfig/httpcaddyfile/addresses.go +++ b/caddyconfig/httpcaddyfile/addresses.go @@ -172,20 +172,14 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str httpsPort = strconv.Itoa(hsport.(int)) } - lnPort := DefaultPort + // default port is the HTTPS port + lnPort := httpsPort if addr.Port != "" { // port explicitly defined lnPort = addr.Port - } else if addr.Scheme != "" { + } else if addr.Scheme == "http" { // port inferred from scheme - if addr.Scheme == "http" { - lnPort = httpPort - } else if addr.Scheme == "https" { - lnPort = httpsPort - } - } else if certmagic.HostQualifies(addr.Host) { - // automatic HTTPS - lnPort = httpsPort + lnPort = httpPort } // error if scheme and port combination violate convention @@ -213,7 +207,6 @@ func (st *ServerType) listenerAddrsForServerBlockKey(sblock serverBlock, key str for lnStr := range listeners { listenersList = append(listenersList, lnStr) } - // sort.Strings(listenersList) // TODO: is sorting necessary? return listenersList, nil } @@ -317,9 +310,6 @@ func (a Address) String() string { // Normalize returns a normalized version of a. func (a Address) Normalize() Address { path := a.Path - if !caseSensitivePath { - path = strings.ToLower(path) - } // ensure host is normalized if it's an IP address host := a.Host @@ -357,10 +347,3 @@ func (a Address) Key() string { } return res } - -const ( - // DefaultPort is the default port to use. - DefaultPort = "2015" - - caseSensitivePath = false // TODO: Used? -) |