1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00

We need to carry the path part of the URL for unix sockets.

Docker-DCO-1.1-Signed-off-by: Karl Matthias <karl@matthias.org> (github: relistan)
This commit is contained in:
Karl Matthias
2014-06-11 11:14:43 -07:00
committed by Karl Matthias
parent 9df5e94e1f
commit 13869dea11

View File

@@ -48,11 +48,19 @@ func listenAndServe(urlStr string, out beam.Sender) error {
return err
}
l, err := net.Listen(parsedUrl.Scheme, parsedUrl.Host)
var hostAndPath string
// For Unix sockets we need to capture the path as well as the host
if parsedUrl.Scheme == "unix" {
hostAndPath = "/" + parsedUrl.Host + parsedUrl.Path
} else {
hostAndPath = parsedUrl.Host
}
l, err := net.Listen(parsedUrl.Scheme, hostAndPath)
if err != nil {
return err
}
httpSrv := http.Server{Addr: parsedUrl.Host, Handler: r}
httpSrv := http.Server{Addr: hostAndPath, Handler: r}
return httpSrv.Serve(l)
}