perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Johnson <solut...@gina.net>
Subject Re: Session and redirect oddity
Date Tue, 17 Dec 2002 17:44:26 GMT
On Tue, 2002-12-17 at 00:29, Gerald Richter wrote:
> >
> > I had an EMBPERL_COOKIE_PATH entry in the httpd.conf and I changed to
> > reflect the specific sub directory as well just in case that was the
> > issue, but the problem persists.  All the pages of the application
> > (site) are are in the same directory and %udat works correctly on all
> > the other pages.
> >
> 
> You may try to change it to /, just to be sure...

It was / originally, and I have changed it back. (see below)

> 
> > I am wondering now if Embperl flushes the udat values if the page is not
> > completely rendered before a redirect or if that is at least the case in
> > this instance.  Is there something I send before the redirect to ensure
> > the session values hold?
> 
> 
> No
> >
> > How does a redirect and/or an http_headers_out effect udat, primarily if
> > they used on the first page visited prior to a full page being rendered?
> 
> This should work. How does you code looks like?
> 

This is my session check code, it generic in that I can use it with
other frameworks and it is in an external module.

sub check_session {
    my ($self,$udat,$args) = @_;

    if ($udat->{'user___user_id'} !~ /^\d/) {
        $self->error_to_log( "RedIRECT BaD logIN" );
        print $self->cgi->redirect( $self->login_page() );
    }
	
	if ($udat->{'user___is_active'} < 1 && !$args->{new_user}) {
        print $self->cgi->redirect( $self->inactive_page() );
    } else {
        return
    }
}

I call it within the and embperl page like so:
my $seo = myapp::SEO->new();
$seo->check_session(\%udat);

> > In looking through the source I noticed that Embperl.pm has no
> > SetupSession currently, just out of curiosity how or when would that be
> > important?
> >
> 
> The session handling is done in the C part of Embperl.
> 
> You may set dbgSession in EMBPERL_DEBUG and watch your embperl.log file. It
> should show you when a session is created and when  a cookie is send to the
> user.
> 

I have tested the behavior in Mozilla 1.0 and Konqueror 3.0.3

Here is the log output from a Konqueror session with EMBPERL_DEBUG
2110701 in the configuration:

[13048]REQ: ***** Start Request at Tue Dec 17 12:19:59 2002
[13048]Use App: myapp
[13048]Formdata... length = 71
[13048]FORM: pid=61
[13048]FORM: purl=www.mycruiseoutlet.com
[13048]FORM: uid=2
[13048]FORM: type=user
[13048]FORM: on=ranking
[13048]FORM: link_to=1
[13048]Using APACHE for output...
[4911] Use Recipe Embperl
[4911]SYNTAX: switch to Embperl::Syntax::Embperl
[13048]Reading /web/htdocs/seo/seo_base.epl as input using PerlIO (3937
Bytes)...
[13048]PERF: Parse Start Time:      120 ms
[13048]PERF: Parse End Time:                120 ms
[13048]PERF: Parse Time:                    0 ms
[13048]PERF: DOMSTAT: MemUsage = 67136 Bytes  numNodes = 7 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 79  numReplace = 0
[13048]TAB:  get EscMode = 0, Used = 1
[13048]PERF: Compile Start Time:            120 ms
[13048]PERF: Compile End Time:      130 ms
[13048]PERF: After Compile Exec End Time: 130 ms
[13048]PERF: Perl Compile End Time:         190 ms
[13048]PERF: Compile Time:                  70 ms
[13048]PERF: DOMSTAT: MemUsage = 68176 Bytes  numNodes = 5 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 79  numReplace = 0
[13048]EVAL< <unknown>
[13048]EVAL> <undefined>
[13048]PERF: Run Start Time: 190 ms
[13048]PERF: Run End Time:   470 ms
[13048]PERF: Run Time:       280 ms
[13048]PERF: DOMSTAT: MemUsage = 68376 Bytes  numNodes = 5 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 79  numReplace = 0
[13048]SES:  Received Cookie ID:   New Cookie ID:
8cb3bf4282128c12a224107bb67d9a5b  User data is modified
[13048]SES:  Send Cookie ->
EMBPERL_UID=8cb3bf4282128c12a224107bb67d9a5b; path=/; expires=+30m
[13048]PERF: input = ???
[13048]PERF: Time: 470 ms
[13048]Request finished. Tue Dec 17 12:20:03 2002
. Entry-SVs: 171908  Exit-SVs: 178215
[13048]PERF: DOMSTAT: MemUsage = 68176 Bytes  numNodes = 5 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 79  numReplace = 0
[13048]REQ: ***** Start Request at Tue Dec 17 12:20:03 2002
[13048]Use App: myapp
[13048]Formdata... length = 0
[13048]Using APACHE for output...
[4911] Use Recipe Embperl
[4911]SYNTAX: switch to Embperl::Syntax::Embperl
[13048]Reading /web/htdocs/seo/login.epl as input using PerlIO (1641
Bytes)...
[13048]PERF: Parse Start Time:      0 ms
[13048]PERF: Parse End Time:                0 ms
[13048]PERF: Parse Time:                    0 ms
[13048]PERF: DOMSTAT: MemUsage = 70384 Bytes  numNodes = 12 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 81  numReplace = 0
[13048]TAB:  get EscMode = 0, Used = 2
[13048]PERF: Compile Start Time:            10 ms
[13048]PERF: Compile End Time:      10 ms
[13048]PERF: After Compile Exec End Time: 10 ms
[13048]PERF: Perl Compile End Time:         30 ms
[13048]PERF: Compile Time:                  20 ms
[13048]PERF: DOMSTAT: MemUsage = 71424 Bytes  numNodes = 10 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 81  numReplace = 0
[13048]EVAL< <unknown>
[13048]EVAL> <undefined>
[13048]PERF: Run Start Time: 30 ms
[13048]PERF: Run End Time:   120 ms
[13048]PERF: Run Time:       90 ms
[13048]PERF: DOMSTAT: MemUsage = 73680 Bytes  numNodes = 18 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 87  numReplace = 0
[13048]SES:  Received Cookie ID:   New Cookie ID:
5a90da88079e1848df918cecd95d06a2  User data is modified
[13048]SES:  Send Cookie ->
EMBPERL_UID=5a90da88079e1848df918cecd95d06a2; path=/; expires=+30m
[13048]PERF: input = ???
[13048]PERF: Time: 120 ms
[13048]Request finished. Tue Dec 17 12:20:03 2002
. Entry-SVs: 177990  Exit-SVs: 180182
[13048]PERF: DOMSTAT: MemUsage = 71424 Bytes  numNodes = 10 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 81  numReplace = 0
[13048]REQ: ***** Start Request at Tue Dec 17 12:20:04 2002
[13048]Use App: myapp
[13048]Formdata... length = 0
[13048]PERF: DOMSTAT: MemUsage = 5520 Bytes  numNodes = 0 
numLevelLookup = 0  numLevelLookupItem = 0  numStr = 7  numReplace = 0
[13048]REQ: ***** Start Request at Tue Dec 17 12:20:05 2002
[13048]Use App: myapp

My httpd.conf has this entry:

<Location /seo>
    EMBPERL_APPNAME myapp
    EMBPERL_URIMATCH "(\.htm|\.epl)$"
    EMBPERL_COOKIE_EXPIRES +30m
    EMBPERL_COOKIE_PATH /
    EMBPERL_DEBUG 2110701
    EMBPERL_LOG /embperl/log
    EMBPERL_ESCMODE 0
    EMBPERL_OPTIONS 16

    SetHandler perl-script
    PerlHandler Embperl
    Options +ExecCGI
</Location>


> Gerald
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message