From 820b2af43a1f7f988df32d915395b65c3c85f4e7 Mon Sep 17 00:00:00 2001 From: Abiola Ibrahim Date: Thu, 4 Jun 2015 23:03:58 +0100 Subject: [PATCH] FastCGI: allow "unix:" prefix for unix sockets. --- middleware/fastcgi/fastcgi.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/middleware/fastcgi/fastcgi.go b/middleware/fastcgi/fastcgi.go index 2eae0668..bc305020 100644 --- a/middleware/fastcgi/fastcgi.go +++ b/middleware/fastcgi/fastcgi.go @@ -61,7 +61,10 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) var fcgi *FCGIClient // check if unix socket or tcp - if strings.HasPrefix(rule.Address, "/") { + if strings.HasPrefix(rule.Address, "/") || strings.HasPrefix(rule.Address, "unix:") { + if strings.HasPrefix(rule.Address, "unix:") { + rule.Address = rule.Address[len("unix:"):] + } fcgi, err = Dial("unix", rule.Address) } else { fcgi, err = Dial("tcp", rule.Address)