Added:
trunk/lighttpd.conf
trunk/run-lighttpd (contents, props changed)
Modified:
trunk/perl/perl-test.cgi
trunk/tester/lib/OpenID/Tester.pm
trunk/tester/lib/OpenID/Tester/Test/CheckID.pm
trunk/tester/lib/OpenID/Tester/Test/OPCaps.pm
Log:
Changes from working with mart, to get this easier to run.
Added: trunk/lighttpd.conf
==============================================================================
--- (empty file)
+++ trunk/lighttpd.conf Fri May 16 12:32:16 2008
@@ -0,0 +1,18 @@
+# You shouldn't really have to edit this file (with the exception
+# of the port number?). Use "run-lighttpd" instead to start up
+# lighttpd, using this configuration with the environment preconfigured.
+
+server.document-root = env.OPENID_TEST_ROOT
+server.port = 9001
+
+server.modules = ( "mod_cgi", "mod_setenv" )
+
+setenv.add-environment = (
+ "MEMCACHE" => env.MEMCACHE
+)
+
+cgi.assign = (
+ ".pl" => "/usr/bin/perl",
+ ".cgi" => "/usr/bin/perl"
+)
+
Modified: trunk/perl/perl-test.cgi
==============================================================================
--- trunk/perl/perl-test.cgi (original)
+++ trunk/perl/perl-test.cgi Fri May 16 12:32:16 2008
@@ -15,7 +15,7 @@
my $path_info = $ENV{PATH_INFO} || "";
my $base = "http://$ENV{HTTP_HOST}";
-if ($ENV{SERVER_PORT} != 80) {
+if ($ENV{HTTP_HOST} !~ /:/ && $ENV{SERVER_PORT} != 80) {
$base .= ":$ENV{SERVER_PORT}";
}
$base .= $ENV{SCRIPT_NAME};
@@ -33,7 +33,12 @@
sub new {
my $class = shift;
my $self = bless {}, $class;
- $self->{rpcache} = SimpleCache->new("/tmp/openidtest.rpcache");
+ if ($ENV{MEMCACHE}) {
+ eval "use Cache::Memcached; 1" or die "Don't have
Cache::Memcached: $!";
+ $self->{rpcache} = Cache::Memcached->new(servers => [$ENV{MEMCACHE}]);
+ } else {
+ $self->{rpcache} = SimpleCache->new("/tmp/openidtest.rpcache");
+ }
return $self;
}
Added: trunk/run-lighttpd
==============================================================================
--- (empty file)
+++ trunk/run-lighttpd Fri May 16 12:32:16 2008
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use FindBin qw($Bin);
+use IO::Socket::INET;
+
+my $default_memcache = "127.0.0.1:11211";
+my $sock = IO::Socket::INET->new(PeerAddr => $default_memcache);
+if ($sock) {
+ print "Memcached running at $default_memcache\n";
+ $ENV{MEMCACHE} = $default_memcache;
+}
+
+my @paths = grep { -r && -x _ } qw(
+ /usr/bin/lighttpd
+ /usr/sbin/lighttpd
+ /usr/local/bin/lighttpd
+ /usr/local/sbin/lighttpd
+ );
+die "lighttpd binary not found. Not installed?\n" unless @paths;
+my $lighttpd = $paths[0];
+
+$ENV{OPENID_TEST_ROOT} = $Bin;
+$ENV{MEMCACHE} ||= "0";
+print "Will be running at:\n";
+print " http://127.0.0.1:9001/perl/perl-test.cgi\n";
+exec("$lighttpd", "-f", "$Bin/lighttpd.conf", "-D");
+
Modified: trunk/tester/lib/OpenID/Tester.pm
==============================================================================
--- trunk/tester/lib/OpenID/Tester.pm (original)
+++ trunk/tester/lib/OpenID/Tester.pm Fri May 16 12:32:16 2008
@@ -38,6 +38,8 @@
return $self->{op_base} eq $self->{rp_base};
}
+# memoized, with the twist that we reuse the RP's caps as the OP's
+# caps when we know they're the same.
sub op_caps {
my $self = shift;
return $self->{op_caps} if $self->{op_caps};
@@ -45,6 +47,8 @@
return $self->{op_caps} = $self->_get_caps($self->{op_base});
}
+# memoized, with the twist that we reuse the RP's caps as the OP's
+# caps when we know they're the same.
sub rp_caps {
my $self = shift;
return $self->{rp_caps} if $self->{rp_caps};
Modified: trunk/tester/lib/OpenID/Tester/Test/CheckID.pm
==============================================================================
--- trunk/tester/lib/OpenID/Tester/Test/CheckID.pm (original)
+++ trunk/tester/lib/OpenID/Tester/Test/CheckID.pm Fri May 16 12:32:16 2008
@@ -55,7 +55,7 @@
$self->status("Checking URL: $check_url");
my $ua = $self->tester->ua;
my $res = $ua->get($check_url);
- die "Response not successful" unless $res->is_success;
+ die "Response not successful: " . $res->status_line unless $res->is_success;
die "Content is: " . $res->content unless $res->content =~ /^OK\b/;
return 1;
}
Modified: trunk/tester/lib/OpenID/Tester/Test/OPCaps.pm
==============================================================================
--- trunk/tester/lib/OpenID/Tester/Test/OPCaps.pm (original)
+++ trunk/tester/lib/OpenID/Tester/Test/OPCaps.pm Fri May 16 12:32:16 2008
@@ -5,7 +5,7 @@
sub needs_op { 1 }
sub des {
- "Tests that OP base URL returns a capabilities page at /cap";
+ "Tests that OP base URL returns a capabilities page at /caps";
}
sub run {