about summary refs log tree commit homepage
path: root/extras/proxy_pass.rb
diff options
context:
space:
mode:
Diffstat (limited to 'extras/proxy_pass.rb')
-rw-r--r--extras/proxy_pass.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/extras/proxy_pass.rb b/extras/proxy_pass.rb
index d435ebe..00adf18 100644
--- a/extras/proxy_pass.rb
+++ b/extras/proxy_pass.rb
@@ -112,12 +112,15 @@ class ProxyPass # :nodoc:
 
   def initialize(dest, timeout = 5)
     case dest
+    when %r{\Aunix:([^:]+)(?::(/.*))?\z}
+      path = $2
+      @sockaddr = Socket.sockaddr_un($1)
     when %r{\Ahttp://([^/]+)(/.*)?\z}
       path = $2
       host, port = $1.split(':')
       @sockaddr = Socket.sockaddr_in(port || 80, host)
     else
-      raise ArgumentError, "destination must be an HTTP URL"
+      raise ArgumentError, "destination must be an HTTP URL or unix: path"
     end
     init_path_vars(path)
     @pool = ConnPool.new
@@ -125,7 +128,7 @@ class ProxyPass # :nodoc:
   end
 
   def init_path_vars(path)
-    path ||= '$(fullpath)'
+    path ||= '$fullpath'
     # methods from Rack::Request we want:
     allow = %w(fullpath host_with_port host port url path)
     want = path.scan(/\$(\w+)/).flatten! || []