[Bps-public-commit] r14239 - in Prophet/trunk: .

sartak at bestpractical.com sartak at bestpractical.com
Thu Jul 17 17:32:25 EDT 2008


Author: sartak
Date: Thu Jul 17 17:32:25 2008
New Revision: 14239

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Replica.pm

Log:
 r64523 at onn:  sartak | 2008-07-17 17:27:39 -0400
 Add a way for replica types to "keep scheme" so http://example.com just works


Modified: Prophet/trunk/lib/Prophet/Replica.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Replica.pm	(original)
+++ Prophet/trunk/lib/Prophet/Replica.pm	Thu Jul 17 17:32:25 2008
@@ -51,7 +51,8 @@
 for my $scheme (qw/http file/) {
    __PACKAGE__->register_replica_scheme(
        %{ $REPLICA_TYPE_MAP->{prophet} },
-       scheme => $scheme,
+       scheme      => $scheme,
+       keep_scheme => 1,
    );
 }
 
@@ -100,10 +101,11 @@
 
 sub register_replica_scheme {
     my $class = shift;
-    my %args = validate(@_, { class => 1, scheme => 1});
+    my %args = validate(@_, { class => 1, scheme => 1, keep_scheme => 0 });
 
     $Prophet::Replica::REPLICA_TYPE_MAP->{$args{'scheme'}} = {
-        class => $args{'class'},
+        class       => $args{'class'},
+        keep_scheme => $args{'keep_scheme'},
     };
 }
 
@@ -119,6 +121,8 @@
 
     my ($scheme, $real_url) = split /:/, $url;
     my $type_map = $Prophet::Replica::REPLICA_TYPE_MAP->{$scheme};
+    $real_url = $url if $type_map->{keep_scheme};
+
     return ($type_map->{class}, $scheme, $real_url);
 }
 



More information about the Bps-public-commit mailing list