Vishal Verma wrote:
Though it's probably not as fast as adjusting the headers via the api in the response handlers. However since you aren't telling what you are trying to do I can't give you a better advice.

Here's what I'm trying to do:

I am implementing a login/logout mechanism. The user can't access any
page till he logs in. That is any attempt to access pages without
logging in will be redirected to the login screen. I have successfully
implemented this part. The login page is generated by a CGI script. Once
the user logs in successfully, I want to set a cookie. That's the reason
why I want the login CGI script to pass the result to my handler. The
handler, which must be run after the CGI script has been run, will
decide to modify the output header (to set cookie) depending upon the
result code passed to it by the login screen.
I don't understand why don't you do that in your cgi script (btw, is it running under mod_perl/registry or just mod_cgi?). Why do you need yet another handler?

I have read all the documentation about handlers etc., and couldn't find
a way to do this. I know about notes/pnotes, but aren't they for passing
values from one handler to other. How can my CGI script use them? And if
it is possible for my CGI script to use them, would that be safe when
multiple users are trying to log in?
If it's a mod_perl registry script, you have an access to the request object. Either via my $r = shift; at the beginning of your script or via Apache->request (which retrieves the globally stored req object)

If it's a script running under the mod_cgi handler, I don't think you can.

One more question. I redirect the incoming request by calling
$r->uri($new_uri) in my PerlTransHandler. How can I make the browser
show this new location in its address bar?
in mod_cgi scripts:

  print "Location: $new_location";

or

  use CGI;
  print CGI->new->redirect($new_location);

or talking mod_perl, see for example:

http://perl.apache.org/docs/1.0/guide/snippets.html#Sending_Cookies_in_REDIRECT_Response

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to