• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/CPANInternal-140/URI/t/

Lines Matching refs:url

3 use URI::URL qw(url);
85 $url = new URI::URL "x-myscheme:something";
88 $url->_expect('as_string' => 'x-myscheme:something');
89 $url->_expect('path' => 'something');
114 $url = new URI::URL 'x-a+b.c://foo/bar;a?b';
115 $url->_expect('as_string', 'x-a+b.c://foo/bar;a?b');
116 $url->_expect('path', '/bar;a?b');
117 $url->foo;
118 $newurl = new URI::URL 'xxx', $url;
120 $url = new URI::URL 'yyy', 'x-foo:';
121 $url->foo;
128 print "not " if url("../foo.html", "http://www.sn.no/a/b")->abs->as_string
258 my $url = new URI::URL $url_str;
262 $url->_expect($method, $exp);
280 $url = new URI::URL 'file://web/orig/path';
281 $url->scheme('http');
282 $url->path('1info');
283 $url->query('key words');
284 $url->frag('this');
285 $url->_expect('as_string' => 'http://web/1info?key%20words#this');
287 $url->epath('%2f/%2f');
288 $url->equery('a=%26');
289 $url->_expect('full_path' => '/%2f/%2f?a=%26');
293 eval { my $p = $url->path; print "Path is $p\n"; };
295 eval { my $p = $url->query; print "Query is $p\n"; };
299 $url->path("howdy");
300 $url->_expect('as_string' => 'http://web/howdy?a=%26#this');
303 $url = new URI::URL 'file:%2f/%2f';
305 $p = join('-', $url->path_components);
306 die "\$url->path_components returns '$p', expected '/-/'"
308 $url->host("localhost");
309 $p = join('-', $url->path_components);
310 die "\$url->path_components returns '$p', expected '-/-/'"
312 $url->epath("/foo/bar/");
313 $p = join('-', $url->path_components);
314 die "\$url->path_components returns '$p', expected '-foo-bar-'"
316 $url->path_components("", "/etc", "\0", "..", "�se", "");
317 $url->_expect('full_path' => '/%2Fetc/%00/../%F8se/');
320 $url = new URI::URL 'http://web/p;p?q#f';
321 $url->epath(undef);
322 $url->equery(undef);
323 $url->eparams(undef);
324 $url->frag(undef);
325 $url->_expect('as_string' => 'http://web');
328 $url->keywords('dog');
329 $url->_expect('as_string' => 'http://web?dog');
330 $url->keywords(qw(dog bones));
331 $url->_expect('as_string' => 'http://web?dog+bones');
332 $url->keywords(0,0);
333 $url->_expect('as_string' => 'http://web?0+0');
334 $url->keywords('dog', 'bones', '#+=');
335 $url->_expect('as_string' => 'http://web?dog+bones+%23%2B%3D');
336 $a = join(":", $url->keywords);
337 die "\$url->keywords did not work (returned '$a')" unless $a eq 'dog:bones:#+=';
339 # eval { my $foo = $url->query_form; };
340 # die "\$url->query_form should croak since query contains keywords not a form."
343 $url->query_form(a => 'foo', b => 'bar');
344 $url->_expect('as_string' => 'http://web?a=foo&b=bar');
345 my %a = $url->query_form;
346 die "\$url->query_form did not work"
349 $url->query_form(a => undef, a => 'foo', '&=' => '&=+');
350 $url->_expect('as_string' => 'http://web?a=&a=foo&%26%3D=%26%3D%2B');
352 my @a = $url->query_form;
360 # eval { my $foo = $url->keywords; };
361 # die "\$url->keywords should croak when query is a form"
364 $url->equery('&=&=b&a=&a&a=b=c&&a=b');
365 @a = $url->query_form;
372 $url->query_form(a => ['foo', 'bar'], b => 'foo', c => ['bar', 'foo']);
373 $url->_expect('as_string', 'http://web?a=foo&a=bar&b=foo&c=bar&c=foo');
379 $url->query(undef);
380 $url->_expect('query', undef);
382 $url = new URI::URL 'gopher://gopher/';
383 $url->port(33);
384 $url->gtype("3");
385 $url->selector("S");
386 $url->search("query");
387 $url->_expect('as_string', 'gopher://gopher:33/3S%09query');
389 $url->epath("45%09a");
390 $url->_expect('gtype' => '4');
391 $url->_expect('selector' => '5');
392 $url->_expect('search' => 'a');
393 $url->_expect('string' => undef);
394 $url->_expect('path' => "/45\ta");
395 # $url->path("00\t%09gisle");
396 # $url->_expect('search', '%09gisle');
399 $url = new URI::URL 'news:';
400 $url->group("comp.lang.perl.misc");
401 $url->_expect('as_string' => 'news:comp.lang.perl.misc');
402 $url->article('<1234@a.sn.no>');
403 $url->_expect('as_string' => 'news:1234@a.sn.no'); # "<" and ">" are gone
405 eval { $url->article("no.perl"); };
408 # $url = new URI::URL 'mailto:';
409 # $url->user("aas");
410 # $url->host("a.sn.no");
411 # $url->_expect("as_string" => 'mailto:aas@a.sn.no');
412 # $url->address('foo@bar');
413 # $url->_expect("host" => 'bar');
414 # $url->_expect("user" => 'foo');
416 # $url = new URI::URL 'wais://host/database/wt/wpath';
417 # $url->database('foo');
418 # $url->_expect('as_string' => 'wais://host/foo/wt/wpath');
419 # $url->wtype('bar');
420 # $url->_expect('as_string' => 'wais://host/foo/bar/wpath');
477 my $url = new URI::URL 'ftp://anonymous:p%61ss@h�st:12345';
478 $url->_expect('user', 'anonymous');
479 $url->_expect('password', 'pass');
480 $url->_expect('host', 'h�st');
481 $url->_expect('port', 12345);
483 #$url->_expect('netloc', 'anonymous:pass@hst:12345');
484 $url->_expect('as_string' => 'ftp://anonymous:pass@h%E5st:12345');
487 $url->user(0);
488 $url->password(0);
489 $url->host(0);
490 $url->port(0);
491 $url->_expect('netloc' => '0:0@0:0');
492 $url->host(undef);
493 $url->_expect('netloc' => '0:0@:0');
494 $url->host('h');
495 $url->user(undef);
496 $url->_expect('netloc' => ':0@h:0');
497 $url->user('');
498 $url->_expect('netloc' => ':0@h:0');
499 $url->password('');
500 $url->_expect('netloc' => ':@h:0');
501 $url->user('foo');
502 $url->_expect('netloc' => 'foo:@h:0');
505 $url->user('nemo');
506 $url->password('p2');
507 $url->host('hst2');
508 $url->port(2);
509 $url->_expect('netloc' => 'nemo:p2@hst2:2');
511 $url->user(undef);
512 $url->password(undef);
513 $url->port(undef);
514 $url->_expect('netloc' => 'hst2');
515 $url->_expect('port' => '21'); # the default ftp port
517 $url->port(21);
518 $url->_expect('netloc' => 'hst2:21');
521 $url->user("@");
522 $url->password(":-#-;-/-?");
523 $url->_expect('as_string' => 'ftp://%40::-%23-;-%2F-%3F@hst2:21');
535 $url = URI::URL->new('http://foo/root/dir/');
536 my $port = $url->port;
539 die "Wrong string" unless $url->as_string eq
542 $url->port(8001);
543 $port = $url->port;
546 die "Wrong string" unless $url->as_string eq
549 $url->port(80);
550 $port = $url->port;
553 die "Wrong string" unless $url->canonical->as_string eq
556 $url->port(8001);
557 $url->port(undef);
558 $port = $url->port;
561 die "Wrong string" unless $url->as_string eq
576 $url = new URI::URL 'http://web/this%20has%20spaces';
578 $url->_expect('path', '/this has spaces');
581 $url->path('this ALSO has spaces');
582 # check whole url is escaped
583 $url->_expect('as_string',
586 $url = new URI::URL uri_escape('http://web/try %?#" those');
587 $url->_expect('as_string',
595 $url->path($all);
596 $url->_expect('full_path' => q(%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23$%&'()*+,-./0123456789:;%3C=%3E%3F@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF));
599 $url = new URI::URL 'file://h/';
600 $url->path(chr(0x7F));
601 $url->_expect('as_string', 'file://h/%7F');
607 $url = new URI::URL 'file://h/test?ing';
608 $url->_expect('path', '/test?ing');
610 $url = new URI::URL 'file://h/';
611 $url->epath('question?mark');
612 $url->_expect('as_string', 'file://h/question?mark');
615 $url->path('question?mark');
616 $url->_expect('as_string', 'file://h/question%3Fmark');
620 $url->path($reserved . "foo");
621 $url->_expect('as_string', 'file://h/%3B/%3F%3A%40%26%3D%23%25foo');
623 $url->scheme('http');
624 $url->path('');
625 $url->_expect('as_string', 'http://h/');
626 $url->query($reserved);
627 $url->params($reserved);
628 $url->frag($reserved);
629 $url->_expect('as_string', 'http://h/;%3B%2F%3F%3A%40&=%23%25?%3B%2F%3F%3A%40&=%23%25#;/?:@&=#%');
631 $str = $url->as_string;
632 $url = new URI::URL $str;
633 die "URL changed" if $str ne $url->as_string;
635 $url = new URI::URL 'ftp:foo';
636 $url->user($reserved);
637 $url->host($reserved);
638 $url->_expect('as_string', 'ftp://%3B%2F%3F%3A%40%26%3D%23%25@%3B%2F%3F%3A%40%26%3D%23%25/foo');
685 $url = newlocal URI::URL;
687 $url->_expect('as_string', URI::URL->new("file:$ss$dir/")->as_string);
689 print "Local directory is ". $url->local_path . "\n";
694 $url = newlocal URI::URL '/usr/';
695 $url->_expect('as_string', 'file:/usr/');
698 $url = newlocal URI::URL '/vmunix';
699 $url->_expect('as_string', 'file:/vmunix');
713 $url = newlocal URI::URL 'foo';
714 $url->_expect('as_string', "file:$ss$dir/foo");
727 $url = newlocal URI::URL 'bar/';
728 $url->_expect('as_string', "file:$ss$dir/bar/");
737 $url = newlocal URI::URL '0';
738 $url->_expect('as_string', "file:$ss${dir}0");
742 $url = new URI::URL 'file:/c:/dos';
743 $url->_expect('dos_path', 'C:\\DOS');
744 $url->_expect('unix_path', '/c:/dos');
745 #$url->_expect('vms_path', '[C:]DOS');
746 $url->_expect('mac_path', 'UNDEF');
748 $url = new URI::URL 'file:/foo/bar';
749 $url->_expect('unix_path', '/foo/bar');
750 $url->_expect('mac_path', 'foo:bar');
753 # $url = new URI::URL 'file:';
754 # $url->_expect('unix_path', '/');
755 $url = new URI::URL 'file:/';
756 $url->_expect('unix_path', '/');
757 $url = new URI::URL 'file:.';
758 $url->_expect('unix_path', '.');
759 $url = new URI::URL 'file:./foo';
760 $url->_expect('unix_path', './foo');
761 $url = new URI::URL 'file:0';
762 $url->_expect('unix_path', '0');
763 $url = new URI::URL 'file:../../foo';
764 $url->_expect('unix_path', '../../foo');
765 $url = new URI::URL 'file:foo/../bar';
766 $url->_expect('unix_path', 'foo/../bar');
769 $url = new URI::URL 'file:foo/b%61r/Note.txt';
770 $url->_expect('unix_path', 'foo/bar/Note.txt');
771 $url->_expect('mac_path', ':foo:bar:Note.txt');
772 $url->_expect('dos_path', 'FOO\\BAR\\NOTE.TXT');
773 #$url->_expect('vms_path', '[.FOO.BAR]NOTE.TXT');
776 $url = new URI::URL 'file://vms.host.edu/disk$user/my/notes/note12345.txt';
777 # $url->_expect('vms_path', 'DISK$USER:[MY.NOTES]NOTE12345.TXT');
778 # $url->_expect('mac_path', 'disk$user:my:notes:note12345.txt');
792 # Tests from draft-ietf-uri-relative-url-06.txt
954 my($url, $base, $expected_abs) = @$_;
955 my $rel = new URI::URL $url, $base;
987 printf "url('$abs', '$base')->rel eq '$expect'\n";