Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Passenger Standalone is now compatible with IPv6.

  • Loading branch information...
commit d55e87b63e3448d0a83b159ec2edd15fdcf82305 1 parent 7e4541c
@FooBarWidget FooBarWidget authored
View
1  CHANGELOG
@@ -18,6 +18,7 @@ Release 4.0.38
the 4.0.37 release notes). The previous fix was incomplete, and still has a
(albeit smaller) small attack time window in between two filesystem
checks. This attack window is now gone.
+ * Passenger Standalone is now compatible with IPv6.
* Fixed some compilation problems on Solaris. See issue #1047.
* passenger-install-apache2-module and passenger-install-nginx-module
now automatically run in `--auto` mode if stdin is not a TTY. Fixes
View
2  debian.template/control.template
@@ -30,7 +30,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends},
#else
ruby-rack,
#endif
- ruby-daemon-controller
+ ruby-daemon-controller (>= 1.2.0)
Recommends: passenger-doc (= ${binary:Version}), passenger-dev (= ${binary:Version}),
crash-watch
Suggests: python
View
33 lib/phusion_passenger/standalone/start_command.rb
@@ -374,9 +374,9 @@ def check_port(host_name, port)
end
end
else
- def check_port(address, port)
+ def check_port_with_protocol(address, port, protocol)
begin
- socket = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
+ socket = Socket.new(protocol, Socket::Constants::SOCK_STREAM, 0)
sockaddr = Socket.pack_sockaddr_in(port, address)
begin
socket.connect_nonblock(sockaddr)
@@ -403,6 +403,14 @@ def check_port(address, port)
socket.close if socket && !socket.closed?
end
end
+
+ def check_port(address, port)
+ begin
+ check_port_with_protocol(address, port, Socket::Constants::AF_INET)
+ rescue Errno::EAFNOSUPPORT
+ check_port_with_protocol(address, port, Socket::Constants::AF_INET6)
+ end
+ end
end
def check_port_availability
@@ -435,9 +443,11 @@ def listen_url
else
scheme = "http"
end
- result = "#{scheme}://#{@options[:address]}"
- if @options[:port] != 80
- result << ":#{@options[:port]}"
+ result = "#{scheme}://"
+ if @options[:port] == 80
+ result << @options[:address]
+ else
+ result << compose_ip_and_port(@options[:address], @options[:port])
end
result << "/"
return result
@@ -695,7 +705,7 @@ def nginx_listen_address(options = @options, for_ping_port = false)
else
port = options[:port]
end
- return "#{options[:address]}:#{port}"
+ return compose_ip_and_port(options[:address], port)
end
end
@@ -703,7 +713,16 @@ def nginx_listen_address_with_ssl_port(options = @options)
if options[:socket_file]
return "unix:" + File.expand_path(options[:socket_file])
else
- return "#{options[:address]}:#{options[:ssl_port]}"
+ return compose_ip_and_port(options[:address], options[:ssl_port])
+ end
+ end
+
+ def compose_ip_and_port(ip, port)
+ if ip =~ /:/
+ # IPv6
+ return "[#{ip}]:#{port}"
+ else
+ return "#{ip}:#{port}"
end
end
View
2  passenger.gemspec
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
s.email = "software-signing@phusion.nl"
s.require_paths = ["lib"]
s.add_dependency 'rake', '>= 0.8.1'
- s.add_dependency 'daemon_controller', '>= 1.1.0'
+ s.add_dependency 'daemon_controller', '>= 1.2.0'
s.add_dependency 'rack'
s.files = Dir[*PhusionPassenger::Packaging::GLOB] -
Dir[*PhusionPassenger::Packaging::EXCLUDE_GLOB]
Please sign in to comment.
Something went wrong with that request. Please try again.