Menu

#204 Relative links starting with ?

v1.6
closed-fixed
None
5
2006-04-07
2006-03-30
kelvintn
No

Give a base url of http://www.foobar.com/foo and
relative link of ?a=b, the URL spec specifies that the
absolute URL should be http://www.foobar.com/?a=b.
However, this is not how browsers work.

For an example, see the page links at the bottom of
http://technorati.com/search/idol

I suggest a patch to Page.java line 846

- url = new URL (new URL (base), link);

+ url = base.charAt(0) == '?' ? new URL(base +
link) : new URL (new URL (base), link);

Discussion

  • kelvintn

    kelvintn - 2006-03-30

    Logged In: YES
    user_id=1490288

    whoops. typo. the correct replacement line should be
    url = link.charAt(0) == '?' ? new URL(base + link) : new URL
    (new URL (base), link);

     
  • Derrick Oswald

    Derrick Oswald - 2006-04-07
    • milestone: --> v1.6
    • assigned_to: nobody --> derrickoswald
    • status: open --> closed-fixed
     
  • Derrick Oswald

    Derrick Oswald - 2006-04-07

    Logged In: YES
    user_id=605407

    Added overloaded methods taking boolean 'strict' flag on URL
    manipulators.

    Default is loose interpretation like most browsers.

     

Log in to post a comment.

MongoDB Logo MongoDB