~ubuntu-branches/ubuntu/raring/liburi-perl/raring

« back to all changes in this revision

Viewing changes to URI/_server.pm

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Yu
  • Date: 2010-01-15 14:58:48 UTC
  • mfrom: (6.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100115145848-jsdh0ii0tt1ex4i7
Tags: 1.52-1
* New upstream release
* Add a patch to fix wide character warnings

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
sub _host_escape {
22
22
    return unless $_[0] =~ /[^URI::uric]/;
23
 
    require URI::_idna;
24
 
    $_[0] = URI::_idna::encode($_[0]);
 
23
    eval {
 
24
        require URI::_idna;
 
25
        $_[0] = URI::_idna::encode($_[0]);
 
26
    };
 
27
    return 0 if $@;
25
28
    return 1;
26
29
}
27
30
 
34
37
            my $ui = $host =~ s/(.*@)// ? $1 : "";
35
38
            my $port = $host =~ s/(:\d+)\z// ? $1 : "";
36
39
            require URI::_idna;
37
 
            $host = URI::_idna::encode($host);
 
40
            $host = URI::_idna::decode($host);
38
41
            $str = "$scheme//$ui$host$port$rest";
39
42
        }
40
43
    }