Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Relative URI

by JavaFan (Canon)
on Apr 22, 2011 at 00:12 UTC ( #900742=note: print w/replies, xml ) Need Help??


in reply to Re^2: Relative URI
in thread Relative URI

He expects http://a.b.c/d/../e/ to be the same as http://a.b.c/e/.
If I read section 5.2 of RFC 3986 correctly, the OP quite rightly expects that to be.

Replies are listed 'Best First'.
Re^4: Relative URI
by ikegami (Pope) on Apr 22, 2011 at 07:08 UTC

    There is a violation of 5.2 elsewhere, though.

    use strict; use warnings; use Test::More tests => 1; use URI qw( ); # if defined(R.scheme) then # T.scheme = R.scheme; # T.authority = R.authority; # T.path = remove_dot_segments(R.path); # T.query = R.query; is( URI->new_abs('http://a.b.c/d/../e/', 'http://a.b.c/'), 'http://a.b +.c/e/' ); 1;
    1..1 not ok 1 # Failed test at a.pl line 8. # got: 'http://a.b.c/d/../e/' # expected: 'http://a.b.c/e/' # Looks like you failed 1 test of 1.

    I would except cannonical to implement 6.2.2.3. It does implement other similar rules.

    use strict; use warnings; use Test::More tests => 6; use URI qw( ); is( URI->new('hTtP://a.b.c/' )->canonical, 'http://a.b.c/', 'R +FC 3986, 6.2.2.1' ); is( URI->new('http://a.b.c/d/../e/')->canonical, 'http://a.b.c/e/', 'R +FC 3986, 6.2.2.3' ); is( URI->new('http://a.b.c' )->canonical, 'http://a.b.c/', 'R +FC 3986, 6.2.3' ); is( URI->new('http://a.b.c:' )->canonical, 'http://a.b.c/', 'R +FC 3986, 6.2.3' ); is( URI->new('http://a.b.c:/' )->canonical, 'http://a.b.c/', 'R +FC 3986, 6.2.3' ); is( URI->new('http://a.b.c:80/' )->canonical, 'http://a.b.c/', 'R +FC 3986, 6.2.3' ); 1;
    1..6 ok 1 - RFC 3986, 6.2.2.1 not ok 2 - RFC 3986, 6.2.2.3 # Failed test 'RFC 3986, 6.2.2.3' # at a.pl line 10. # got: 'http://a.b.c/d/../e/' # expected: 'http://a.b.c/e/' ok 3 - RFC 3986, 6.2.3 ok 4 - RFC 3986, 6.2.3 ok 5 - RFC 3986, 6.2.3 ok 6 - RFC 3986, 6.2.3 # Looks like you failed 1 test of 6.
Re^4: Relative URI
by ikegami (Pope) on Apr 22, 2011 at 06:58 UTC

    5.2 describes how to make an absolute uri from a (possibly) relative URL.

    In that context, "/d/../e/" is equivalent to "/e/", but the module already does that correctly.

    Update: 6.2.2.3 seems more relevant here.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://900742]
help
Chatterbox?
[marto]: yes, trying to do anything other than sideload to android via windows has always been more effort than linux
[Corion]: The inconvenient thing is that my Linux machine is in another room than my desktop, so I have to walk up to it while some device is hooked up to it, just to press "allow" for install tasks etc :-)
[Corion]: I see the Chuwi H9 Air, but at the price of 8 or 9 cheapo tablets, that
[Corion]: ... that's not that great for quasi-disposable devices ;)
[Eily]: can't you just remote connect to the linux machine ?
[marto]: IIRC the hiemdal suite made life much easier on windows, and people on XDA developers put out released of windows only pages for adb that made it less of a pain
[marto]: Eily you can't remote connect the physical device via USB ;)
[Corion]: Eily: Sure, that's what I do, but some things you need to do on the Android device directly, like when navigating the bootloader :-)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2018-05-23 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?