[Bps-public-commit] Prophet branch, master, updated. 5ec0c626c0880da315149b9d28e6ab426df98be0

clkao at bestpractical.com clkao at bestpractical.com
Mon Apr 20 03:50:20 EDT 2009


The branch, master has been updated
       via  5ec0c626c0880da315149b9d28e6ab426df98be0 (commit)
      from  71a048098f99f6653433763c989cc31a55ea0743 (commit)

Summary of changes:
 lib/Prophet/FilesystemReplica.pm     |    5 ++---
 lib/Prophet/Replica/prophet.pm       |    3 +--
 lib/Prophet/Replica/prophet_cache.pm |    1 -
 3 files changed, 3 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 5ec0c626c0880da315149b9d28e6ab426df98be0
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Mon Apr 20 15:49:07 2009 +0800

    make lwp_get not decoding the content at all, and remove the utf8
    workaround.

diff --git a/lib/Prophet/FilesystemReplica.pm b/lib/Prophet/FilesystemReplica.pm
index f0fbd97..807eca2 100644
--- a/lib/Prophet/FilesystemReplica.pm
+++ b/lib/Prophet/FilesystemReplica.pm
@@ -103,7 +103,6 @@ sub read_changeset_index {
     my $self = shift;
     $self->log_debug("Reading changeset index file" .$self->changeset_index);
     my $chgidx = $self->_read_file( $self->changeset_index );
-    utf8::decode($chgidx) if utf8::is_utf8($chgidx); # When we get data from LWP it sometimes ends up with a charset. that is wrong here
     return \$chgidx;
 }
       
@@ -272,12 +271,12 @@ sub _get_changeset_index_handle {
 sub lwp_get {
     my $self = shift;
     my $url  = shift;
-    my $verbatim = shift;
+
     my $response;
     for ( 1 .. 4 ) {
         $response = $self->lwp_useragent->get($url);
         if ( $response->is_success ) {
-            return $verbatim ? $response->content : $response->decoded_content;
+            return $response->content;
         }
     }
     warn "Could not fetch " . $url . " - " . $response->status_line;
diff --git a/lib/Prophet/Replica/prophet.pm b/lib/Prophet/Replica/prophet.pm
index c72bacc..5375765 100644
--- a/lib/Prophet/Replica/prophet.pm
+++ b/lib/Prophet/Replica/prophet.pm
@@ -489,7 +489,7 @@ sub _read_file_range {
     }
     else {
         # XXX: do range get if possible
-        my $content = $self->lwp_get( $self->url . "/" . $args{path}, 1 );
+        my $content = $self->lwp_get( $self->url . "/" . $args{path} );
         if ($args{whence} == 2) {
             return substr($content, $args{position}, $args{length});
         }
@@ -524,7 +524,6 @@ sub _read_record_index {
 
     my $index = $self->_read_file($idx_filename);
     return undef unless $index;
-    utf8::decode($index) if utf8::is_utf8($index); # When we get data from LWP it sometimes ends up with a charset. that is wrong here
 
     my $count = length($index) / RECORD_INDEX_SIZE;
     my @entries;
diff --git a/lib/Prophet/Replica/prophet_cache.pm b/lib/Prophet/Replica/prophet_cache.pm
index 0e6c856..19aad64 100644
--- a/lib/Prophet/Replica/prophet_cache.pm
+++ b/lib/Prophet/Replica/prophet_cache.pm
@@ -232,7 +232,6 @@ sub mirror_from {
                     return;
                 }
                 my $content = $source->fetch_serialized_changeset(sha1 => $key);
-                utf8::decode($content) if utf8::is_utf8($content);
                 my $newkey = $self->changeset_cas->write( $content );
                 if ($newkey ne  $key) {
                     warn "Original key: $key";

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list