Changes for review comments.
@@ -10,7 +10,7 @@ import (
routeapi "github.com/openshift/origin/pkg/route/apis/route"
)
-// Generate a regular expression to match route hosts (and paths if any).
+// GenerateRouteRegexp generates a regular expression to match route hosts (and paths if any).
func GenerateRouteRegexp(hostname, path string, wildcard bool) string {
hostRE := regexp.QuoteMeta(hostname)
if wildcard {
@@ -28,7 +28,7 @@ func GenerateRouteRegexp(hostname, path string, wildcard bool) string {
// build the correct subpath regex, depending on whether path ends with a segment separator
var pathRE, subpathRE string
switch {
- case strings.TrimRight(path, "/") == "":
+ case len(strings.TrimRight(path, "/")) == 0:
// Special-case paths consisting solely of "/" to match a root request to "" as well
pathRE = ""
subpathRE = "(/.*)?"
@@ -43,7 +43,7 @@ func GenerateRouteRegexp(hostname, path string, wildcard bool) string {
return "^" + hostRE + portRE + pathRE + subpathRE + "$"
}
-// Generates the host name to use for serving/certificate matching.
+// GenCertificateHostName generates the host name to use for serving/certificate matching.
// If wildcard is set, a wildcard host name (*.<subdomain>) is generated.
func GenCertificateHostName(hostname string, wildcard bool) string {
if wildcard {
@@ -55,7 +55,7 @@ func GenCertificateHostName(hostname string, wildcard bool) string {
return hostname
}
-// Generates the backend name prefix based on the termination.
+// GenerateBackendNamePrefix generates the backend name prefix based on the termination.
func GenerateBackendNamePrefix(termination routeapi.TLSTerminationType) string {
prefix := "be_http"
switch termination {
