Is 'PerlHandler Apache::Registry MySimplePerlModule' possible?
Hello Is it possible to insert my Set-Cookie headers after a modperl script? for exapmle: httpd.conf ... PerlFreshRestart On PerlModule SetMyCookies PerlFixupHandler SetMyCookies PerlSetVar SessionDataPath /tmp/apache_session PerlSetVar SessionLockPath /tmp/apache_session_lock Alias /modperl /home/czinkos/IMI/apache/modperl Location /modperl PerlModule Apache::Registry SetHandler perl-script PerlHandler Apache::Registry SetMyCookies Options ExecCGI /Location ... /httpd.conf The script is simple. It adds to cookies to the header. e.g. $cookie-bake; I've tried it, but id didn't work. I'd like to add some extra header after everything is done. thanks in advance czinkos
Beginner's FixupHandler question
Hello everyone I've just started learning modperl and I started with a simple module for apache httpd 1.3.22. This simple module (see below) sets gets a cookie at every request. I thought it wasn't too difficult. I put it into the fixup phase (any problem with it?). First it seemed to work, but when I put a 'print STDERR' line in it, I saw that my script ran many times on one request. Thanks in advance czinkos ps: I've searched the archives but I didn't find anything. Here's my config in httpd.conf ... PerlFreshRestart On PerlModule SetMyCookies PerlFixupHandler SetMyCookies ... --- Here's my simple script: package SetMyCookies; use Apache; use Apache::Constants; use Apache::Cookie(); sub handler { my $r = shift; $c = $r-header_in(Cookie); local(@rawCookies) = split (/; /,$c); local(%cookies); foreach(@rawCookies){ ($key, $val) = split (/=/,$_); $cookies{$key} = $val; } foreach $name (keys %cookies) { print STDERR $name = $cookies{$name}\n; } my $cookie = Apache::Cookie-new($r, -name = 'lofos', -value = 'lofos13', -expires= '+24M', -path = '/' ); $r-header_out(Set-Cookie,$cookie-as_string); return OK; } 1; --- And here's the error_log on one request: kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534 kakukk = kukka234534
Re: Beginner's FixupHandler question
My One request is: [czinkos@vajradhara apache]$ telnet localhost 8080 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / HTTP/1.0 Cookie: pritty=prutty It is only 1 html source. Thanks czinkos On Tue, Jan 08, 2002 at 10:07:18AM -0600, Stathy G. Touloumis wrote: I've just started learning modperl and I started with a simple module for apache httpd 1.3.22. This simple module (see below) sets gets a cookie at every request. I thought it wasn't too difficult. I put it into the fixup phase (any problem with it?). First it seemed to work, but when I put a 'print STDERR' line in it, I saw that my script ran many times on one request. What is your interpretation of 'one' request? Remember, when requesting a url there may be 'many' requests that go along with it for loading images and other media. If you don't want to set/get cookie for every request try filtering based on $r-content_type. But, your handler will still be called for every request : ) -- There is always somebody better than you . . . -- Until you realize this you can never be the best. Stathy G. Touloumis Coder