[Pkg-owncloud-commits] [owncloud-client] 278/333: Enable SSL for testing.

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu Apr 17 23:17:04 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit fa453296c984e5e8c6a47791d9aee77e7ae9b889
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Apr 1 16:09:45 2014 +0200

    Enable SSL for testing.
---
 csync/tests/ownCloud/README           |  4 ++++
 csync/tests/ownCloud/ownCloud/Test.pm | 19 ++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/csync/tests/ownCloud/README b/csync/tests/ownCloud/README
index 121dbcc..d540bea 100644
--- a/csync/tests/ownCloud/README
+++ b/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 at owncloud.com>
 
diff --git a/csync/tests/ownCloud/ownCloud/Test.pm b/csync/tests/ownCloud/ownCloud/Test.pm
index 3ef61f1..ac83b5b 100644
--- a/csync/tests/ownCloud/ownCloud/Test.pm
+++ b/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";
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list