1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

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:🅰️9999'

commit fixes the first issue, but is ghetto as hell, should be 1.8 .. 2.0 friendly
This commit is contained in:
ytti 2013-03-25 11:06:00 +02:00
parent 444c3c7dd7
commit 868671e2bc

View file

@ -163,6 +163,7 @@ module Puma
# allow to accumulate before returning connection refused. # allow to accumulate before returning connection refused.
# #
def add_tcp_listener(host, port, optimize_for_latency=true, backlog=1024) 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) s = TCPServer.new(host, port)
if optimize_for_latency if optimize_for_latency
s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)