fix IPv6 address fact detection

This commit is contained in:
Matthew Haughton 2013-11-21 22:32:23 -05:00
parent 4204dc908b
commit 3024f2927d
2 changed files with 25 additions and 25 deletions

View file

@ -290,39 +290,39 @@ describe 'nginx::resource::vhost' do
# {
# :title => 'should enable IPv6',
# :attr => 'ipv6_enable',
# :value => 'true',
# :match => ' listen [::]:80 default ipv6only=on;',
# },
# {
# :title => 'should enable IPv6',
# :attr => 'ipv6_enable',
# :value => true,
# :match => ' listen [::]:80 default ipv6only=on;',
# },
{
:title => 'should enable IPv6',
:attr => 'ipv6_enable',
:value => 'true',
:match => ' listen [::]:80 default ipv6only=on;',
},
{
:title => 'should disable IPv6',
:attr => 'ipv6_enable',
:value => 'false',
:notmatch => ' listen [::]:80 default ipv6only=on;',
},
# {
# :title => 'should set the IPv6 listen IP',
# :attr => 'ipv6_listen_ip',
# :value => '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
# :match => ' listen [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80 default ipv6only=on;',
# },
# {
# :title => 'should set the IPv6 listen port',
# :attr => 'ipv6_listen_port',
# :value => '45',
# :match => ' listen [::]:45 default ipv6only=on;',
# },
# {
# :title => 'should set the IPv6 listen options',
# :attr => 'ipv6_listen_options',
# :value => 'spdy default',
# :match => ' listen [::]:80 spdy default ipv6only=on;',
# },
{
:title => 'should set the IPv6 listen IP',
:attr => 'ipv6_listen_ip',
:value => '2001:0db8:85a3:0000:0000:8a2e:0370:7334',
:match => ' listen [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:80 default ipv6only=on;',
},
{
:title => 'should set the IPv6 listen port',
:attr => 'ipv6_listen_port',
:value => '45',
:match => ' listen [::]:45 default ipv6only=on;',
},
{
:title => 'should set the IPv6 listen options',
:attr => 'ipv6_listen_options',
:value => 'spdy default',
:match => ' listen [::]:80 spdy default ipv6only=on;',
},
{
:title => 'should set servername(s)',
:attr => 'server_name',

View file

@ -1,6 +1,6 @@
server {
listen <%= @listen_ip %>:<%= @ssl_port %> ssl<% if @spdy == 'on' %> spdy<% end %><% if @listen_options %><%= @listen_options %><% end %>;
<% if @ipv6_enable == 'true' && (defined? ipaddress6) %>
<% if @ipv6_enable == 'true' && (defined? @ipaddress6) %>
listen [<%= @ipv6_listen_ip %>]:<%= @ipv6_listen_port %> <% if @ipv6_listen_options %><%= @ipv6_listen_options %><% end %> ipv6only=on;
<% end %>
server_name <%= @rewrite_www_to_non_www ? @name.gsub(/^www\./, '') : @server_name.join(" ") %>;