Skip to content

Commit

Permalink
internal/httpsvc: Join host/port with net helper
Browse files Browse the repository at this point in the history
Ensures we take an ipv6 address w/o brackets which matches the existing flags

Updates projectcontour#3284

Signed-off-by: Sunjay Bhatia <sunjayb@vmware.com>
  • Loading branch information
sunjayBhatia committed Apr 14, 2021
1 parent 4dde19d commit 644a7bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/contour/serve.go
Expand Up @@ -136,7 +136,7 @@ func registerServe(app *kingpin.Application) (*kingpin.CmdClause, *serveContext)
serve.Flag("ingress-status-address", "Address to set in Ingress object status.").PlaceHolder("<address>").StringVar(&ctx.Config.IngressStatusAddress)
serve.Flag("envoy-http-access-log", "Envoy HTTP access log.").PlaceHolder("/path/to/file").StringVar(&ctx.httpAccessLog)
serve.Flag("envoy-https-access-log", "Envoy HTTPS access log.").PlaceHolder("/path/to/file").StringVar(&ctx.httpsAccessLog)
serve.Flag("envoy-service-http-address", "Kubernetes Service address for HTTP requests.").PlaceHolder("ipaddr").StringVar(&ctx.httpAddr)
serve.Flag("envoy-service-http-address", "Kubernetes Service address for HTTP requests.").PlaceHolder("<ipaddr>").StringVar(&ctx.httpAddr)
serve.Flag("envoy-service-https-address", "Kubernetes Service address for HTTPS requests.").PlaceHolder("<ipaddr>").StringVar(&ctx.httpsAddr)
serve.Flag("envoy-service-http-port", "Kubernetes Service port for HTTP requests.").PlaceHolder("<port>").IntVar(&ctx.httpPort)
serve.Flag("envoy-service-https-port", "Kubernetes Service port for HTTPS requests.").PlaceHolder("<port>").IntVar(&ctx.httpsPort)
Expand Down
5 changes: 3 additions & 2 deletions internal/httpsvc/http.go
Expand Up @@ -17,8 +17,9 @@ package httpsvc

import (
"context"
"fmt"
"net"
"net/http"
"strconv"
"time"

"github.com/sirupsen/logrus"
Expand All @@ -45,7 +46,7 @@ func (svc *Service) Start(stop <-chan struct{}) (err error) {
}()

s := http.Server{
Addr: fmt.Sprintf("%s:%d", svc.Addr, svc.Port),
Addr: net.JoinHostPort(svc.Addr, strconv.Itoa(svc.Port)),
Handler: &svc.ServeMux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 5 * time.Minute, // allow for long trace requests
Expand Down

0 comments on commit 644a7bb

Please sign in to comment.