Re: AW: setting request_time (prot. handler)

[prev] [thread] [next] [Date index for 2005/04/06]

From: Stas Bekman
Subject: Re: AW: setting request_time (prot. handler)
Date: 14:40 on 06 Apr 2005
Dintelmann, Peter wrote:
>>-----Ursprüngliche Nachricht-----
>>Von: Stas Bekman [mailto:stas@xxxxxx.xxx]
>>Gesendet: Dienstag, 5. April 2005 17:58
>>An: Dintelmann, Peter
>>Cc: 'modperl@xxxx.xxxxxx.xxx'
>>Betreff: Re: setting request_time (prot. handler)
>>
>>
>>Dintelmann, Peter wrote:
>>
>>>The log phase can be invoked in a protocol handler using the
>>>run_log_transaction() method from Apache::HookRun.
>>>
>>>    use Apache::Connection;
>>>    use Apache::Const -compile => qw(OK);
>>>    use Apache::RequestRec;
>>>    use Apache::RequestUtil;
>>>    use Apache::HookRun;
>>>
>>>    sub handler
>>>    {   my $c = shift;
>>>        my $r = Apache::RequestRec->new($c);
>>>
>>>        # IO loop goes here
>>>
>>>        # finally log the request
>>>        $r->run_log_transaction();
>>>
>>>        return Apache::OK;
>>>    }
>>>
>>>Unfortunately the request_time of the newly created request
>>>seems to be undefined.
>>>
>>>Is there a way to manually set the request_time (or get it
>>>automagically set to the time of the creation of $r)? 
>>
>>This should do the trick:
>>
>>Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
>>===================================================================
>>--- xs/Apache/RequestUtil/Apache__RequestUtil.h (revision 159348)
>>+++ xs/Apache/RequestUtil/Apache__RequestUtil.h (working copy)
>>@@ -79,6 +79,8 @@
>>      r->connection = c;
>>      r->server     = s;
>>
>>+    r->request_time = apr_time_now();
>>+
>>      r->user            = NULL;
>>      r->ap_auth_type    = NULL;
> 
> 
> 	This is really cool :-) Can you please make this feature 
> 	available in one of the next versions of mod_perl (RC5 ;-)?

I've committed it yesterday :) so it'll be in the next release.

>>we could also make $r->request_time settable.
> 
> 
> 	At the moment I do not need this additional feature but
> 	it maybe helpful anyway.

Sure, I'll put that on the todo list.

        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

AW: setting request_time (prot. handler)
Dintelmann, Peter 08:35 on 06 Apr 2005

Re: AW: setting request_time (prot. handler)
Stas Bekman 14:40 on 06 Apr 2005

Generated at 14:43 on 11 Apr 2005 by mariachi v0.52