Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

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

#1449

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

Reported by John Barker · November 23rd, 2008 @ 03:40 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. John Barker
    John Barker

    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.

    November 27th, 2008 @ 10:33 PM

  2. Bob Aman
    Bob Aman
    • 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
    

    March 10th, 2009 @ 04:34 PM

  3. Prem Sichanugrist (sikachu)