AW: setting request_time (prot. handler)

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

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

> -----Urspr=FCngliche 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)
>=20
>=20
> Dintelmann, Peter wrote:
> > The log phase can be invoked in a protocol handler using the
> > run_log_transaction() method from Apache::HookRun.
> >=20
> >     use Apache::Connection;
> >     use Apache::Const -compile =3D> qw(OK);
> >     use Apache::RequestRec;
> >     use Apache::RequestUtil;
> >     use Apache::HookRun;
> >=20
> >     sub handler
> >     {   my $c =3D shift;
> >         my $r =3D Apache::RequestRec->new($c);
> >=20
> >         # IO loop goes here
> >=20
> >         # finally log the request
> >         $r->run_log_transaction();
> >=20
> >         return Apache::OK;
> >     }
> >=20
> > Unfortunately the request_time of the newly created request
> > seems to be undefined.
> >=20
> > Is there a way to manually set the request_time (or get it
> > automagically set to the time of the creation of $r)?=20
>=20
> This should do the trick:
>=20
> Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- xs/Apache/RequestUtil/Apache__RequestUtil.h (revision 159348)
> +++ xs/Apache/RequestUtil/Apache__RequestUtil.h (working copy)
> @@ -79,6 +79,8 @@
>       r->connection =3D c;
>       r->server     =3D s;
>=20
> +    r->request_time =3D apr_time_now();
> +
>       r->user            =3D NULL;
>       r->ap_auth_type    =3D NULL;

	This is really cool :-) Can you please make this feature=20
	available in one of the next versions of mod_perl (RC5 ;-)?

> we could also make $r->request_time settable.

	At the moment I do not need this additional feature but
	it maybe helpful anyway.

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