Author: spadkins
Date: Mon Dec  7 12:30:41 2009
New Revision: 13648

Modified:
   p5ee/trunk/App-Context/lib/App/Context.pm
   p5ee/trunk/App-Context/lib/App/Context/HTTP.pm

Log:
fixed a bug where app.Context.profiler would inhibit u=xxx from working for 
App::Context::HTTP

Modified: p5ee/trunk/App-Context/lib/App/Context.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context.pm   (original)
+++ p5ee/trunk/App-Context/lib/App/Context.pm   Mon Dec  7 12:30:41 2009
@@ -423,11 +423,7 @@
     &App::sub_entry if ($App::trace);
     my ($self, $options) = @_;
 
-    my $profiler = $options->{"app.Context.profiler"};
-    if ($profiler) {
-        $self->profile_start("main");
-        $self->start_profiler_log();
-    }
+    $self->init_profiler_log();
 
     &App::sub_exit() if ($App::trace);
 }
@@ -2898,6 +2894,18 @@
 # CONTROLLING THE profiler_log
 #############################################################################
 
+sub init_profiler_log {
+    &App::sub_entry if ($App::trace);
+    my ($self) = @_;
+    my $options  = $self->{options};
+    my $profiler = $options->{"app.Context.profiler"};
+    if ($profiler) {
+        $self->profile_start("main");
+        $self->start_profiler_log();
+    }
+    &App::sub_exit() if ($App::trace);
+}
+
 sub start_profiler_log {
     &App::sub_entry if ($App::trace);
     my ($self) = @_;

Modified: p5ee/trunk/App-Context/lib/App/Context/HTTP.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context/HTTP.pm      (original)
+++ p5ee/trunk/App-Context/lib/App/Context/HTTP.pm      Mon Dec  7 12:30:41 2009
@@ -94,8 +94,6 @@
     };
     $self->add_message("Context::HTTP::_init(): $@") if ($@);
 
-    $self->SUPER::_init($args);
-
     &App::sub_exit() if ($App::trace);
 }
 
@@ -131,6 +129,8 @@
     if ($request_events && $#$request_events > -1) {
         push(@$events, @$request_events);
     }
+    $self->init_profiler_log();
+
     &App::sub_exit() if ($App::trace);
 }
 
@@ -504,11 +504,12 @@
         my $options = $self->{options};
         my ($effective_user);
         my $authenticated = 0;
-
+print STDERR "$options->{app_auth_required}\n";
         if ($options->{app_auth_required}) {
             # Bypass Basic Authentication, /../..?u=username&p=password
             my $password = $self->so_get("default","p");
             $user = $self->so_get("default","u");
+
             if (defined $password && defined $user) {
                 my $authentication = $self->authentication();
                 if ( $authentication->validate_password($user, $password) ) {
@@ -529,6 +530,10 @@
                     $user = $self->so_get("default","u");
                     $effective_user = $self->so_get("default","u");
                 }
+                else {
+                    $user = 'guest';
+                    $effective_user = 'guest';
+                }
             }
 
             $authenticated = 1;
@@ -538,7 +543,6 @@
         $user = "guest" if (!$authenticated);
         $ENV{REMOTE_USER} = $user;
         $self->{user} = $user;
-
         if ($user && $authenticated) {
             my $switchable_users = $self->get_option("switchable_users");
             if ($switchable_users && $switchable_users =~ /\b$user\b/) {
@@ -554,7 +558,6 @@
                 }
             }
         }
-
         $self->so_set("default", "user", $user);
     }
 

Reply via email to