This project is archived and is in readonly mode.

#1449 ✓wontfix
John Barker

Routing doesn't work with url that omits 0s such as 127.1, 10.1, 192.168.1

Reported by John Barker | November 23rd, 2008 @ 03:40 PM | in 2.x

Using a URL such as '10.1' (10.0.0.1) which is a correctly formatted IP address, the router seems to fail with the error:

No route matches "http:/" with {:method=>:get}

ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] gems version: 1.3.1 Rails 2.2.2

Comments and changes to this ticket

  • John Barker

    John Barker November 27th, 2008 @ 10:33 PM

    Adding the private method to ActionController::AbstractRequest

    
        # Expands an ip address specified in short format, e.g: 127.1 becomes 127.0.0.1
        def expand_address(address)
          unless address.nil? then
            new_address = address.dup
            (3 - address.count('.')).times { new_address.insert(new_address.rindex('.'), '.0') }
            return new_address
          end
          nil
        end
    

    and using it when returning ip addresses from remote_ip, this problem was resolved. Tested with 127.1, 127.0.1, 127.1.1.

  • Bob Aman

    Bob Aman March 10th, 2009 @ 04:34 PM

    • Tag set to url

    -1

    The method that etw supplied accepts inputs that it probably shouldn't ("127.", "127.1.", etc). And I'm not sure that supporting this is actually a good idea. It could be very confusing to have half of the formats supported by inet_aton() allowed within the routing system, but not the rest. Browsers generally don't support these formats, and it just seems like more work than it's worth to accept "2130706433" as a valid way of saying "127.0.0.1".

    Plus, as far as I know, even though inet_aton() generally accepts this form, most (all?) implementations of inet_pton() do not, and no RFC exists that says a URI's host component should be specified this way.

    From RFC 3986, Section 3.2.2

    The host subcomponent of authority is identified by an IP literal encapsulated within square brackets, an IPv4 address in dotted-decimal form, or a registered name.

    
         IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
         dec-octet   = DIGIT                 ; 0-9
                     / %x31-39 DIGIT         ; 10-99
                     / "1" 2DIGIT            ; 100-199
                     / "2" %x30-34 DIGIT     ; 200-249
                     / "25" %x30-35          ; 250-255
    
  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) January 20th, 2010 @ 05:38 PM

    • State changed from “new” to “wontfix”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Tags

Pages