diff options
author | Robin Edwards <robin.ge@gmail.com> | 2011-04-11 15:54:40 +0100 |
---|---|---|
committer | Robin Edwards <robin.ge@gmail.com> | 2011-04-11 15:54:40 +0100 |
commit | 85a963d1cb0d12da402cdaf404ef9a6d749f5e8f (patch) | |
tree | e3870b1f551db73b815f57e9bb19ea3f8e944433 /lib | |
parent | Updated Changes and version (diff) | |
parent | Fix issue with url encoded links (diff) | |
download | net-riak-85a963d1cb0d12da402cdaf404ef9a6d749f5e8f.tar.gz |
Merge remote branch 'simon/fix_link_encoding'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Net/Riak.pm | 2 | ||||
-rw-r--r-- | lib/Net/Riak/Object.pm | 21 |
2 files changed, 14 insertions, 9 deletions
diff --git a/lib/Net/Riak.pm b/lib/Net/Riak.pm index 7412adb..37a774d 100644 --- a/lib/Net/Riak.pm +++ b/lib/Net/Riak.pm @@ -34,7 +34,7 @@ sub bucket { =head1 SYNOPSIS my $client = Net::Riak->new( - host => 'http://10.0.0.40:8098', + host => 'http://10.0.0.40:8098', ua_timeout => 900 ); diff --git a/lib/Net/Riak/Object.pm b/lib/Net/Riak/Object.pm index 1d2b56a..f40031b 100644 --- a/lib/Net/Riak/Object.pm +++ b/lib/Net/Riak/Object.pm @@ -64,7 +64,7 @@ sub store { if (defined $self->key) { push @$path, $self->key; $method = 'PUT'; - } + } my $request = $self->client->new_request($method, $path, $params); @@ -168,13 +168,13 @@ sub populate { shift @siblings; $self->siblings(\@siblings); } - + if ($status == 201) { my $location = $http_response->header('location'); my ($key) = ($location =~ m!/([^/]+)$!); $self->key($key); - } - + } + if ($status == 200 || $status == 201) { $self->content_type($http_response->content_type) @@ -185,16 +185,21 @@ sub populate { } } +sub _uri_decode { + my $str = shift; + $str =~ s/%([a-fA-F0-9]{2,2})/chr(hex($1))/eg; + return $str; +} + sub _populate_links { my ($self, $links) = @_; - for my $link (split(',', $links)) { if ($link =~ /\<\/([^\/]+)\/([^\/]+)\/([^\/]+)\>; ?riaktag=\"([^\']+)\"/) { - my $bucket = $2; - my $key = $3; - my $tag = $4; + my $bucket = _uri_decode($2); + my $key = _uri_decode($3); + my $tag = _uri_decode($4); my $l = Net::Riak::Link->new( bucket => Net::Riak::Bucket->new( name => $bucket, |