Re: Cookies and Handlers
Time abbreviations are case sensitive: =pod The following forms are all valid for the -expires field: +30s 30 seconds from now +10m ten minutes from now +1h one hour from now -1d yesterday (i.e. "ASAP!") now immediately +3M in three months +10y in ten years time =cut So, change "+24H" to "+24h". Note that you may also, $u->bake() since you're using Apache::Cookie. This will set the outgoing headers for you. Regards, Tim Tompkins -- Programmer http://www.arttoday.com/ http://www.rebelartist.com/ -- - Original Message - From: "Rasoul Hajikhani" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, August 08, 2001 6:11 PM Subject: Cookies and Handlers > Why is setting cookies so complex in mod_perl... > Can any one tell me how I can set a few cookies in one handler and hand > over the operation to another handler to do some more stuff... > I have tried everything that I know (that's not much) but I still can > not set the cookies... > here is the snippet of my cookie setter handler: > my $u = Apache::Cookie->new( $r, > > -name => 'randh_webuname', > > -value => $webuname, > > -domain => '.rhythm.com', > > -expires=> '+24H', > > -path => '/' > ); > $r->err_headers_out->add('Set-Cookie' => $u) if $u; > > some more cookies here > > $r->err_headers_out; > return DECLINED; # tried OK with the same result > } > 1; > > At this point my second handler takes over ... > . > . > . > > $r->err_headers_out; > return OK; > > Please Help :( > -r >
using DBI with apache
I can run this simple script through perl itself, but when I put it in the cgi-bin and try to run it using mod_perl Perl pops up in windows with an error. I assume this means I need something like Apache::DBI?... I originally got Apache in binary form with mod_perl installed and did not have to compile anything. I tried to follow the instructions but i dont seem to be able to build Apache::DBI I ran perl makefile.pl which creates a file called makefile then the instructions tell you to run make make test make install make by run by itself says 'No terminator specified for in-line operator' and i dont have a test or install file that came with the Apache:DBI download. I have a test.pl but that doesnt seem to be what i need. I am running Win 98se if that helps. Anyone have any suggestions? Here is the code I tried to run. #!\perl\bin\perl use DBI; $dbh = DBI->connect('dbi:ODBC:Test1Db'); $sqlstatement="SELECT * FROM ASTAB"; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; #output database results while (@row=$sth->fetchrow_array) { print "@row\n" } _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Cookies and Handlers
Why is setting cookies so complex in mod_perl... Can any one tell me how I can set a few cookies in one handler and hand over the operation to another handler to do some more stuff... I have tried everything that I know (that's not much) but I still can not set the cookies... here is the snippet of my cookie setter handler: my $u = Apache::Cookie->new( $r, -name => 'randh_webuname', -value => $webuname, -domain => '.rhythm.com', -expires=> '+24H', -path => '/' ); $r->err_headers_out->add('Set-Cookie' => $u) if $u; some more cookies here $r->err_headers_out; return DECLINED; # tried OK with the same result } 1; At this point my second handler takes over ... . . . $r->err_headers_out; return OK; Please Help :( -r
Blank Page Returned by Mod_perl
Hi, I'm using mod_backhand frontend and mod_perl backend (on 127.0.0.1). Many complex scripts are working fine but I'm getting behavior I don't understand with this simple script: #!/usr/local/bin/perl print "Content-type: text/html\n\n"; print "This is a test\n\n"; exit; 1. If the script is NOT handed off to the backend, the browser shows: This is a test 2. If the script is handed off to the backend, the browser shows a blank page. 3. If I go directly to the backend, the browser shows: Content-type: text/html This is a test I'd like to get the same output on 2 as occurs on 1. Why is this happening? Can anyone help? Thanks! Bob Foster
Re: Help with cookies
On Wed, Aug 08, 2001 at 12:21:07PM -0700, Rasoul Hajikhani wrote: > But I never get to set the cookie... Can someone tell me what I am doing > wrong? As Perrin, said, is a cookie header being set and sent somewhere else in the code? In my experience, cookie programming can be extremely frustrating, given the different browsers in use for instance. Sometime's it's best to start very simple and work up from there. I've been using CGI::Cookie with some success recently but I'd expect Apache::Cookie to work in a similar way. Good luck! -- Alastair| [EMAIL PROTECTED] | http://www.calliope.demon.co.uk |PGP Key : A9DE69F8 ---
Re: Help with cookies
> Umm... Is > > > return OK; > > the correct thing to return when using multiple handlers? Yes, according the mod_perl docs. It only stops if you return something other than OK or DECLINED. - Perrin
Re: Help with cookies
> Long time no hear... I heard you moved to NY... This is true. I'm exploring new territory. > I think I do send a response back to Apache! I > mean I return OK status. Or do you mean something else? Like > $r->header_out(...)? You need to send the headers (with $r->send_http_header or something similar), and print something to the client. Otherwise, your Set-Cookie header will never get sent out. Glad to see you're still mod_perl-ing. - Perrin
Re: knowledge base - was Re: RFC: mod_perl 2.0 documentation project
On Wed, Aug 08, 2001 at 10:45:43AM +0800, Stas Bekman wrote: > On Tue, 7 Aug 2001, Jim Smith wrote: > > > On Tue, Aug 07, 2001 at 10:16:26PM +0800, Stas Bekman wrote: > > > > Just some pseudo-random ideation boiling down to "let's use mod_perl > > > > to buils a knowledge base" both to demonstrate it's power and to serve > > > > the community. > > > > > > I like the idea!!! > > > > If we can come up with a proposal for a generic knowledge base product that > > would be useful in an IT environment, I can probably devote some of my work > > to it -- this is something I've been wanting to put together at work for > > customers and our help desk people but haven't had time yet to get it all > > together. I'll have more time in September after the students return. > > go ahead and be the first to propose Jim :) Ok... here are some of my initial thoughts. We need to be able to enter arbitrary documents, so I suggest DocBook as the standard format. This handles articles, books, reference pages, etc., in a well-defined manner. It also allows us to transform to other formats without much of a problem. We can even consider AxKit for at least part of the web interface. We would want to have different sections for documents that are not related. For example, we (here at TAMU) could use a section on Unix, another on Mac, and yet another on Windows systems. Or we could divide it up by services. The different sections would not expect overlap in keyword -> content mapping, so we could have an AI::Catagorize object for each section that could provide a default set of keywords. As we entered documents, those objects could learn which keywords were appropriate. We would want to have documents in multiple catagories. This might require the person entering the document enter multiple sets of keywords, one per section. We would need to index on keyword so people could quickly find the documents. Perhaps even a catelogue-style interface for browsing that would be based on keyword categories. This would require some work. (Broad categories are indicated by the presence of certain keywords, or by a weighted average so a document having all but a couple of the appropriate keywords won't be dropped from that category.) Documents shouldn't have to be entered via the web interface, though they could be. We could provide a set of web-page templates for each of the DocBook formats (well, the small ones anyway - don't want to write a book via a web interface). Might want to even integrate with WebDAV and a repository. We probably want to set up a SourceForge project if this is a go. Any ideas on names? Now to see if I can get my boss to support me spending time on such a project :) --jim
Re: Help with cookies
At 3:50 PM -0400 8/8/01, Perrin Harkins wrote: > >It depends on what's happening in that second module. If you don't send an >actual response to the client, headers (including cookies) will not be sent >out. Umm... Is > return OK; the correct thing to return when using multiple handlers? I thought DECLINED was the correct status code. Then the last module (in this case MIS_APPS::RHS::Control::Scan) would return OK. Robert Landrum -- "A good magician never reveals his secret; the unbelievable trick becomes simple and obvious once it is explained. So too with UNIX."
Re: Help with cookies
Perrin Harkins wrote: > > > Can some one tell me why I can not set a cookie... > > I have a module that is supposed to set a cookie called Cookie_Check: > > > > > And after my second handler should kick in and do some other magic. In > > my httpd.conf I have: > > > > > > SetHandler perl-script > > PerlHandler MIS_APPS::RHS::Control::Cookie_Check > > MIS_APPS::RHS::Control::Scan > > > > AuthName RHS > > AuthType Basic > > AuthUserFile /etc/passwd > > require valid-user > > > > > > But I never get to set the cookie... Can someone tell me what I am doing > > wrong? > > It depends on what's happening in that second module. If you don't send an > actual response to the client, headers (including cookies) will not be sent > out. > > - Perrin Hi Perrin, Long time no hear... I heard you moved to NY... How goes... Hey man thanks for responding. I think I do send a response back to Apache! I mean I return OK status. Or do you mean something else? Like $r->header_out(...)? -r
Re: Help with cookies
> Can some one tell me why I can not set a cookie... > I have a module that is supposed to set a cookie called Cookie_Check: > And after my second handler should kick in and do some other magic. In > my httpd.conf I have: > > > SetHandler perl-script > PerlHandler MIS_APPS::RHS::Control::Cookie_Check > MIS_APPS::RHS::Control::Scan > > AuthName RHS > AuthType Basic > AuthUserFile /etc/passwd > require valid-user > > > But I never get to set the cookie... Can someone tell me what I am doing > wrong? It depends on what's happening in that second module. If you don't send an actual response to the client, headers (including cookies) will not be sent out. - Perrin
Help with cookies
Can some one tell me why I can not set a cookie... I have a module that is supposed to set a cookie called Cookie_Check: package MIS_APPS::RHS::Control::Cookie_Check; use Apache::Constants qw(:common); use Apache::Request; use Apache::Cookie (); use strict; sub handler { my $r = shift; $res= Apache::Cookie->new( $r, -name =>'randh_webuname', -value => $webuname, -domain => '.rhythm.com', -expires=> '+24H', -path => '/' )->bake; return OK; } 1; And after my second handler should kick in and do some other magic. In my httpd.conf I have: SetHandler perl-script PerlHandler MIS_APPS::RHS::Control::Cookie_Check MIS_APPS::RHS::Control::Scan AuthName RHS AuthType Basic AuthUserFile /etc/passwd require valid-user But I never get to set the cookie... Can someone tell me what I am doing wrong? Thanks in advance -r
Help with cookies...
Can some one tell me why I can not set a cookie... I have a module that is supposed to set a cookie called Cookie_Check: package MIS_APPS::RHS::Control::Cookie_Check; use Apache::Constants qw(:common); use Apache::Request; use Apache::Cookie (); use strict; sub handler { my $r = shift; $res= Apache::Cookie->new( $r, -name =>'randh_webuname', -value => $webuname, -domain => '.rhythm.com', -expires=> '+24H', -path => '/' )->bake; return OK; } 1; And after my second handler should kick in and do some other magic. In my httpd.conf I have: SetHandler perl-script PerlHandler MIS_APPS::RHS::Control::Cookie_Check MIS_APPS::RHS::Control::Scan AuthName RHS AuthType Basic AuthUserFile /etc/passwd require valid-user But I never get to set the cookie... Can someone tell me what I am doing wrong? Thanks in advance -r
RE: Apache::GzipChain & Apache::OutputChain
> -Original Message- > From: Ricardas Cepas [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 08, 2001 2:08 PM > To: [EMAIL PROTECTED] > Subject: Apache::GzipChain & Apache::OutputChain > > > Hi! > > What does this error messsage mean? > untie attempted while 1 inner references still exist at > /usr/local/lib/perl5/site_perl/5.6.1/Apache/OutputChain.pm line 28. it means what it says :) if OutputChain works like Apache::Filter at all, then it needs the reference to maintain an accurate handler count, so you can safely igore the warning. I haven't looked at the code, though. > Mozilla shows empty screen. I have in httpd.conf: > > SetHandler perl-script > PerlHandler Apache::OutputChain Apache::GzipChain My::Site > you would be better off moving to Apache::Filter and Apache::Compress, both of which are well developed and maintained... I think the general opinion is that OutputChain and GzipChain are becoming more deprecated by the day... --Geoff
Apache::GzipChain & Apache::OutputChain
Hi! What does this error messsage mean? untie attempted while 1 inner references still exist at /usr/local/lib/perl5/site_perl/5.6.1/Apache/OutputChain.pm line 28. Mozilla shows empty screen. I have in httpd.conf: SetHandler perl-script PerlHandler Apache::OutputChain Apache::GzipChain My::Site Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=freebsd, osvers=4.3-stable, archname=i386-freebsd uname='freebsd richard.eu.org 4.3-stable freebsd 4.3-stable #0: sat apr 28 12:13:21 eet 2001 [EMAIL PROTECTED]:usrsrcsyscompilemykernel i386 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include', optimize='-pipe -O2 -march=i686', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3 [FreeBSD] 20010315 (release)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags ='-Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lgdbm -lm -lc -lcrypt -liconv -lutil perllibs=-lm -lc -lcrypt -liconv -lutil libc=, so=so, useshrplib=true, libperl=libperl.so Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -Wl,-R/usr/lib/perl5/5.6.1/i386-freebsd/CORE' cccdlflags='-DPIC -fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under freebsd Compiled at May 4 2001 20:25:10 @INC: /usr/lib/perl5/5.6.1/i386-freebsd /usr/lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/i386-freebsd /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl . -- ☻ Ričardas Čepas ☺ ~~ ~
Re: module to hit back at default.ida atack ?
> Angel R Rivera writes: Angel> how about a way to tell it not to report an ip?? i just Angel> reported on myself. :) That feature is in the latest version (1.07), thanks to David Young. DeWitt>> So *that's* why Reuven has CodeRed.pm CC him on the warning DeWitt>> emails. DeWitt>> And I thought he was just nuts. ;) I am nuts -- but in this particular case, I was just naive and foolish to think that people would change the $cc_address variable at the top of the program. So I've been flooded by a ridiculous number of e-mail messages from people who didn't change that variable. Version 1.08, which I hope to put out tonight or tomorrow, will improve the configuration a bit, and will also improve on the documentation. Reuven
Segmentation faults, some strace logs
Here's some output from strace on Linux Apache 1.13.19 with mod_perl 1.24 and perl 5.6.0 = 04:48:26 stat64("/proj/Web/EMIS/Mason/live/redirect", {st_mode=S_IFREG|0775, st_size=243, ...}) = 0 04:48:26 stat64("/proj/Web/EMIS/Mason/obj/live/redirect", {st_mode=S_IFREG|0644, st_size=902, ...}) = 0 04:48:26 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 04:48:26 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 04:48:26 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 04:48:26 --- SIGSEGV (Segmentation fault) --- 04:48:26 chdir("/etc/httpd/core") = 0 04:48:26 rt_sigaction(SIGSEGV, {SIG_DFL}, {SIG_DFL}, 8) = 0 04:48:26 getpid() = 5320 04:48:26 kill(5320, SIGSEGV)= 0 04:48:26 sigreturn()= ? (mask now []) 04:48:26 --- SIGSEGV (Segmentation fault) --- == Here's "redirect" Mason component. <%init> #$r->status(200); $r->header_out(Location=>$url); # Do this so Apache doesn't try to re-read post data $r->method('GET'); $r->headers_in->unset('Content-length'); # Exit with 302 status $m->abort(302); <%args> $url === Looks like the problem is caused by 'abort'. I did not do much digging yet but looks like abort calls 'croak'. Unrelational to segv we expirienced strange "Bizzare copy of ARRAY in aassign in Carp/Heavy.pm line 79" messages at random instead of display of nice stack trace. Could it be some perl5.6.0 bug? Andrei
RE: perl-status problems
It sounds like you either don't have mod_perl(Apache::*) installed correctly or you don't have your Apache libs in your @INC. Try: (perldoc Apache::Status) from the command line and see if it finds the module. if it doesn't, make sure you are pointing to the right libs in your startup.pl. i.e. use lib qw(/dir/where/ApachePM's); good luck -Original Message-From: Pawel Piecuch [mailto:[EMAIL PROTECTED]]Sent: Wednesday, August 08, 2001 8:36 AMTo: [EMAIL PROTECTED]Subject: perl-status problems With this config file, when I access /perl-status I got message in log file: [Wed Aug 8 14:09:00 2001] [error] Undefined subroutine &Apache::Status::handler called. What does it mean? Pawel ServerName www.energetyka.net ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/almainet/www-enet/html Alias /cgi-bin/ /home/almainet/www-enet/cgi-bin/ Alias /cgi-admin/ /home/almainet/www-enet/cgi-admin/ ErrorLog /var/log/httpd/enet-error.log CustomLog /var/log/httpd/enet-access.log combined PerlModule B::TerseSize PerlModule Apache:Status SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI Allow from all PerlSendHeader On SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI Allow from all PerlSendHeader On SetHandler server-status Order deny,allow Deny from all Allow from .almainternet.pl .alma.poznan.pl SetHandler server-info Order deny,allow Deny from all Allow from .almainternet.pl .alma.poznan.pl SetHandler perl-script PerlHandler Apache::Status PerlSetVar StatusOptionsAll On PerlSetVar StatusTerse On PerlSetVar StatusTerseSize On PerlSetVar StatusTerseSizeMainSummary On order deny,allow Deny from all Allow from .almainternet.pl .alma.poznan.pl Pawe³ Piecuch___ Zawarte w niniejszej wiadomo¶ci o¶wiadczenia stanowi±_ o¶wiadczenia woli lub wiedzy sk³adane w imieniu Alma Internet S.A__ Alma Internet SA_ tel +48-61-8432630, fax +48-61-8432629_ www: http://www.almainternet.pl e-mail: [EMAIL PROTECTED]_
perl-status problems
With this config file, when I access /perl-status I got message in log file: [Wed Aug 8 14:09:00 2001] [error] Undefined subroutine &Apache::Status::handler called. What does it mean? Pawel ServerName www.energetyka.net ServerAdmin [EMAIL PROTECTED] DocumentRoot /home/almainet/www-enet/html Alias /cgi-bin/ /home/almainet/www-enet/cgi-bin/ Alias /cgi-admin/ /home/almainet/www-enet/cgi-admin/ ErrorLog /var/log/httpd/enet-error.log CustomLog /var/log/httpd/enet-access.log combined PerlModule B::TerseSize PerlModule Apache:Status SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI Allow from all PerlSendHeader On SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI Allow from all PerlSendHeader On SetHandler server-status Order deny,allow Deny from all Allow from .almainternet.pl .alma.poznan.pl SetHandler server-info Order deny,allow Deny from all Allow from .almainternet.pl .alma.poznan.pl SetHandler perl-script PerlHandler Apache::Status PerlSetVar StatusOptionsAll On PerlSetVar StatusTerse On PerlSetVar StatusTerseSize On PerlSetVar StatusTerseSizeMainSummary On order deny,allow Deny from all Allow from .almainternet.pl .alma.poznan.pl Pawe³ Piecuch___ Zawarte w niniejszej wiadomo¶ci o¶wiadczenia stanowi±_ o¶wiadczenia woli lub wiedzy sk³adane w imieniu Alma Internet S.A__ Alma Internet SA_ tel +48-61-8432630, fax +48-61-8432629_ www: http://www.almainternet.pl e-mail: [EMAIL PROTECTED]_
Using PerlTypeHandler and PerlHandler for the same
Hi, In my httpd.conf file I have: SetHandler perl-script PerlTypeHandler foo PerlHandler bar and then in the foo and bar files I have: --file foo.pm- package foo; sub handler { my $r = shift; $r->log_error("I'm in foo."); } 1; --file bar.pm- package bar; sub handler { my $r = shift; $r->log_error("I'm in bar."); } 1; I would expect this experiment would print out "I'm in foo." followed by "I'm in bar." to my apache error log. It only prints "I'm in foo." If I remove the PerlTypeHandler line from the httpd.conf I get only "I'm in bar." If I leave the TypeHandler but omit the PerlHandler, and add $r->push_handlers(PerlHandler=>\&bar::handler); to foo.pm I still only get "I'm in foo." I'm using Perl 5.6 and mod_perl 1.25 with apache 1.3.19 Why does this not work as I expected? Thanks. Jay Buffington