~ubuntu-branches/debian/squeeze/movabletype-opensource/squeeze

« back to all changes in this revision

Viewing changes to extlib/URI/_generic.pm

  • Committer: Bazaar Package Importer
  • Author(s): Dominic Hargreaves
  • Date: 2008-06-13 23:28:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080613232840-ya4jfxv1jgl45a3d
Tags: 4.2~rc2-1
* New upstream release candidate
* Update Standards-Version (no changes)
* Ensure that schema upgrade message is always seen

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        $$self = $1;
23
23
        my $rest = $3;
24
24
        if (defined $auth) {
25
 
            $auth =~ s/([^$ACHAR])/$URI::Escape::escapes{$1}/go;
 
25
            $auth =~ s/([^$ACHAR])/ URI::Escape::escape_char($1)/ego;
26
26
            $$self .= "//$auth";
27
27
        }
28
28
        _check_path($rest, $$self);
41
41
        my $rest = $3;
42
42
        my $new_path = shift;
43
43
        $new_path = "" unless defined $new_path;
44
 
        $new_path =~ s/([^$PCHAR])/$URI::Escape::escapes{$1}/go;
 
44
        $new_path =~ s/([^$PCHAR])/ URI::Escape::escape_char($1)/ego;
45
45
        _check_path($new_path, $$self);
46
46
        $$self .= $new_path . $rest;
47
47
    }
58
58
        my $rest = $3;
59
59
        my $new_path = shift;
60
60
        $new_path = "" unless defined $new_path;
61
 
        $new_path =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go;
 
61
        $new_path =~ s/([^$URI::uric])/ URI::Escape::escape_char($1)/ego;
62
62
        _check_path($new_path, $$self);
63
63
        $$self .= $new_path . $rest;
64
64
    }
71
71
    my $prefix;
72
72
    if ($pre =~ m,/,) {  # authority present
73
73
        $prefix = "/" if length($path) && $path !~ m,^[/?\#],;
74
 
    } else {
 
74
    }
 
75
    else {
75
76
        if ($path =~ m,^//,) {
76
77
            Carp::carp("Path starting with double slash is confusing")
77
78
                if $^W;
78
 
        } elsif (!length($pre) && $path =~ m,^[^:/?\#]+:,) {
 
79
        }
 
80
        elsif (!length($pre) && $path =~ m,^[^:/?\#]+:,) {
79
81
            Carp::carp("Path might look like scheme, './' prepended")
80
82
                if $^W;
81
83
            $prefix = "./";
96
98
                $seg[0] =~ s/%/%25/g;
97
99
                for (@seg) { s/;/%3B/g; }
98
100
                $_ = join(";", @seg);
99
 
            } else {
 
101
            }
 
102
            else {
100
103
                 s/%/%25/g; s/;/%3B/g;
101
104
            }
102
105
            s,/,%2F,g;
138
141
    my $path = $self->path;
139
142
    return $abs if $path =~ m,^/,;
140
143
 
141
 
    if (!length($path) && !defined($self->query)) {
 
144
    if (!length($path)) {
142
145
        my $abs = $base->clone;
 
146
        my $query = $self->query;
 
147
        $abs->query($query) if defined $query;
143
148
        $abs->fragment($self->fragment);
144
149
        return $abs;
145
150
    }
155
160
        if ($p[$i-1] eq ".") {
156
161
            splice(@p, $i-1, 1);
157
162
            $i-- if $i > 1;
158
 
        } elsif ($p[$i] eq ".." && $p[$i-1] ne "..") {
 
163
        }
 
164
        elsif ($p[$i] eq ".." && $p[$i-1] ne "..") {
159
165
            splice(@p, $i-1, 2);
160
166
            if ($i > 1) {
161
167
                $i--;
162
168
                push(@p, "") if $i == @p;
163
169
            }
164
 
        } else {
 
170
        }
 
171
        else {
165
172
            $i++;
166
173
        }
167
174
    }
182
189
 
183
190
    #my($scheme, $auth, $path) = @{$rel}{qw(scheme authority path)};
184
191
    my $scheme = $rel->scheme;
185
 
    my $auth   = $rel->authority;
 
192
    my $auth   = $rel->canonical->authority;
186
193
    my $path   = $rel->path;
187
194
 
188
195
    if (!defined($scheme) && !defined($auth)) {
192
199
 
193
200
    #my($bscheme, $bauth, $bpath) = @{$base}{qw(scheme authority path)};
194
201
    my $bscheme = $base->scheme;
195
 
    my $bauth   = $base->authority;
 
202
    my $bauth   = $base->canonical->authority;
196
203
    my $bpath   = $base->path;
197
204
 
198
205
    for ($bscheme, $bauth, $auth) {
228
235
        defined($rel->fragment) &&
229
236
        !defined($rel->query)) {
230
237
        $rel->path("");
231
 
    } else {
 
238
    }
 
239
    else {
232
240
        # Add one "../" for each path component left in the base path
233
241
        $path = ('../' x $bpath =~ tr|/|/|) . $path;
234
242
        $path = "./" if $path eq "";