From 13869dea11babb7a3bb732f7d79d6465d41a113d Mon Sep 17 00:00:00 2001 From: Karl Matthias Date: Wed, 11 Jun 2014 11:14:43 -0700 Subject: [PATCH] We need to carry the path part of the URL for unix sockets. Docker-DCO-1.1-Signed-off-by: Karl Matthias (github: relistan) --- backends/dockerserver.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backends/dockerserver.go b/backends/dockerserver.go index f2f86fd683..fe71974811 100644 --- a/backends/dockerserver.go +++ b/backends/dockerserver.go @@ -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) }