From 868671e2bc9e078ee19d02d22e7961abe0579fa5 Mon Sep 17 00:00:00 2001 From: ytti Date: Mon, 25 Mar 2013 11:06:00 +0200 Subject: [PATCH] allow binding to IPv6 addresses this fails, and is standard: puma -b 'tcp://[2001:6e8:288::a]:9999' this fails. and is non-standard but potentially acceptable to puma as port is mandatory argument: puma -b 'tcp://2001:6e8:288::a:9999' commit fixes the first issue, but is ghetto as hell, should be 1.8 .. 2.0 friendly --- lib/puma/binder.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/puma/binder.rb b/lib/puma/binder.rb index 548fa9d7..af31b1f6 100644 --- a/lib/puma/binder.rb +++ b/lib/puma/binder.rb @@ -163,6 +163,7 @@ module Puma # allow to accumulate before returning connection refused. # def add_tcp_listener(host, port, optimize_for_latency=true, backlog=1024) + host = host[1..-2] if host[0..0] == '[' s = TCPServer.new(host, port) if optimize_for_latency s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)