Klaas Freitag 12 лет назад
Родитель
Сommit
fa453296c9
2 измененных файлов с 20 добавлено и 3 удалено
  1. 4 0
      csync/tests/ownCloud/README
  2. 16 3
      csync/tests/ownCloud/ownCloud/Test.pm

+ 4 - 0
csync/tests/ownCloud/README

@@ -31,6 +31,10 @@ Before it actually ends, it takes a four seconds break for you to
 interrupt with Ctrl-C. If you don't do that, it removes all its 
 traces...
 
+If SSL should be used, SSL must be available to LWP connections. To
+disable host checking for crappy SSL certs, do
+export PERL_LWP_SSL_VERIFY_HOSTNAME=0
+
 Have fun,
 Klaas Freitag <freitag@owncloud.com>
 

+ 16 - 3
csync/tests/ownCloud/ownCloud/Test.pm

@@ -31,6 +31,7 @@ use Carp::Assert;
 use Digest::MD5;
 use Unicode::Normalize;
 use LWP::UserAgent;
+use LWP::Protocol::https;
 use HTTP::Request::Common qw( POST  DELETE );
 use File::Basename;
 
@@ -113,6 +114,12 @@ sub initTesting(;$)
   $owncloud .= "/" unless( $owncloud =~ /\/$/ );
 
   print "Connecting to ownCloud at ". $owncloud ."\n";
+
+  # For SSL set the environment variable needed by the LWP module for SSL
+  if( $owncloud =~ /^https/ ) {
+    $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0
+  }
+
   $d = HTTP::DAV->new();
 
   $d->credentials( -url=> $owncloud, -realm=>"ownCloud",
@@ -259,11 +266,17 @@ sub csync( ;$ )
     if( $aurl ) {
 	$url = $aurl;
     }
-    $url =~ s#^http://##;    # Remove the leading http://
-    $url = "owncloud://$user:$passwd@". $url;
+    if( $url =~ /^https:/ ) {
+	$url =~ s#^https://##;    # Remove the leading http://
+	$url = "ownclouds://$user:$passwd@". $url;
+    } elsif( $url =~ /^http:/ ) {
+	$url =~ s#^http://##;
+	$url = "owncloud://$user:$passwd@". $url;
+    }
+
     print "CSync URL: $url\n";
 
-    my $args = ""; # "--exclude-file=exclude.cfg -c";
+    my $args = "--trust"; # Trust crappy SSL certificates
     my $cmd = "LD_LIBRARY_PATH=$ld_libpath $csync $args $localDir $url";
     print "Starting: $cmd\n";