Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7382

Show
Ignore:
Timestamp:
08/31/07 19:03:42 (1 year ago)
Author:
bitsweat
Message:

request.host works with IPv6 addresses. Closes #9458.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r7346 r7382  
    11*SVN* 
     2 
     3* request.host works with IPv6 addresses.  #9458 [yuya] 
    24 
    35* Fix bug where action caching sets the content type to the ActionCachePath object.  Closes #9282 [mindforge] 
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r7084 r7382  
    9393 
    9494    def host 
    95       host_with_port[/^[^:]+/] 
     95      host_with_port.sub(/:\d+$/, '') 
    9696    end 
    9797 
  • trunk/actionpack/test/controller/cgi_test.rb

    r7084 r7382  
    4848  end 
    4949 
     50  def test_host_if_ipv6_reference 
     51    @request_hash.delete "HTTP_X_FORWARDED_HOST" 
     52    @request_hash['HTTP_HOST'] = "[2001:1234:5678:9abc:def0::dead:beef]" 
     53    assert_equal "[2001:1234:5678:9abc:def0::dead:beef]", @request.host 
     54  end 
     55 
     56  def test_host_if_ipv6_reference_with_port 
     57    @request_hash.delete "HTTP_X_FORWARDED_HOST" 
     58    @request_hash['HTTP_HOST'] = "[2001:1234:5678:9abc:def0::dead:beef]:8008" 
     59    assert_equal "[2001:1234:5678:9abc:def0::dead:beef]", @request.host 
     60  end 
     61 
    5062  def test_cookie_syntax_resilience 
    5163    cookies = CGI::Cookie::parse(@request_hash["HTTP_COOKIE"]);