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

Changeset 8088

Show
Ignore:
Timestamp:
11/06/07 16:36:10 (1 year ago)
Author:
david
Message:

Fixed that ActionController::CgiRequest#host_with_port() should handle standard port (closes #10082) [moro]

Files:

Legend:

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

    r8087 r8088  
    11*SVN* 
     2 
     3* Fixed that ActionController::CgiRequest#host_with_port() should handle standard port #10082 [moro] 
    24 
    35* Update Prototype to 1.6.0 and script.aculo.us to 1.8.0.  [sam, madrobby] 
  • trunk/actionpack/lib/action_controller/cgi_process.rb

    r7727 r8088  
    8383    end 
    8484 
    85     def host_with_port 
     85    def host_with_port_without_standard_port_handling 
    8686      if forwarded = env["HTTP_X_FORWARDED_HOST"] 
    8787        forwarded.split(/,\s?/).last 
     
    9696 
    9797    def host 
    98       host_with_port.sub(/:\d+$/, '') 
     98      host_with_port_without_standard_port_handling.sub(/:\d+$/, '') 
    9999    end 
    100100 
    101101    def port 
    102       if host_with_port =~ /:(\d+)$/ 
     102      if host_with_port_without_standard_port_handling =~ /:(\d+)$/ 
    103103        $1.to_i 
    104104      else 
  • trunk/actionpack/test/controller/cgi_test.rb

    r7382 r8088  
    4646    @request_hash.delete "SERVER_NAME" 
    4747    assert_equal "207.7.108.53:8007", @request.host_with_port 
     48  end 
     49 
     50  def test_host_with_port_if_http_standard_port_is_specified 
     51    @request_hash['HTTP_X_FORWARDED_HOST'] = "glu.ttono.us:80" 
     52    assert_equal "glu.ttono.us", @request.host_with_port 
     53  end 
     54 
     55  def test_host_with_port_if_https_standard_port_is_specified 
     56    @request_hash['HTTP_X_FORWARDED_PROTO'] = "https" 
     57    @request_hash['HTTP_X_FORWARDED_HOST'] = "glu.ttono.us:443" 
     58    assert_equal "glu.ttono.us", @request.host_with_port 
    4859  end 
    4960 
  • trunk/railties/CHANGELOG

    r8087 r8088  
    11*SVN* 
     2 
     3* Added --skip-timestamps to generators that produce models #10036 [tpope] 
    24 
    35* Update Prototype to 1.6.0 and script.aculo.us to 1.8.0.  [sam, madrobby] 
     
    2628* Removed calls to fixtures in generated tests as fixtures :all is now present by default in test_helper.rb [DHH] 
    2729 
    28  
    2930* Add --prefix option to script/server when using mongrel. [dacat] 
     31 
    3032 
    3133*2.0.0 [Preview Release]* (September 29th, 2007) [Includes duplicates of changes from 1.1.4 - 1.2.3]