Help me ! about Apache sent bytes
Dear all members: I hava a question, send 0 byte to Client , Apache Server log 5 bytes in Access Log file, send 2 bytes to Client, Apache Server log 14 bytes in Access log file. Why My code is : = my $r = shift; $r->send_http_header; $r->print("ok"); # this is send 2 bytes, log 14bytes = my $r = shift; $r->send_http_header; $r->print(""); # this is send 0 byte,log 5bytes = please tell me why? Your firend, Wac
Re: How to I secure /cgi-bin?
Use Location for paths respective to the server root. ... - Original Message - From: "Ron Savage" <[EMAIL PROTECTED]> To: "mod_perl" <[EMAIL PROTECTED]> Sent: Wednesday, June 27, 2001 9:23 PM Subject: Q: How to I secure /cgi-bin? > Test env: > Apache/1.3.20 (Win32) mod_perl/1.25_01-dev mod_ssl/2.8.4 OpenSSL/0.9.6a > > I just tried this to stop myself running any scripts from /cgi-bin, but it does not stop me. Yeah, yeah, I restart the server after > every patch to httpd.conf. > > > Options Indexes FollowSymLinks MultiViews > Order allow,deny > Deny from all > Allow from 127.0.0.1 > > > My aim of course is to use > Order deny,allow > to stop all others! > > I tried > > and > Allow from 128.0.0.1 > just to see what would happen, but that did not stop me either. > > Cheers > Ron Savage > [EMAIL PROTECTED] > http://savage.net.au/index.html > >
Q:how to get the byte amounts
I want to get the byte amounts that sent to the client via Apache, so I write the following code #!/usr/bin/perl use strict; package Apache::GetByte; use Apache::Constants qw(:response); use Apache (); sub handler{ my $r = shift; my $byte=$r->bytes_sent; warn "BYTE = $byte \n"; return DECLINED; } 1; In apache httpd.conf SetHandler perl-script PerlLogHandler Apache::GetByte but the result is BYTE = 0 in apache error_log. Why? What shall I do? Yours sincerely Li junfeng Livin' on the Edge(Dalian)CO.Ltd Room 106, A Bldg. 1 Huoju Road Hi-Tech Zone, Dalian, China Zip:116023 Tel:86-0411-4753511 Fax:86-0411-4753577 E-mail [EMAIL PROTECTED]
Q: How to I secure /cgi-bin?
Test env: Apache/1.3.20 (Win32) mod_perl/1.25_01-dev mod_ssl/2.8.4 OpenSSL/0.9.6a I just tried this to stop myself running any scripts from /cgi-bin, but it does not stop me. Yeah, yeah, I restart the server after every patch to httpd.conf. Options Indexes FollowSymLinks MultiViews Order allow,deny Deny from all Allow from 127.0.0.1 My aim of course is to use Order deny,allow to stop all others! I tried and Allow from 128.0.0.1 just to see what would happen, but that did not stop me either. Cheers Ron Savage [EMAIL PROTECTED] http://savage.net.au/index.html
RE: %ENV & push_handlers
well, something isn't quite right... you aren't by chance using method handlers are you? at this point, you may want to post (some) code and/or the relevant snippet from your httpd.conf. using push_handlers with pnotes has never been a problem for me # from some handler somewhere $r->pnotes(foo => 'bar'); $r->push_handlers(PerlCleanupHandler => sub { warn shift->pnotes('foo'); }); works no problemo... --Geoff -Original Message- From: Terry Moran To: Geoffrey Young Sent: 6/27/01 7:57 PM Subject: Re: %ENV & push_handlers Geoff: I really appreciate the help. I got a chance to play around some more, and it looks like this %ENV block is very specific to using push_handlers, and moreover that it's blocking pnotes & notes methods of the mod_perl API as well. I was thinking maybe it was a version thing, but I'm at mod_perl 1.25, so that looks like it checks out. What I'm left with is getting a work-around, and I have one. I'm just going to need to push_handler my templating mod in order to give it the proper %ENV, or pnotes values (if I can find the time to translate into it that is, unfortunately an important part of design ;) ). Anyhow, I get the feeling that push_handlers is somehow acting as a subrequest - which would explain all of this. Not that I've found that documented. I really appreciate the background on this - thanks!!! Terry Geoffrey Young wrote: > sure... > > pnotes was documented after the eagle book was published, but it's my > favorite method :) > > I dunno why %ENV is misbehaving - IIRC there were some reports in older > mod_perls, but I thought it was taken care of recently. > > at any rate, %ENV is a resource drain - you're better off with pnotes. > besides, they can hold references too, which makes life oh, so much > better... > > my %hash; > $r->pnotes(FOO => \%hash); > > my $href = $r->pnotes('FOO'); > > --Geoff > > -Original Message- > From: Terry Moran > To: Geoffrey Young > Sent: 6/27/01 3:51 PM > Subject: Re: %ENV & push_handlers > > Geoff: > > Thanks so much for the fast response! My version of the Eagle Book > doesn't even list that command, but it'll work like a charm. Just leaves > me wondering why %ENV jumps around like that... > > Thanks again! > > Terry > > Geoffrey Young wrote: > > > > -Original Message- > > > From: Terry Moran [mailto:[EMAIL PROTECTED]] > > > Sent: Wednesday, June 27, 2001 3:39 PM > > > To: [EMAIL PROTECTED] > > > Subject: %ENV & push_handlers > > > > > > > > > To all: > > > > > > I am putting together a site utilizing stacked handlers where > the > > > first of the modules uses the push_handlers call in order to > > > dynamically > > > choose a processing module. This 'pushed' handler then goes about > > > processing the request & filling up the %ENV with information for > the > > > next in the stack to use to produce the actual page. However, after > a > > > couple of hours of working with this set-up, I'm finding that > > > nformation > > > that is placed in the %ENV hash during the 'pushed' handler's > > > processing > > > stage are lost by the time the Templating module goes to look > > > for them. > > > Can anyone confirm that they've seen this, or can someone > > > suggest a fix? > > > I seem to be quite at a loss as to what to do... > > > > since you are already using $r->push_handlers use $r->pnotes instead > of > > %ENV. > > > > --Geoff > >
Re: where to report apache::session 1.53 bug ?
Most of the time it is really bad to email open source authors directly. They released a piece of software out of kindness. But hey, it's open source and they can't hold up the entire world of support like an Atlas, 24x7. That's the job of open forums like this. So the author continues time to write new updates while the forums basically run themselves with other people sharing ideas and support. At 04:50 AM 6/28/01 +0700, Iwan Garnadi wrote: >I don't know where to report apache::session bug , because I sent to the >author , I didn't get any reply yet __ Gunther Birznieks ([EMAIL PROTECTED]) eXtropia - The Open Web Technology Company http://www.eXtropia.com/
Re: where to report apache::session 1.53 bug ?
On Thu, 28 Jun 2001, Iwan Garnadi wrote: > I don't know where to report apache::session bug , because I sent to the > author , I didn't get any reply yet Maybe you will have to wait more than four days... -jwb
RE: where to report apache::session 1.53 bug ?
Could you Please share your bug info with us? I am using Apache::Session now and having troubles with it... Thank you! Laurie -Original Message- From: Iwan Garnadi [mailto:[EMAIL PROTECTED]] Sent: Wednesday, June 27, 2001 5:50 PM To: [EMAIL PROTECTED] Subject: where to report apache::session 1.53 bug ? I don't know where to report apache::session bug , because I sent to the author , I didn't get any reply yet
where to report apache::session 1.53 bug ?
I don't know where to report apache::session bug , because I sent to the author , I didn't get any reply yet
RE: %ENV & push_handlers
> -Original Message- > From: Terry Moran [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 27, 2001 3:39 PM > To: [EMAIL PROTECTED] > Subject: %ENV & push_handlers > > > To all: > > I am putting together a site utilizing stacked handlers where the > first of the modules uses the push_handlers call in order to > dynamically > choose a processing module. This 'pushed' handler then goes about > processing the request & filling up the %ENV with information for the > next in the stack to use to produce the actual page. However, after a > couple of hours of working with this set-up, I'm finding that > nformation > that is placed in the %ENV hash during the 'pushed' handler's > processing > stage are lost by the time the Templating module goes to look > for them. > Can anyone confirm that they've seen this, or can someone > suggest a fix? > I seem to be quite at a loss as to what to do... since you are already using $r->push_handlers use $r->pnotes instead of %ENV. --Geoff
%ENV & push_handlers
To all: I am putting together a site utilizing stacked handlers where the first of the modules uses the push_handlers call in order to dynamically choose a processing module. This 'pushed' handler then goes about processing the request & filling up the %ENV with information for the next in the stack to use to produce the actual page. However, after a couple of hours of working with this set-up, I'm finding that nformation that is placed in the %ENV hash during the 'pushed' handler's processing stage are lost by the time the Templating module goes to look for them. Can anyone confirm that they've seen this, or can someone suggest a fix? I seem to be quite at a loss as to what to do... Thanks *so* much in advance!!! Terry Moran
StatINC Reload on NT
I have begun development on a new project and I am using Apache on NT with mod_perl. I have created a lot of modules and I am using them in my code. The problem is that as I continue to develop, some modules keep changing, and I am getting tired of restarting the server. I have read the mod_perl Coding guidelines three times now. Under the coding guidelines it has the example of using Apache::StatINC. I followed it the instructions exactly, but yet, it does NOT work. After that I tried Apache::Reload both ways with no success. Has anyone out there got either of these working on NT? I do not want to use work-arounds on this large project. I really need to have the ability to reload these modules on each hit to the server while developing the core code set. I even have the apache book, but I can't find any mention of this there either. Please advise. Scott Purcell
RE: Requests using If-Modified-Since cause response Set-Cookie to be discarded
> me, on the other hand, i don't see the problem with > > on incoming request > if has-cookie 'session' > { > update serverside 'accesstime' for session[this] to NOW Oh yeah? HOW??? > if not-modified-since > report same > else { > send headers w/ cookie > generate page > } > } > else > redirect to login page > > doesn't look unmanageable to me (until someone shows me the > light, of course)...? How many sessions/day are you running? How big is your DB? How much processor do you have to throw at this? (these are the hurdles for storing serverside info). OTOH, what *benefit* is derived from storing all of this stuff serverside? And how about: for the page in question, make an invisible frameset. Use the request for the FRAMESET (or the invisible frame) to update cookies, etc, and when the main frame is requested, 304 has already been determined but timestamps are properly updated. yes? no? L8r, Rob
Re: Requests using If-Modified-Since cause response Set-Cookie to be discarded
On Mon, Jun 25, 2001 at 04:54:59PM -0700, Rob Bloodgood wrote: > > > maybe storing 'last-access-time' on the server, instead of in > > > the client-side, via cookie, would solve this snafu? > > > > But if you want to give out a new cookie on every request ? > > How would you prevent them from copying or tampering with the contents? > > a MD5-hash would stop them from changing values, but they could > > still copy the cookie, > > so the next idea is timeouts, and when you use timeouts it would > > be nice if the user > > don't have to login every couple of minutes, but would get a new > > valid cookie automaticly... > > Aside from the fact that a server-side tracking system is bound to become > incredibly unmanageable, very quickly, in terms of server-side storage... > > One of the methods I've used is to include a timestamp in the user's info > (incl the MD5 hash? see the Eagle for Encryption of Cookies w/ MD5). > > THEN, when deparsing the cookie, DELETE it if the timestamp is too old. > > THEN, you either have a valid, non-timed out session, or no session at all > (which is what you were worrying about in the first place, no?). If your > system is based on session LENGTH (ie this ticket is good for one hour from > last access), all you have to do is re-set the timestamp to the current > time. but he's saying that he can't send a cookie AND do the 'not-changed-since' thing. me, on the other hand, i don't see the problem with on incoming request if has-cookie 'session' { update serverside 'accesstime' for session[this] to NOW if not-modified-since report same else { send headers w/ cookie generate page } } else redirect to login page doesn't look unmanageable to me (until someone shows me the light, of course)...? -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, "Some Came Running" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Re: SSI Lost with Mod Perl?
On Tue, Jun 26, 2001 at 01:06:06AM -0400, Brooklyn Linux Solutions CEO wrote: > > I've given Filter and SSI a shot according to the perldocs. > > It didn't work. I stated to hhack on some of the problems, which first involved > in the make install depositing them in the wrong diretory, and then they SSI > needed use Apache::Filter statements added. have you tried HTML::Mason yet? it's got serious power, but you can have some quickie modular sites up in a jiffy. .../autohandler: <& SELF:title &> <& SELF:heading &> <& SELF:navbar &> <% $body %> <& SELF:footer &> <%method title>Welcome <%method heading>Welcome to our site <%method navbar><% &my_navbar() %> <%method footer>It is now <% scalar localtime %> at our offices <%once> sub my_navbar { ... } <%init> % my $body = $m->comp_next(); # set dependent variables first .../search.md: Search:<& searchform,query=>$query &> % if ($query) { Found:<% &list($query) %> % } <%method searchform> <%method title>Search <% $recs %> <%method heading><& SELF:title &> <%once> sub list { ... } <%shared> my $recs = ... ? 'Products' : 'Services'; <%args> $query => undef -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, "Some Came Running" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Re: startup
On Wed, 27 Jun 2001, Purcell, Scott wrote: > Hello Stas, > I think somehow my question got out of sync with the answer. My question > was, if I do a use cgi qw(-compile: all) in my startup (which I have done), > do I still need to put a use cgi in each of my .pl files? I have read > through the docs, and the book, but as a rookie to mod-perl these kinds of > questions are hard for me to get a handle on. I assume the answer is yes, > but instead of actually reloading the module that it would check the cache > and use that? Am I on the right track. Also, there is quite a bit of > documentation out there, could you point me to the one that talks about > this? Scott, please keep the questions at the list, wheneven someone or I can answer we will do it. You minimize your chances to get answered when you try to do it in private. As I said, the guide covers this question. Here is the direct URL: http://perl.apache.org/guide/config.html#The_Confusion_with_use_in_the_ Here is a link to the notes in my previous reply to you: http://perl.apache.org/guide/performance.html#Preloading_Perl_Modules_at_Serve > > I hope I am not offending you by asking, > Sincerely > Scott > > -Original Message- > From: Stas Bekman [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 27, 2001 11:10 AM > To: Purcell, Scott > Cc: mod_perl list > Subject: Re: Startup.pl File Q > > > On Wed, 27 Jun 2001, Issac Goldstand wrote: > > > Actually, I believe that it helps to do a use cgi qw(-compile: all) as > this > > will pre-compile the entire module (which makes it go a bit faster for > it's > > first request). > > As Issac correctly said, but usually you don't want :all, but only the tag > groups that you really need. Scott, please refer to the guide, it explain > what, how and why. Including memory measurement with different configs. > > > > >Issac > > > > - Original Message - > > From: "Purcell, Scott" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, June 27, 2001 17:29 > > Subject: Startup.pl File Q > > > > > > > Mod_perl version: 1.25_01-dev > > > Perl version: 5.6.1 > > > Apache Version: 1.3.20 > > > OS:NT > > > > > > I am in the apache book and I am doing some hacking. In my startup.pl > > file, > > > I put 'use CG qw(:standard); along with some other modules. > > > Anyway, then I typed that little dittie below, and commented out the > $use > > > CGI (since I thought it would be loaded in the startup.pl file). > > > > > > It does not work. Are the items in the startup.pl file only used with > > > handlers? > > > > > > Thanks > > > Scott > > > > > > > > > > > > ### code below just for reference # > > > > > > #! /usr/local/bin/perl > > > > > > #use CGI qw(:standard); > > > use strict; > > > > > > my $name = param('name') || 'Anonymous'; > > > > > > print header(), > > > start_html(-title=>'Yo!',-bgcolor=>'blue'), > > > h1("Hello $name"), > > > p( > > > "To change your name, enter it into the text field below and press", > > > em("change name.") > > > ), > > > start_form(), > > > "Name: ",textfield(-name=>'name',-value=>'Anonymous'), > > > submit(-value=>'Change Name'), > > > end_form(), > > > hr(), > > > end_html(); > > > > > > Scott Purcell > > > > > > > > > _ > Stas Bekman JAm_pH -- Just Another mod_perl Hacker > http://stason.org/ mod_perl Guide http://perl.apache.org/guide > mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/ > http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ > _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Directory Restrictions
Philip Mak <[EMAIL PROTECTED]> said something to this effect on 06/27/2001: > On Wed, 27 Jun 2001, will trillich wrote: > > okay -- but if you want some of your site to be indexed by the > > standard mod_autoindex, yet have mod_perl intervene for certain > > subtrees, you'll find that mod_perl never gets a chance at it > > because the mod_autoindex gadjets catch it at an earlier stage. > > i think. > > How about using RewriteRule? For example, you can do: > > RewriteRule /somedir/ index.pl > > and then when people visit http://your-site.com/somedir/, it will call > index.pl. index.pl can use $ENV{REQUEST_URI} to determine which directory > to display. Or just DirectoryIndex index.pl (or /index.pl) (darren) -- Now imagine a Moebius vortex inside a spherical constant, and you've got my cosmology.
Re: Directory Restrictions
will trillich <[EMAIL PROTECTED]> said something to this effect on 06/27/2001: > okay -- but if you want some of your site to be indexed by the > standard mod_autoindex, yet have mod_perl intervene for certain > subtrees, you'll find that mod_perl never gets a chance at it > because the mod_autoindex gadjets catch it at an earlier stage. > i think. > > what stage would that happen to be? and how do we configure > httpd.conf to Do What We Want? No, mod_autoindex functions at the content generation stage (take a look at the module declaration in mod_autoindex.c). The best way to do it, I would say, is to catch directory requests in the translation phase and push your handler explicitly if the request is for a directory you want to handle. (darren) -- Whether you can hear it or not the Universe is laughing behind your back.
Re: Directory Restrictions
On Wed, 27 Jun 2001, will trillich wrote: > okay -- but if you want some of your site to be indexed by the > standard mod_autoindex, yet have mod_perl intervene for certain > subtrees, you'll find that mod_perl never gets a chance at it > because the mod_autoindex gadjets catch it at an earlier stage. > i think. How about using RewriteRule? For example, you can do: RewriteRule /somedir/ index.pl and then when people visit http://your-site.com/somedir/, it will call index.pl. index.pl can use $ENV{REQUEST_URI} to determine which directory to display.
Re: Startup.pl File Q
Purcell, Scott <[EMAIL PROTECTED]> said something to this effect on 06/27/2001: > Mod_perl version: 1.25_01-dev > Perl version: 5.6.1 > Apache Version: 1.3.20 > OS:NT > > I am in the apache book and I am doing some hacking. In my startup.pl file, > I put 'use CG qw(:standard); along with some other modules. > Anyway, then I typed that little dittie below, and commented out the $use > CGI (since I thought it would be loaded in the startup.pl file). > > It does not work. Are the items in the startup.pl file only used with > handlers? You still need to tell Perl that the script in question (e.g., the one you attached) needs to use the functions from CGI. Without that line, "param" and friends are not defined. Putting CGI in your startup.pl means that it will be required and compiled only once; all the scripts/modules that need to make use of the pre-compiled module still need to 'use' it. In these cases, only the importing of subroutine names and stuff like that happens. As an aside, you could (possibly) get away with invoking the param function as CGI::param; you didn't specify what kind of "didn't work" you got in the error log. (darren) -- Every program has at least one bug, and at least one line of code that can be removed. Therefore, by induction, every program can be reduced to one line of code that doesn't work.
Re: Directory Restrictions
On Wed, Jun 27, 2001 at 08:52:10AM -0500, Adekunle Olonoh wrote: > > > I found it, quite be accident in the Eagle Book > > > > Lost the page number, but it was in Chapter 4. > > There's some discussion in the last paragraph of page 86. > > > > anybody got a more specific pointer to help us fuzzy searchers > > find 'how to have mod_perl handle directory requests'? > > Hopefully this should be a pretty decent start: > sub handler { > if ($r->content_type eq 'httpd/unix-directory') { okay -- but if you want some of your site to be indexed by the standard mod_autoindex, yet have mod_perl intervene for certain subtrees, you'll find that mod_perl never gets a chance at it because the mod_autoindex gadjets catch it at an earlier stage. i think. what stage would that happen to be? and how do we configure httpd.conf to Do What We Want? (i think, that if you disable mod_autoindex, that you can have mod_perl handle directories just as you say. but there's some magic involved in running BOTH mod_autoindex and having mod_perl do a directory now and then. i think. maybe.) -- I figure: if a man's gonna gamble, may as well do it without plowing. -- Bama Dillert, "Some Came Running" [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us!
Re: Startup.pl File Q
On Wed, 27 Jun 2001, Issac Goldstand wrote: > Actually, I believe that it helps to do a use cgi qw(-compile: all) as this > will pre-compile the entire module (which makes it go a bit faster for it's > first request). As Issac correctly said, but usually you don't want :all, but only the tag groups that you really need. Scott, please refer to the guide, it explain what, how and why. Including memory measurement with different configs. > >Issac > > - Original Message - > From: "Purcell, Scott" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, June 27, 2001 17:29 > Subject: Startup.pl File Q > > > > Mod_perl version: 1.25_01-dev > > Perl version: 5.6.1 > > Apache Version: 1.3.20 > > OS:NT > > > > I am in the apache book and I am doing some hacking. In my startup.pl > file, > > I put 'use CG qw(:standard); along with some other modules. > > Anyway, then I typed that little dittie below, and commented out the $use > > CGI (since I thought it would be loaded in the startup.pl file). > > > > It does not work. Are the items in the startup.pl file only used with > > handlers? > > > > Thanks > > Scott > > > > > > > > ### code below just for reference # > > > > #! /usr/local/bin/perl > > > > #use CGI qw(:standard); > > use strict; > > > > my $name = param('name') || 'Anonymous'; > > > > print header(), > > start_html(-title=>'Yo!',-bgcolor=>'blue'), > > h1("Hello $name"), > > p( > > "To change your name, enter it into the text field below and press", > > em("change name.") > > ), > > start_form(), > > "Name: ",textfield(-name=>'name',-value=>'Anonymous'), > > submit(-value=>'Change Name'), > > end_form(), > > hr(), > > end_html(); > > > > Scott Purcell > > > _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Startup.pl File Q
Actually, I believe that it helps to do a use cgi qw(-compile: all) as this will pre-compile the entire module (which makes it go a bit faster for it's first request). Issac - Original Message - From: "Purcell, Scott" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 27, 2001 17:29 Subject: Startup.pl File Q > Mod_perl version: 1.25_01-dev > Perl version: 5.6.1 > Apache Version: 1.3.20 > OS:NT > > I am in the apache book and I am doing some hacking. In my startup.pl file, > I put 'use CG qw(:standard); along with some other modules. > Anyway, then I typed that little dittie below, and commented out the $use > CGI (since I thought it would be loaded in the startup.pl file). > > It does not work. Are the items in the startup.pl file only used with > handlers? > > Thanks > Scott > > > > ### code below just for reference # > > #! /usr/local/bin/perl > > #use CGI qw(:standard); > use strict; > > my $name = param('name') || 'Anonymous'; > > print header(), > start_html(-title=>'Yo!',-bgcolor=>'blue'), > h1("Hello $name"), > p( > "To change your name, enter it into the text field below and press", > em("change name.") > ), > start_form(), > "Name: ",textfield(-name=>'name',-value=>'Anonymous'), > submit(-value=>'Change Name'), > end_form(), > hr(), > end_html(); > > Scott Purcell >
Startup.pl File Q
Mod_perl version: 1.25_01-dev Perl version: 5.6.1 Apache Version: 1.3.20 OS:NT I am in the apache book and I am doing some hacking. In my startup.pl file, I put 'use CG qw(:standard); along with some other modules. Anyway, then I typed that little dittie below, and commented out the $use CGI (since I thought it would be loaded in the startup.pl file). It does not work. Are the items in the startup.pl file only used with handlers? Thanks Scott ### code below just for reference # #! /usr/local/bin/perl #use CGI qw(:standard); use strict; my $name = param('name') || 'Anonymous'; print header(), start_html(-title=>'Yo!',-bgcolor=>'blue'), h1("Hello $name"), p( "To change your name, enter it into the text field below and press", em("change name.") ), start_form(), "Name: ",textfield(-name=>'name',-value=>'Anonymous'), submit(-value=>'Change Name'), end_form(), hr(), end_html(); Scott Purcell
ANNOUNCE: AxKit::XSP::PerForm (fwd)
I thought this might be of interest to some of the people who are fiddling with widgets at the moment ;-) -- /||** Founder and CTO ** ** http://axkit.com/ ** //||** AxKit.com Ltd ** ** XML Application Serving ** // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** // \\| // ** mod_perl news and resources: http://take23.org ** \\// //\\ // \\ -- Forwarded message -- Date: Wed, 27 Jun 2001 15:19:51 +0100 (BST) From: Matt Sergeant <[EMAIL PROTECTED]> To: AxKit Users Mailing List <[EMAIL PROTECTED]> Subject: ANNOUNCE: AxKit::XSP::PerForm This module is a "magic" forms library for building complex web applications. No docs yet, but here's an example. You also need to apply a stylesheet to the results to get HTML or WML or whatever you're after for your form. There's a HTML stylesheet in the stylesheets/ directory. We suggest you add it to the stylesheet you're using for your site using . The Example (this is a real example for a project I'm working on): http://apache.org/xsp/core/v1"; xmlns:web="http://axkit.org/NS/xsp/webutils/v1"; xmlns:f="http://axkit.org/NS/xsp/perform/v1"; language="perl" indent-result="yes" > Time::Object Time::Seconds
Re: Directory Restrictions
> I found it, quite be accident in the Eagle Book > > Lost the page number, but it was in Chapter 4. There's some discussion in the last paragraph of page 86. > anybody got a more specific pointer to help us fuzzy searchers > find 'how to have mod_perl handle directory requests'? Hopefully this should be a pretty decent start: - package My::DirList; use strict; use Apache; use Apache::Constants qw(:common); sub handler { my $r = shift; if ($r->content_type eq 'httpd/unix-directory') { # Do whatever you need to do right here return OK; } else { return DECLINED; } } 1; -- ___ Ade Olonoh, BOTTLED SOFTWARE 317.576.1120 x12 (phone) 317.576.1135 (fax) ___
Help me , about $r->bytes_sent
Dear All, I want to write a handler, function : log client request file size. My code can't work: Apache Config file SetHandler perl-script PerlLogHandler My::Test Options ExecCGI My::Test package My::Test; sub handler { my $r = shift; $r->send_http_header; open (FILE,">>log.txt"); print FILE $r->filename ."\t". $r->bytes_sent . "\n"; close FILE; } this handler can log file name for request , but $r->bytes_sent is 0 at all time. Your friend, wac
RE: missing mtime in request rec?
> -Original Message- > From: darren chamberlain [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 27, 2001 8:28 AM > To: '[EMAIL PROTECTED]' > Subject: Re: missing mtime in request rec? [snip] > > Add a "use Apache::File;" to the top of the module. See p 492 of > the Eagle book; mtime is one of the methods added to the Apache > class when you use Apache::File. well, I know that :) I'm not saying that $r->mtime produces a runtime error (which would happen if I didn't use() Apache::File), but that it returns Jan 1, 1970 for anything that isn't handled by the default Apache handler... #!/usr/bin/perl use Apache::File; use Apache::Util qw(ht_time); my $r = shift; $r->send_http_header('text/plain'); print ht_time($r->mtime), "\n"; print ht_time((stat $r->finfo)[9]), "\n"; in my mind, at least, those two calls ought to be the same. if you insert a call to $r->update_mtime all is ok. but, it would seem that if r->mtime is the modification time of the requested file, r->mtime ought to be set when Apache stats the file and inserts the other finfo stuff. but I'll exchange my logic for proof that not setting mtime is intentional :) --Geoff
Re: missing mtime in request rec?
Geoffrey Young <[EMAIL PROTECTED]> said something to this effect on 06/26/2001: > I did some more digging... > > it seems that any request that is served by the default Apache content > handler is ok - only those that are processed by mod_perl (well, anything > that isn't the default) seem to be affected. > > this doesn't seem quite right to me - if Apache can determine r->filename > and stat the file for r->finfo, then it ought to be setting r->mtime, right? > so maybe somewhere in http_request.c/get_path_info there needs to be a fix? > > or maybe I'm missing some history here... Add a "use Apache::File;" to the top of the module. See p 492 of the Eagle book; mtime is one of the methods added to the Apache class when you use Apache::File. (darren) -- Death to all fanatics!
Re: pass cookie along with the POST request?
Islandman <[EMAIL PROTECTED]> said something to this effect on 06/26/2001: > The small code segment below will get the contents of a web page using a > perl script. The site I want to access wants a cookie sent as well. > > There is a cookie for this site is in my ~/.netscape/cookies file. How > do I change the code below so I can fake pass the cookie along with the > POST request? > > Will I need to modify the format of what is in ~/.netscape/cookies? Create a HTTP::Cookies::Netscape object: use HTTP::Cookies; my $c = HTTP::Cookies::Netscape->new( File => "$ENV{HOME}/.netscape/cookies", AutoSave => 1, ); HTTP::Cookies::Netscape objects have a hashref called COOKIES, which is a hash of hashes of hashes of lists. Access the cookies' values as such: my $val = $c->{COOKIES}->{$host}->{$path}->{$cookie_name}->[1]; perldoc LWP::UserAgent tells us: $ua->cookie_jar([$cookies]) Get/set the HTTP::Cookies object to use. The default is to have no cookie_jar, i.e. never automatically add "Cookie" headers to the requests. So you don't have to access the values directly. Add this to your code: > -- > use strict; > use LWP::UserAgent; > use HTTP::Request::Common; use HTTP::Cookies; > my $URL = 'http://www.yahoo.com'; > my $ua = LWP::UserAgent->new; > my $response = $ua->request(POST "$URL"); my $jar = HTTP::Cookies::Netscape->new( File => "$ENV{HOME}/.netscape/cookies", AutoSave => 1, ); $ua->cookie_jar($jar); > > if ($response->is_success) { >print $response->content; > } else { >print "Bad luck this time\n"; > } Untested, but the docs say it should work. (darren) -- "Quiet and courteous" is often mistaken for "kind and polite." -- Andrew Langmead
Re: RFC: new module: Apache::FakeEnv
Hi! On 26 Jun 2001, at 14:17, Andrew Ho wrote: > That's my script. The caveat is, that it will *never* be possible to > simulate mod_perl entirely--that would be so complex that you might as > well have everybody run a single-child Apache with mod_perl instead. I agree if you are out for debugging mod_perl modules. But I want to /use/ a Perl module - written for use with mod_perl - and run it from the command line. I have a rather complex Content Management System, running under mod_perl, that uses PerlSetVar to set some often used variables. I want to access some of its functionality from a normal shell script. And to do this, I started to write Apache::FakeEnv (or whatever it may be called when I release it). The module is working quite well for my needs (i.e. parse the apache config, make $r->dir_config return correct values), but I thought I rather check (by starting a discussion here) if I missed something (e.g. an easy way to parse Apache Config files or access mod_perl data structures) before putting more work into it or putting it on CPAN. > The "best" way to do it would probably just be to write code for 'em all. > I think many web developers have many of the pieces lying around anyway > from web client libraries. The hard work is in faking out everything and > matching the API. That's indeed rather hard. What I am doing now is to implement the methods I need, and catch the rest via AUTOLOAD and print a error message ("method so-and-so not found"), so if somebody would need this method, he can write a patch :-) Thanks for the feedback! -- D_omm O_xyderkes http://domm.zsi.at M_echanen M_asteuei
[DIGEST] mod_perl digest 2001/06/23
-- mod_perl digest June 17, 2001 - June 23, 2001 -- Recent happenings in the mod_perl world... Features o mod_perl status o cvs patches o module announcements o mailing list highlights o links mod_perl status o mod_perl - stable: 1.25 (released January 29, 2001) [1] - development: 1.25_01-dev [2] o Apache - stable: 1.3.20 (released May 15, 2001) [3] - development: 1.3.21-dev [4] o Perl - stable: 5.6.1 (released April 9, 2001) [5] - development: 5.7.1 [6] cvs patches o win32 enhancement: APACHE_SRC can be either the build or install tree [7] o fix leaky DSO builds [8] module announcements o Apache::ASP 2.17 - provides an Active Server Pages port for Perl scripting only, and enables the development of dynamic web applications with session management and embedded perl code [9] o libapreq 0.33 - Apache::Request and Apache::Cookie functionality [10] o CGI::Application 2.0 - a CGI application toolkit [11] o Apache::DnsZone 0.2 - allows users to change their own zones without actually having access to the nameserver on which their zone is located. Supports MySQL|Oracle|Postgresql as the backend database [12] mailing list highlights o There was a really interesting thread on whether the Set-Cookie header ought to be propagated with a 304 response [13] o Some thoughts and pitfalls of using SSI [14] o Long thread of the week goes to an attempt to explain how mod_perl chooses the version of perl it uses at runtime [15] o There has been a flurry of activity concerning 2.0 over on the dev list: - talk about a 2.0 documentation project [16] - Apache:Test activity [17] [18] links o The Apache/Perl Integration Project [19] o mod_perl documentation [20] o mod_perl modules on CPAN [21] o mod_perl homepage [22] o mod_perl news and advocacy [23] o mod_perl list archives [24] happy mod_perling... --Geoff [EMAIL PROTECTED] -- [1] http://perl.apache.org/dist/ [2] http://perl.apache.org/from-cvs/modperl/ [3] http://www.apache.org/dist/httpd/ [4] http://dev.apache.org/from-cvs/apache-1.3/ [5] http://www.cpan.org/src/stable.tar.gz [6] http://www.cpan.org/src/devel.tar.gz [7] http://marc.theaimsgroup.com/?l=apache-modperl-cvs&m=99314018512820&w=2 [8] http://marc.theaimsgroup.com/?l=apache-modperl-cvs&m=99291820322591&w=2 [9] http://marc.theaimsgroup.com/?l=apache-modperl&m=99297301902841&w=2 [10] http://marc.theaimsgroup.com/?l=apache-modperl&m=99299727921685&w=2 [11] http://marc.theaimsgroup.com/?l=apache-modperl&m=99356928110157&w=2 [12] http://marc.theaimsgroup.com/?l=apache-modperl&m=99358709315447&w=2 [13] http://marc.theaimsgroup.com/?t=9929185173&w=2&r=1 [14] http://marc.theaimsgroup.com/?t=9932055602&w=2&r=1 [15] http://marc.theaimsgroup.com/?t=9933501362&w=2&r=1 [16] http://marc.theaimsgroup.com/?t=9932957031&w=2&r=1 [17] http://marc.theaimsgroup.com/?t=9810080081&w=2&r=1 [18] http://marc.theaimsgroup.com/?t=9933829394&w=2&r=1 [19] http://perl.apache.org [20] http://perl.apache.org/#docs [21] http://www.cpan.org/modules/by-module/Apache/ [22] http://www.modperl.com [23] http://www.take23.org [24] http://marc.theaimsgroup.com/?l=apache-modperl&r=1&w=2
Help me!
Dear All, I want to write a handler, function : log client request file size. My code can't work: Apache Config file SetHandler perl-script PerlLogHandler My::Test Options ExecCGI My::Test package My::Test; sub handler { my $r = shift; $r->send_http_header; open (FILE,">>log.txt"); print FILE $r->filename ."\t". $r->bytes_sent . "\n"; close FILE; } this handler can log file name for request , but $r->bytes_sent is 0 at all time. Your friend, wac