Re: database access
On Tue, 14 Nov 2000, Les Mikesell wrote: I wonder if Apache::DBI could figure out what connections are worth holding open by itself? It could have some hints in the config file like regexps to match plus a setting that would tell it not to make a connection persist unless it had seen x instances of that connect string in y seconds. That really, really sucks, but Apache is selecting on the HTTP socket, and nothing matters beyond that, except signals of course. What you are implying is that DBI will be aware of the connections being closed or SIGALRM coming thru to the apache and on its lap, but it won't happen. Here you have to decide wether you will keep the connection or not, and if it something happens, like closing, you have to wait until user hits the page. Yes you can make ModPerl timestamp DBI links, so that they can be timed out next time a user calls one of the DBI functions, maybe connect? But asynchrosity is out of the question. It would be cool however if you can insert your socket into apaches select queue... isn't that how it works? Then you can really do some funky stuff... just 2c Pavel
Re: Chaining Perl and C handlers
Hi there, On Tue, 14 Nov 2000, Andrew Chen wrote: 1. Request comes in for t.jsp?test=1joe=2 2. Handler steps in and adds another parameter, t.jsp?test=1joe=2moe=3 3. Request is then handled by BEA-Apache bridge so that it is forwarded to Weblogic 4. JSP runs on Weblogic, and the new parameter (joe) moe? can be referenced in the JSP. I'm not familiar with this bridge, but I don't see why this needs to be complicated. What determines the new parameter? After the handler adds the new parameter, could you get it to make another request which then gets caught by mod_rewrite and/or mod_proxy for example? 73, Ged.
strange apache behavior w. Embperl and multilang support
I have 'fi' and 'en' set as preferred laguages. I have code in menu.epl.en and emacs backup in menu.epl.en~, no other menu.epl* files exist. I try to fetch a page http://phi.sqc/new/menu.epl?a=a and instead of displaying the page netscape prompts with a "save as" dialog box saying content type as "application/x-httpd-cgi"! If I save it to a file it contains the emacs backup file. The problem goes away if I do any one of the following: - take away the "?a=a" from the request - delete the menu.epl.en~ file - change epl to html (of course the embperl code stops working) - don't use multilang support, i.e. rename menu.epl.en to menu.epl What seems to happen is that when trying to locate the best language match Apache prefers the menu.epl.en~ over the menu.epl.en (but only with non .html files and with ?a=a arguments) and failes to match the .epl to type text/html. My apache config has: AddLanguage en .en AddLanguage fr .fr AddLanguage de .de AddLanguage da .da AddLanguage el .el AddLanguage it .it AddLanguage fi .fi LanguagePriority en fi fr de AddType text/html .epl Directory /home/httpd/html/new Options +MultiViews Files *.epl SetHandler perl-script PerlHandler HTML::Embperl Options +ExecCGI +MultiViews /files /Directory On RedHat 6.2 I'm running: apache apache-1.3.12 perl-5.00503 mod_perl-1.21 embperl 1.3b5 netscape 4.75
[RFC] Apache::Expires
hi all... I was wondering if anyone has some experience with expire headers for dynamic documents - kinda like mod_expires but for dynamic stuff. why? well, say I have a handler that creates, say, a css document on the fly based upon fields in a database. the css contents won't change regularly (if ever) but every request results in dynamic processing. Wouldn't it be nice to be able to cache dynamic results if I say it's ok? (yes, one could just spit out a static document weekly or whatever, but that's not the point of this discussion, ok :) anyone else see an interest in an Apache::Expires (or whatever)? Is there something out there already? I was thinking of working on it if there is nothing out there, but it would require lots of RFC reading and wrestling with stuff like entity tags... comments/experiences welcome... --Geoff
Re: [RFC] Apache::Expires
At 10:26 15/11/2000 -0500, Geoffrey Young wrote: anyone else see an interest in an Apache::Expires (or whatever)? Is there something out there already? I was thinking of working on it if there is nothing out there, but it would require lots of RFC reading and wrestling with stuff like entity tags... It would definitely be interesting to provide an easy to use API to expiration and caching (at least one that would cover common needs), it's easy to get mixed up in the details. I think Andreas wrote something about all those issues last year, but I can't track it down right now. -- robin b. Always remember you're unique just like everyone else.
RE: [RFC] Apache::Expires
-Original Message- From: Robin Berjon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 15, 2000 10:43 AM To: Geoffrey Young Cc: '[EMAIL PROTECTED]' Subject: Re: [RFC] Apache::Expires At 10:26 15/11/2000 -0500, Geoffrey Young wrote: anyone else see an interest in an Apache::Expires (or whatever)? Is there something out there already? I was thinking of working on it if there is nothing out there, but it would require lots of RFC reading and wrestling with stuff like entity tags... It would definitely be interesting to provide an easy to use API to expiration and caching (at least one that would cover common needs), it's easy to get mixed up in the details. I think Andreas wrote something about all those issues last year, but I can't track it down right now. I think he wrote the section in the guide on headers - that will definitely help sort things out... the more I think about it, thoug, I think it will be quite difficult. say you want to cache a dynamic document for a week from creation - how do you define when the week started? maybe some compromises will be needed, like generically saying "months start at 1" and "weeks start at sunday", etc... just thinking out loud... --Geoff -- robin b. Always remember you're unique just like everyone else.
Re: [OT] mod_perl evangelism
Something on this will happen at the London.pm meeting tomorrow... -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
Re: [RFC] Apache::Expires
Hi, the next alpha release of Embperl 2.0 will have the ability to generate Expired/Last-Modified headers and handle if-modified-since requests. The programmer has to provide the time (in seconds) when a document should expires and/or can provide a function, that tells Embperl if a document has expired. Upon this data Embperl generates the headers (as far as possible) and caches the output of the document (or subcomponent). Cacheing is already working in the current alpha realase (2.0a16) and the http header stuff is the next I plan to do. I don't know if this is very usefull for a more general Module, because it's all written in C and uses Embperl's internal DOM storage, but on the other side Embperl 2.0 will not only be able to process his own syntax, but also plain Perl, XML (e.g. XSP), and other custom syntaxes (e.g. SSI and others). Gerald - Original Message - From: "Geoffrey Young" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 15, 2000 4:26 PM Subject: [RFC] Apache::Expires hi all... I was wondering if anyone has some experience with expire headers for dynamic documents - kinda like mod_expires but for dynamic stuff. why? well, say I have a handler that creates, say, a css document on the fly based upon fields in a database. the css contents won't change regularly (if ever) but every request results in dynamic processing. Wouldn't it be nice to be able to cache dynamic results if I say it's ok? (yes, one could just spit out a static document weekly or whatever, but that's not the point of this discussion, ok :) anyone else see an interest in an Apache::Expires (or whatever)? Is there something out there already? I was thinking of working on it if there is nothing out there, but it would require lots of RFC reading and wrestling with stuff like entity tags... comments/experiences welcome... --Geoff - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
return DONE;
Is returning DONE a Bad Thing? thanks, Todd
Re: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
Stas Bekman [EMAIL PROTECTED] writes: Ralf is always talking about SSL stuff, so if you want to do it, why don't you just contact him and sync with him. It's not mod_perl but many of us are using it. So it'd probably be questionable for TPC , but perfect for ApacheCon. Is there a way of doing mod_rewrite maps in perl? -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
RE: [RFC] Apache::Expires
At 11:17 15/11/2000 -0500, Geoffrey Young wrote: easy to get mixed up in the details. I think Andreas wrote something about all those issues last year, but I can't track it down right now. I think he wrote the section in the guide on headers - that will definitely help sort things out... Ah, yes, in a place that obvious I had no chance of finding it ;) say you want to cache a dynamic document for a week from creation - how do you define when the week started? You mean if say, on tuesday a document is generated and says it will expire in a week, if it is rerequested on friday it will still need to say it expires the following tuesday right ? That would require persistence, probably a db or dbm. -- robin b. I don't suffer from insanity. I enjoy every minute of it.
RE: [RFC] Apache::Expires
-Original Message- From: Robin Berjon [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 15, 2000 12:19 PM To: Geoffrey Young Cc: '[EMAIL PROTECTED]' Subject: RE: [RFC] Apache::Expires At 11:17 15/11/2000 -0500, Geoffrey Young wrote: easy to get mixed up in the details. I think Andreas wrote something about all those issues last year, but I can't track it down right now. I think he wrote the section in the guide on headers - that will definitely help sort things out... Ah, yes, in a place that obvious I had no chance of finding it ;) say you want to cache a dynamic document for a week from creation - how do you define when the week started? You mean if say, on tuesday a document is generated and says it will expire in a week, if it is rerequested on friday it will still need to say it expires the following tuesday right ? something like that... for instance, using mod_expires you can specify a one week from modification time for expiration. that's more difficult to do with dynamic stuff since you don't have a start point (the 'document' is modified on every access). I was thinking that to specify a one week expiration date would set the Expires header (or Last-Modified or whatever) to "last monday + one week". documents created on friday only really get 3 days instead of a week, but... similarly for months, years, days, etc... you loose true granularity of control (?) but gain some sort of caching this way. I dunno... That would require persistence, probably a db or dbm. yeah, except that I suspect the overhead of that would be just as bad as the processing to create the document in the first place... --Geoff -- robin b. I don't suffer from insanity. I enjoy every minute of it.
Re: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
On 15 Nov 2000, David Hodgkinson wrote: DH Stas Bekman [EMAIL PROTECTED] writes: DH DH Ralf is always talking about SSL stuff, so if you want to do it, why don't DH you just contact him and sync with him. It's not mod_perl but many of us DH are using it. So it'd probably be questionable for TPC , but perfect for DH ApacheCon. DH DH Is there a way of doing mod_rewrite maps in perl? RewriteMap config option allows you specify external program as source of map information. It can be in perl. Apache documentation for mod_rewrite has an example of such program. -- Ilya Martynov AGAVA Software Company, http://www.agava.com
Re: [RFC] Apache::Expires
At 10:26 AM 11/15/00 -0500, Geoffrey Young wrote: hi all... I was wondering if anyone has some experience with expire headers for dynamic documents - kinda like mod_expires but for dynamic stuff. Geoff, Are you thinking about client/browsers or proxy caching with regard to this? Or does it matter? I currently use Last-modified and Content-length headers in my dynamic content that doesn't change much, but I've never considered using Expires, but maybe it's because I'm not fully up on what help Expires does. I have assumed that most browsers cache my documents and don't re-request them in their current session, so am I correct that Expires would only help for cases of browsers/clients that return to the page sometime in the future yet before the document Expires, and after closing their browser? I wonder how to determine how many requests that would save. Also, if a cached document is past its Expired time, does that force the client to get a new document, or can it still use If-Modified-Since? mod_expires indicates that a new document must be loaded, but RFC 2616 indicates that it can use If-Modified-Since (who know what the clients will do). I should know this too, but what effect does the presence of a query string in the URL have on this? Bill Moseley mailto:[EMAIL PROTECTED]
Re: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
"David" == David Hodgkinson [EMAIL PROTECTED] writes: David Is there a way of doing mod_rewrite maps in perl? Just write a good PerlTransHandler. I do that all the time. I tossed mod_rewrite long ago. Arcane syntax, many special variables, heavily dependent on regular expressions and special operators... how could anything like that ever catch on? {grin} -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
RE: [RFC] Apache::Expires
-Original Message- From: Bill Moseley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 15, 2000 1:12 PM To: Geoffrey Young; '[EMAIL PROTECTED]' Subject: Re: [RFC] Apache::Expires At 10:26 AM 11/15/00 -0500, Geoffrey Young wrote: hi all... I was wondering if anyone has some experience with expire headers for dynamic documents - kinda like mod_expires but for dynamic stuff. Geoff, Are you thinking about client/browsers or proxy caching with regard to this? Or does it matter? I was thinking about client/browser stuff specifically, but I guess properly formed headers apply to both :) I currently use Last-modified and Content-length headers in my dynamic content that doesn't change much, but I've never considered using Expires, but maybe it's because I'm not fully up on what help Expires does. I keep forgetting that Expires is _supposed_ to be a proxy thing - the official MS documentation says that MSIE caches based on Expires, though. (http://support.microsoft.com/support/kb/articles/Q234/0/67.ASP) I dunno about the rest... --Geoff I have assumed that most browsers cache my documents and don't re-request them in their current session so am I correct that Expires would only help for cases of browsers/clients that return to the page sometime in the future yet before the document Expires, and after closing their browser? I wonder how to determine how many requests that would save. Also, if a cached document is past its Expired time, does that force the client to get a new document, or can it still use If-Modified-Since? mod_expires indicates that a new document must be loaded, but RFC 2616 indicates that it can use If-Modified-Since (who know what the clients will do). I should know this too, but what effect does the presence of a query string in the URL have on this? Bill Moseley mailto:[EMAIL PROTECTED]
Microperl
This is probably more of a Friday topic: Simon Cozens discusses "Microperl" in the current The Perl Journal. I don't build mod_rewrite into a mod_perl Apache as I like rewriting with mod_perl much better. But it doesn't make much sense to go that route for a light-weight front-end to heavy mod_perl backend servers, of course. I don't have any experience embedding perl in things like Apache other that typing "perl Makefile.PL make", but Simon's article did make me wonder. So I'm curious from you that understand this stuff better: Could a microperl/miniperl be embedded in Apache and end up with a reasonably light-weight perl enabled Apache? I understand you would not have Dynaloader support, but it might be nice for simple rewriting. Curiously yours, Bill Moseley mailto:[EMAIL PROTECTED]
RE: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
Is there a way of doing mod_rewrite maps in perl? I suspect that there is little, if anything, you can do with mod_rewrite that you can't do with a (sufficiently complex, somewhat magical) PerlTransHandler... Perhaps that would make for a good talk ;) --Geoff
What's the best way to display static HTML?
I'm using modperl for a site I'm developing. The basic structure (framework (header and footer)) is all dynamic and custom built for individual users. There are a series of static HTML documents, though, that need to be incorporated within the dynamic framework. IfI just stick the HTML into the modules and print, won't it make my server processes unnecessarily large (just holding static HTML in memory)?? Just wondering what the best method is to display static HTML within a dynamic framework. Speed and cache are probably important, but frequent dumps of the cache so as not to hold the memory. If anyone has any suggestions, I'd really appreciate it. Thanks! Arthur
coredump on Carps in startup.pl
When I start up apache (apachectl startssl), I get a core dump. Attached is an "strace httpd -X" for those of you who find this useful. I have a rather plain startup.pl file containing these lines: ... $SIG{__DIE__} = \Carp::confess; ... use CGI::Carp (); ... If I take both of these lines out of the file, apache starts just fine and I can get some work done again. Here's what I have - I'm including the mod_ssl stuff because it's in the mix, but I'm not anticipating that this is part of the problem. Mandrake 7.1 apache_1.3.14 libapreq-0.31 mod_perl-1.24_01 mod_ssl-2.7.1-1.3.14 openssl-0.9.5a perl-5.6.0 I'm running a very similar setup w/ apache_1.3.12 and mod_perl 1.24 and I'm not having this problem. I have searched the mailing list archives but haven't found anybody running into a similar problem... any ideas based on the strace output? Thanks people, phil. execve("../bin/httpd", ["../bin/httpd", "-X"], [/* 39 vars */]) = 0 brk(0) = 0x8265bf8 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40013000 open("/etc/ld.so.preload", O_RDONLY)= -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=25482, ...}) = 0 old_mmap(NULL, 25482, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40014000 close(3)= 0 open("/lib/libm.so.6", O_RDONLY)= 3 fstat(3, {st_mode=S_IFREG|0755, st_size=119808, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220F\0"..., 4096) = 4096 old_mmap(NULL, 120984, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001b000 mprotect(0x40038000, 2200, PROT_NONE) = 0 old_mmap(0x40038000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1c000) = 0x40038000 close(3)= 0 open("/lib/libcrypt.so.1", O_RDONLY)= 3 fstat(3, {st_mode=S_IFREG|0755, st_size=19696, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\20\r\0"..., 4096) = 4096 old_mmap(NULL, 182588, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40039000 mprotect(0x4003e000, 162108, PROT_NONE) = 0 old_mmap(0x4003e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x4000) = 0x4003e000 old_mmap(0x4003f000, 158012, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4003f000 close(3)= 0 open("/lib/libdb.so.3", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0755, st_size=259780, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\320?\0"..., 4096) = 4096 old_mmap(NULL, 262748, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x40066000 mprotect(0x400a5000, 4700, PROT_NONE) = 0 old_mmap(0x400a5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x3e000) = 0x400a5000 close(3)= 0 open("/lib/libnsl.so.1", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0755, st_size=79920, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\0"..., 4096) = 4096 old_mmap(NULL, 92136, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400a7000 mprotect(0x400ba000, 14312, PROT_NONE) = 0 old_mmap(0x400ba000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x12000) = 0x400ba000 old_mmap(0x400bc000, 6120, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400bc000 close(3)= 0 open("/lib/libdl.so.2", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0755, st_size=9368, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\300\34"..., 4096) = 4096 old_mmap(NULL, 12392, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400be000 mprotect(0x400c, 4200, PROT_NONE) = 0 old_mmap(0x400c, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1000) = 0x400c close(3)= 0 open("/lib/libc.so.6", O_RDONLY)= 3 fstat(3, {st_mode=S_IFREG|0755, st_size=931348, ...}) = 0 read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0x\215\1"..., 4096) = 4096 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x400c2000 old_mmap(NULL, 945852, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x400c3000 mprotect(0x401a2000, 32444, PROT_NONE) = 0 old_mmap(0x401a2000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xde000) = 0x401a2000 old_mmap(0x401a7000, 11964, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x401a7000 close(3)= 0 munmap(0x40014000, 25482) = 0 getpid()= 25084 brk(0) = 0x8265bf8 brk(0x8267c18) = 0x8267c18 brk(0x8268000) = 0x8268000 brk(0x826b000) = 0x826b000 brk(0x826e000) = 0x826e000 brk(0x8271000) = 0x8271000 brk(0x8273000)
Re: What's the best way to display static HTML?
"AMK" == Arthur M Kang [EMAIL PROTECTED] writes: AMK I'm using modperl for a site I'm developing. The basic structure (framework AMK (header and footer)) is all dynamic and custom built for individual users. AMK There are a series of static HTML documents, though, that need to be Is there something wrong with just linking them to the static html page?
Re: Chaining Perl and C handlers
Ged, Thanks for the input-- here are my answers below... The new parameter (which in the example was moe and not joe, my mistake) will be a "webid", a unique identifier for each website that is parsed out of the physical location of the file. For example, www.joe-honda-dealer.com/inventory.jsp corresponds to something like: /web/active/honda/joedeal/html/inventory.jsp where joedeal is the webid. Instead of having a bunch of identical inventory pages, however, we're just going to have one JSP on the Weblogic server that accepts a webid parameter which is responsible for how the page gets built. Let me know if you need further clarification on this. My main issue is that I don't know how to add parameters to the POST and GET data. Again, thanks for the help!! Andrew Chen Software Engineer, Architecture [EMAIL PROTECTED] 206-219-8445 The Cobalt Group, Inc. (www.cobaltgroup.com) 2200 First Avenue South Seattle, WA 98134 On Wed, 15 Nov 2000, G.W. Haywood wrote: Hi there, On Tue, 14 Nov 2000, Andrew Chen wrote: 1. Request comes in for t.jsp?test=1joe=2 2. Handler steps in and adds another parameter, t.jsp?test=1joe=2moe=3 3. Request is then handled by BEA-Apache bridge so that it is forwarded to Weblogic 4. JSP runs on Weblogic, and the new parameter (joe) moe? can be referenced in the JSP. I'm not familiar with this bridge, but I don't see why this needs to be complicated. What determines the new parameter? After the handler adds the new parameter, could you get it to make another request which then gets caught by mod_rewrite and/or mod_proxy for example? 73, Ged.
Fixed: coredumps caused by Carp in startup.pl
We ought to have a name for the phenomenon caused by brilliant flashes of ingenuity caused when a person asks easily answered questions on mailing lists. The problem was that I didn't have Tie::IxHash installed, but now that it's been added, I'm fine again. Thanks again, phil.
Re: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
[EMAIL PROTECTED] (Randal L. Schwartz) writes: "David" == David Hodgkinson [EMAIL PROTECTED] writes: David Is there a way of doing mod_rewrite maps in perl? Just write a good PerlTransHandler. I do that all the time. I tossed mod_rewrite long ago. Arcane syntax, many special variables, heavily dependent on regular expressions and special operators... how could anything like that ever catch on? {grin} Excse me... Ok, so where's the mod_rewrite2PerlTransHandler.pl? ;-) -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
Replacing mod_prewrite with a PerlTransHandler Was: Re: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
Geoffrey Young [EMAIL PROTECTED] writes: Perhaps that would make for a good talk ;) mod_rewrite recovery? Ok seriously then, we're proposing replacing a lite apache and mod_rewrite with a slightly heavier, but presumably highly shared mod_perled apache at the front end. Measurements anyone? -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
Re: [RFC] Apache::Expires
Geoffrey Young [EMAIL PROTECTED] writes: hi all... I was wondering if anyone has some experience with expire headers for dynamic documents - kinda like mod_expires but for dynamic stuff. Andy Wardley has already clued me in, in two entirely different ways, on doing something very similar with the Template Toolkit - I have modtimes in files I'm templating or records pulled from a database... why? well, say I have a handler that creates, say, a css document on the fly based upon fields in a database. the css contents won't change regularly (if ever) but every request results in dynamic processing. Wouldn't it be nice to be able to cache dynamic results if I say it's ok? (yes, one could just spit out a static document weekly or whatever, but that's not the point of this discussion, ok :) Again, that's the TT way :-) -- Dave Hodgkinson, http://www.hodgkinson.org Editor-in-chief, The Highway Star http://www.deep-purple.com Apache, mod_perl, MySQL, Sybase hired gun for, well, hire -
RE: What's the best way to display static HTML?
"AMK" == Arthur M Kang [EMAIL PROTECTED] writes: AMK The framework is all dynamic content with dynamic links for each user. Apache::Include should be useful then. Just Apache::Include-virtual('/path/to/file.html'); -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Vivek Khera, Ph.D.Khera Communications, Inc. Internet: [EMAIL PROTECTED] Rockville, MD +1-240-453-8497 AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/
ProxyPass logging and can I ProxyPass a filetype instead of a directory?
Hey peoples, Two questions: 1) How can I make sure that the target of my ProxyPass directive is actually serving up the pages? I'm not seeing any logging and saw online that I wouldn't normally. I know it sounds silly, but I have a really weird environment and am doing some testing and need to know if I can get the target server to log something. 2) ProxyPass is very cool for directory stuff. Is there a way to make it work for a filetype? For instance *.epl - http://somewhere.com/somedir Thanks in advance, Kevin Riggins dice.com email: [EMAIL PROTECTED] email: [EMAIL PROTECTED] phone: (515) 313-2127
Re:coredump on Carps in startup.pl
PJ When I start up apache (apachectl startssl), I get a core dump. PJ Attached is an "strace httpd -X" for those of you who find this useful. FWIW, I have the same issue also. I noticed it when using CGI::Carp. My solution was not "use" CGI::Carp; in startup.pl (a real lame solution, I know ;-), but my goal was to deal with it later (I needed to get my development environment back on-line) PJ Mandrake 7.1 PJ apache_1.3.14 PJ perl-5.6.0 I notice this started when I moved to Mandrake 7.1 from Redhat 6.2, but since I threw perl-5.6.0 into the mix at the same time, it may be a combination of the above. My code ran fine under RH 6.2, apache_1.3.14, and perl-5.005_03. I know this was no real help, but at least you are not alone ... Best Regards, Mike Miller [EMAIL PROTECTED]
Re: ProxyPass logging and can I ProxyPass a filetype instead of adir ectory?
On Wed, 15 Nov 2000 [EMAIL PROTECTED] wrote: 1) How can I make sure that the target of my ProxyPass directive is actually serving up the pages? I'm not seeing any logging and saw online that I wouldn't normally. I know it sounds silly, but I have a really weird environment and am doing some testing and need to know if I can get the target server to log something. I've no idea what you mean. 2) ProxyPass is very cool for directory stuff. Is there a way to make it work for a filetype? For instance *.epl - http://somewhere.com/somedir something like RewriteEngine on RewriteRule ^/(.*epl$) http://somewhere.com/$1 [P] - ask -- ask bjoern hansen - http://www.netcetera.dk/~ask/ more than 70M impressions per day, http://valueclick.com
Apache::Sandwich and CGI scripts
Hello, I'm attempting to incorporate Apache::Sandwich into a site I'm working on and I'm having some problems getting sandwich to work with cgi scripts. What is happening is that it will insert the header just fine, print the output, but it doesn't finish the final step which should insert the footer. And I've gone back and tried the hello world example in the documentation and get the same results. I've turned on debugging, and here's what shows up in the errorlog: inserting /mod_perl/cgi_wrapper.pl GET Use of uninitialized value in split at /usr/local/lib/perl5/site_perl/5.6.0/Apache/Sandwich.pm line 83. My httpd.conf has for following settings for the cgi-bin: Directory "/www/vhosts/localhost/cgi-bin" SetHandler perl-script PerlHandler Apache::Registry AllowOverride None Options +ExecCGI Order allow,deny Allow from all PerlSetVar HEADER "/mod_perl/cgi_wrapper.pl" PerlSetVar FOOTER "/wrapper/footer.html" /Directory It's currently running on RH6.2, apache1.3.14, mod_perl 1.24_01, Apache::Sandwich 2.04. If you have any insight as to what I'm doing wrong, I'd greatly appreciate knowing. Thanks, Jonny
[BUG]? problems with headers, mod_filter and mod_perl-1.24_01
Hello, I had troubles with a specific mod_perl + mod_filter config. With this conf everything was ok at home for my tests; but headers broke on the production server (In fact a test server for dev team). Eventually, I identified that troubles come from mod_perl-1.24_01 (I guess...). So, I reinstalled mod_perl-1.24 on this server, and everything seems to be ok for now. Here is two outputs (home and prod server), the conf is for both : - PerlSendHeader Off - FilterHeader On (for mod_filter) The request is on an Apache::Registry script (named script.cgi) redirecting on a php script (named script.phtml), setting the cookie in the meantime. |- HOME -- mod_perl-1.24 [pop@endymion:~]$ telnet vh.test.com 8000 Trying 127.0.0.1... Connected to vh.test.com. Escape character is '^]'. GET /script.cgi?url=script.phtmltype=COOKIEPRODBlogin=totopassword=foobar HTTP/1.1 Host: vh.test.com HTTP/1.1 302 Found Date: Mon, 13 Nov 2000 02:39:20 GMT Server: Apache/1.3.12 (Unix) mod_filter/1.1 PHP/4.0.2 mod_perl/1.24 Set-Cookie: COOKIEPRODB=Cookiesdh45g5v7d8ca951Ref2110; domain=.test.com; path=/; expires=Mon, 13-Nov-2000 05:26:07 GMT location: script.phtml Connection: close Content-Type: text/html; charset=ISO-8859-1 HTTP/1.1 302 Found Date: Mon, 13 Nov 2000 02:39:20 GMT Server: Apache/1.3.12 (Unix) mod_filter/1.1 PHP/4.0.2 mod_perl/1.24 Set-Cookie: COOKIEPRODB=Cookiesdh45g5v7d8ca951Ref2110; domain=.test.com; path=/; expires=Mon, 13-Nov-2000 05:26:07 GMT Set-Cookie: COOKIEPRODB=Cookiesdh45g5v7d8ca951Ref2110; domain=.test.com; path=/; expires=Mon, 13-Nov-2000 05:26:07 GMT Set-Cookie: COOKIEPRODB=Cookiesdh45g5v7d8ca951Ref2110; domain=.test.com; path=/; expires=Mon, 13-Nov-2000 05:26:07 GMT location: script.phtml Connection: close Content-Type: text/html; charset=ISO-8859-1 |- PROD --- mod_perl-1.24_01 [pop@endymion:~]$ telnet vh.prodserver.net 8000 Trying xx.xx.xx.xx... Connected to vh.prodserver.net. Escape character is '^]'. GET /script.cgi?url=script.phtmltype=COOKIEPRODBlogin=totopassword=foobar HTTP/1.1 Host: vh.test.net HTTP/1.1 302 Found Date: Mon, 13 Nov 2000 00:39:26 GMT Server: Apache/1.3.14 (Unix) mod_filter/1.1 PHP/4.0.3pl1 mod_perl/1.24_01 Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 12f !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN" HTMLHEAD TITLE302 Found/TITLE /HEADBODY H1Found/H1 The document has moved A HREF=""here/A.P HR ADDRESSApache/1.3.14 Server at A HREF="mailto:web2master@server"vh.prodserver.net/A Port 8000/ADDRESS /BODY/HTML 0 [ HELD during few seconds !] |-- END I didn't manage to go further because of my newbie-ness in this domain :( If it's a feature, then please tell me were I'm wrong. Regards, Yann Kerhervé
AuthCookie solution
Works perfectly. Excellent idea. Thank you very much Bill! # added args to login.pl so we can redirect URL's with arguments during initial authentication. my $args = $r-prev-args; # add the ? $args = "?".$args if $args; # put this in the form next to $uri. INPUT TYPE=hidden NAME=args VALUE="$args" # We added the line below to AuthCookie.pm # original way. #$r-header_out("Location" = $args{'destination'}); # this works, but is sloppy. #$r-header_out("Location" = $ENV{HTTP_REFERER}); # best way. $r-header_out("Location" = $args{'destination'}.$args{'args'}); -Original Message- From: Bill Moseley [mailto:[EMAIL PROTECTED]] Sent: Friday, November 03, 2000 5:30 PM To: Charles Day; '[EMAIL PROTECTED]' Subject: Re: AuthCookie At 03:30 PM 11/03/00 -0500, Charles Day wrote: The follow also holds true: http://www.mydomain.com/index.cgi?a=blablablab=blablabla gets redirected to: http://www.mydomain.com/index.cgi If I remember, that's just due to the example in the AuthCookie POD that uses $r-prev-uri to set the destination parameter in the Login script. uri() doesn't include the query string, IIRC. I've replaced the following line in AuthCookie.pm $r-header_out("Location" = "$args{'destination'}"); with: $r-header_out("Location" = "$ENV{HTTP_REFERER}"); I wouldn't do that as it's client dependent (and in quotes ;). And we don't loose the data. Is there a better mod_perlish way to do this and are there buffer overflow risks involved? Use a mod_perl handler or Apache::Registry script for the login script, and include $r-prev-args. There's probably better ways to get the full URL, but I just put uri() and args() together. I suppose if your login.pl script could just place the current fields passed in on the POST to the destination parameter passed to AuthCookie. Then your script would get the parameters, they would just be a GET instead of a POST. Can be kind of ugly. Bill Moseley mailto:[EMAIL PROTECTED]
Subject Matter Expert- Web Performance Reliability
Good Afternoon: I am seeking an expert in the field of Web Performance and Reliability. The responsibilities include having subject matter expertise in performance and web assessment. This is to help an emerging product company focusing on back-end infrastructure of the web. Our goal is to provide a full assessment of a company's web infrastructure across seven different attributes: security, performance, reliability, scalability, manageability, flexibility and long term viability. While other companies in this space are primarily niche players, we provide an end to end web assessment tool. Headquartered in Wakefield, MA, we will be expanding to the seacoast of NH (Portsmouth) after the first of the year. Currently we are still in stealth mode while we are completing our initial product development and develop a formal marketing campaign. This person would own the metrics around performance and reliability and serve in multiple roles (Client assessment, product development, customer delivery, etc). I am not sure if anyone on this list would know of interested parties, but please feel free to contact me or pass this info along. I appreciate the time. Best, Stephen L. Coco Emerging Markets Associate Darwin Partners 100 Quannapowitt Parkway Wakefield, MA 01880 Office 800-274-1174 x7842 Direct781-213-7842 Mobile 617-233-9900 Email [EMAIL PROTECTED] Web www.darwinpartners.com
Re: AuthCookie solution
At 04:19 PM 11/15/00 -0500, Charles Day wrote: # We added the line below to AuthCookie.pm $r-header_out("Location" = $args{'destination'}.$args{'args'}); Why pass a new argument? Can't you just add the query string onto the destination field in your login.pl script? Something like the untested: my $uri = $r-prev-uri; my $query = $r-prev-args; $uri = "$uri?$query" if $query; print qq[INPUT TYPE=hidden NAME=destination VALUE="$uri"]; Bill Moseley mailto:[EMAIL PROTECTED]
Newbie install help needed please
Hello, I recently installed Redhat 7, which includes/installs Apache and mod_perl. I assumed mod_perl was installed and running successfully based on the http error log (Mon Nov 13 15:37:16 2000] [notice] Apache/1.3.12 (Unix) (Red Hat/Linux) mod_ssl/2.6.6 OpenSSL/0.9.5a DAV/1.0.1 mod_perl/1.24 configured -- resuming normal operations), but when I do a httpd -l apparently its not: Compiled-in modules: http_core.c mod_so.c suexec: disabled; invalid wrapper /usr/sbin/suexec So I decided to download the tarball and [re]install mod_perl... but without the Apache source it is not happening. If anyone has any advice/urls/pointers to FAQ's to get mod_perl up and running in this situation it would be greatly appreciated! TIA! -Jim
Re: Newbie install help needed please
James, It is installed, actually. What you're seeing is a build of Apache where pretty much everything is installed as a DSO. This makes it possible for Redhat to ship things like mod_php4 as RPMs so you can just install them piecemeal. If you look in APACHE/libexec/, you'll find all the other modules you're looking for. What you need to do in your httpd.conf file is LoadModule [ module name ], but since you're seeing mod_perl in the server headers, it's probably already done. I would advise you to learn how to build all this from source. It's not terribly difficult and Stas's mod_perl guide at perl.apache.org/guide is a great resource. Also, the software comes with instructions. phil. James Hall wrote: Hello, I recently installed Redhat 7, which includes/installs Apache and mod_perl. I assumed mod_perl was installed and running successfully based on the http error log (Mon Nov 13 15:37:16 2000] [notice] Apache/1.3.12 (Unix) (Red Hat/Linux) mod_ssl/2.6.6 OpenSSL/0.9.5a DAV/1.0.1 mod_perl/1.24 configured -- resuming normal operations), but when I do a httpd -l apparently its not: Compiled-in modules: http_core.c mod_so.c suexec: disabled; invalid wrapper /usr/sbin/suexec So I decided to download the tarball and [re]install mod_perl... but without the Apache source it is not happening. If anyone has any advice/urls/pointers to FAQ's to get mod_perl up and running in this situation it would be greatly appreciated! TIA! -Jim
RE: PerlAuth DB configuration.
I end of with 4 DB connections for each web server thread (2 for Authen and 2 for Authz). After a short time of inaction (about 30 secs), the web server makes a new child, and the 4 DB connections just sit there. Useless. And 4 more are created for the new thread. Now this is starting to look a little inefficient, and I was wondering if anyone who has any experience with this kind of problem could give me a few pointers; some different (better) ideas on how to solve the problem. I had a very similar problem using database authentication, a very useful reply I received mentioned extra arguments for the ( not terribly well documented ) DBI-connect call DBI-connect('dbi:mysql:dbname=db','user','pass', {attr=value}, undef, 'connect'); This menas that for your authentication connections, Apache::DBI::connect is not used as the connect method, but the "vanilla" connect is. So you will not have the (4) connections lying around after their use... I am assumimg that it is ok to fiddle with setup of the PerlAuth module to make these changes... Finally this will not help you at all with the elapsed time issues surrounding the need for 4 connections ... but good luck Mark
RE: Newbie install help needed please
Phil, Thank you very much for your quick response! The reason I assumed mod_perl wasn't installed was because of a post I found searching the mail list archive. When I try to start/stop httpd manually I receive the following error: Syntax error on Line 896 of /etc/httpd/conf/httpd.conf: Invalid command 'PerlRequire' , perhaps misspelled or defined by a module not included in server configuration. I noticed someone else with the same problem, and the replies pointed to the fact that mod_perl was not installed. So I guess I can eliminate a bad install as part of the problem... but that's leaves me back at square one. I'm going to continue to hunt through the mail list archives and FAQ's for a solution... but if anyone can think of anything in the meantime, I would love to hear it! Thanks again!! -Jim -Original Message- From: Philip Jacob [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 15, 2000 4:25 PM To: James Hall Cc: [EMAIL PROTECTED] Subject: Re: Newbie install help needed please James, It is installed, actually. What you're seeing is a build of Apache where pretty much everything is installed as a DSO. This makes it possible for Redhat to ship things like mod_php4 as RPMs so you can just install them piecemeal. If you look in APACHE/libexec/, you'll find all the other modules you're looking for. What you need to do in your httpd.conf file is LoadModule [ module name ], but since you're seeing mod_perl in the server headers, it's probably already done. I would advise you to learn how to build all this from source. It's not terribly difficult and Stas's mod_perl guide at perl.apache.org/guide is a great resource. Also, the software comes with instructions. phil. James Hall wrote: Hello, I recently installed Redhat 7, which includes/installs Apache and mod_perl. I assumed mod_perl was installed and running successfully based on the http error log (Mon Nov 13 15:37:16 2000] [notice] Apache/1.3.12 (Unix) (Red Hat/Linux) mod_ssl/2.6.6 OpenSSL/0.9.5a DAV/1.0.1 mod_perl/1.24 configured -- resuming normal operations), but when I do a httpd -l apparently its not: Compiled-in modules: http_core.c mod_so.c suexec: disabled; invalid wrapper /usr/sbin/suexec So I decided to download the tarball and [re]install mod_perl... but without the Apache source it is not happening. If anyone has any advice/urls/pointers to FAQ's to get mod_perl up and running in this situation it would be greatly appreciated! TIA! -Jim
Re: Chaining Perl and C handlers
On Wed, 15 Nov 2000, Andrew Chen wrote: The new parameter (which in the example was moe and not joe, my mistake) will be a "webid", a unique identifier for each website that is parsed out of the physical location of the file. For example, www.joe-honda-dealer.com/inventory.jsp corresponds to something like: /web/active/honda/joedeal/html/inventory.jsp where joedeal is the webid. Instead of having a bunch of identical inventory pages, however, we're just going to have one JSP on the Weblogic server that accepts a webid parameter which is responsible for how the page gets built. Let me know if you need further clarification on this. My main issue is that I don't know how to add parameters to the POST and GET data. The "GET data" is just the URI requested. You can mess with that easilly. POST data is slightly trickier but should also be possible through the Apache API. If that's all you want do, don't bother using mod_perl for it. It sounds like you could maybe do it with mod_rewrite or a tiny custome TransHandler written in C. No need to use all that memory loading Perl just for this. - Perrin
Re: [RFC] Apache::Expires
On Wed, 15 Nov 2000, Geoffrey Young wrote: I was wondering if anyone has some experience with expire headers for dynamic documents - kinda like mod_expires but for dynamic stuff. We do this, and let mod_proxy use our headers to control its cache and handle If-Modified requests. anyone else see an interest in an Apache::Expires (or whatever)? Is there something out there already? I was thinking of working on it if there is nothing out there, but it would require lots of RFC reading and wrestling with stuff like entity tags... Um, it's pretty easy: my $last_mod = time; my $expires = time + 360; # expires in one hour $r-header_out('Expires' = Apache::Util::ht_time($expires)); $r-header_out('Last-Modified' = Apache::Util::ht_time($last_modified)); Or did you have something different in mind? - Perrin
Re: Apache::AuthenDBI NOTICE message
So far, using Apache::AuthenDBI, I get an error_log message: NOTICE: Unrecognized variable client_encoding Every time the DBI ping is called. I have not been able to tack down the origin of this message. Any ideas or suggestions? never seen before. What database do you use ? I am using PostgreSQL 7.0.2 More details. . . I am also using the latest Apache::AuthenDBI and Apache::AuthzDBI. In startup.pl I have: Apache::DBI-connect_on_init("dbi:Pg:dbname=atable", "webuser", "webuser", { PrintError = 1, # warn() on errors RaiseError = 0, # don't die on error AutoCommit = 1 # commit executes immediately } ); # I did try seting PrintError=0 with no change on the NOTICE message. Note: I am not using any of the following (in startup.pl): Apache::DBI-setPingTimeOut("dbi:driver:database", $timeout); Apache::AuthDBI-setCacheTime(0); Apache::AuthDBI-setCleanupTime(-1); Apache::AuthDBI-initIPC(5); When I start httpd I get the following error log output. == [Wed Nov 15 17:47:48 2000] [info] created shared memory segment #12928 [Wed Nov 15 17:47:48 2000] [notice] Apache/1.3.14 (Unix) mod_perl/1.24_01 mod_layout/2.8 configured -- resuming normal operations [Wed Nov 15 17:47:48 2000] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec) [Wed Nov 15 17:47:48 2000] [info] Server built: Nov 5 2000 10:26:07 12052 Apache::DBI PerlChildInitHandler 12051 Apache::DBI PerlChildInitHandler 12053 Apache::DBI PerlChildInitHandler NOTICE: Unrecognized variable client_encoding Database handle destroyed without explicit disconnect at /usr/local/lib/perl5/5.6.0/site_perl/Apache/DBI.pm line 140. require 0 called at /usr/local/lib/perl5/5.6.0/site_perl/Apache/DBI.pm line 140 Apache::DBI::childinit('Apache=SCALAR(0x874565c)') called at /dev/null line 0 require 0 called at /dev/null line 0 12054 Apache::DBI PerlChildInitHandler NOTICE: Unrecognized variable client_encoding Database handle destroyed without explicit disconnect at /usr/local/lib/perl5/5.6.0/site_perl/Apache/DBI.pm line 140. require 0 called at /usr/local/lib/perl5/5.6.0/site_perl/Apache/DBI.pm line 140 Apache::DBI::childinit('Apache=SCALAR(0x874565c)') called at /dev/null line 0 require 0 called at /dev/null line 0 12055 Apache::DBI PerlChildInitHandler 12056 Apache::DBI PerlChildInitHandler = The NOTICE and etc messages are repeated several (12) times for the 6 Apache children and the 1 Apache root processes running (i.e. 2 NOTICE messages per child). The Apache::DBI.pm is version 0.87 and near line 140 I see: sub childinit { my $prefix = "$$ Apache::DBI"; print STDERR "$prefix PerlChildInitHandler \n" if $Apache::DBI::DEBUG 1; #if (defined @ChildConnect) { if (@ChildConnect) { for my $aref (@ChildConnect) { shift @$aref; DBI-connect(@$aref); $LastPingTime{@$aref[0]} = time; } } 1; } Note that I changed the "if(defined @ChildConnect" line because, "defined on aggregates (hashes and arrays) is deprecated." Line 140 is: $LastPingTime{@$aref[0]} = time;
Re: Microperl
- Original Message - From: "Bill Moseley" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 15, 2000 12:30 PM Subject: Microperl I don't build mod_rewrite into a mod_perl Apache as I like rewriting with mod_perl much better. But it doesn't make much sense to go that route for a light-weight front-end to heavy mod_perl backend servers, of course. Just curious: what don't you like about mod_rewrite? Les Mikesell [EMAIL PROTECTED]
Re: Microperl
At 07:38 PM 11/15/00 -0600, Les Mikesell wrote: - Original Message - From: "Bill Moseley" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 15, 2000 12:30 PM Subject: Microperl I don't build mod_rewrite into a mod_perl Apache as I like rewriting with mod_perl much better. But it doesn't make much sense to go that route for a light-weight front-end to heavy mod_perl backend servers, of course. Just curious: what don't you like about mod_rewrite? You ask that on the mod_perl list? ;) It's not perl, of course. I like those perl sections a lot. Oh, there were the weird segfaults that I had for months and months. http://www.geocrawler.com/archives/3/182/2000/10/0/4480696/ Nothing against mod_rewrite -- I was just wondering if a small perl could be embedded with out bloating the server too much. Bill Moseley mailto:[EMAIL PROTECTED]
Re: Problem with single quote ' character
Hi Rodney, thanks very much for your reply. I'm trying it now, but I'm doing something wrong. Here's what I have, could you take a look at it? #parse query string and enter into database if query string exists my $authors = $query{'authors'}; my $title = $query{'title'}; my $year = $query{'year'}; my $source = $query{'source'}; my $topic = $query{'topic'}; my $purpose = $query{'purpose'}; my $sample = $query{'sample'}; my $gmc = $query{'gmc'}; my $process = $query{'process'}; my $outcome = $query{'outcome'}; my $rater = $query{'rater'}; my $results = $query{'results'}; my $refs = $query{'refs'}; my $notes = $query{'notes'}; my $therapy = $query{'therapy'}; my $analysis = $query{'analysis'}; my $critique = $query{'critique'}; my $getcopy = $query{'getcopy'}; my $id = $query{'id'}; #make sure all single quotes are escaped $q_authors = $dbh-quote($authors); $q_title = $dbh-quote($title); $q_year = $dbh-quote($year); $q_source = $dbh-quote($source); $q_topic = $dbh-quote($topic); $q_purpose = $dbh-quote($purpose); $q_sample = $dbh-quote($sample); $q_gmc = $dbh-quote($gmc); $q_process = $dbh-quote($process); $q_outcome = $dbh-quote($outcome); $q_rater = $dbh-quote($rater); $q_results = $dbh-quote($results); $q_refs = $dbh-quote($refs); $q_notes = $dbh-quote($notes); $q_therapy = $dbh-quote($therapy); $q_analysis = $dbh-quote($analysis); $q_critique = $dbh-quote($critique); $q_getcopy = $dbh-quote($getcopy); #update entry form into the database $sth = $dbh-prepare( "UPDATE tbl_sarah SET authors = '$authors', title = '$title', year = '$year', source = '$source', topic = '$topic', purpose = '$purpose', sample = '$sample', gmc = '$gmc', process = '$process', outcome = '$outcome', rater = '$rater', results = '$results', refs = '$refs', notes = '$notes', therapy = '$therapy', analysis = '$analysis', critique = '$critique', getcopy = '$getcopy' WHERE id = '$id'" ); $sth-execute(); --I've put single quotes and also tried no quotes around the variables in the SQL statement; neither worked. The solution is simple, put the bind variables in the '$sth-execute' and it will automagically be quoted like so: $sth = $dbh-prepapre("UPDATE tbl_sarah SET authors = ?, title = ? WHERE id = ?"); $sth-execute($authors, $title, $id); use one variable per placeholder '?'. no need to use single quotes in the SQL statement. for more info read the DBI documentation. you wouldn't need all those '$q_var = $dbh-quote($var)' lines in the top too. Thanks again, Omri Mike
Re: AuthCookie solution
At 04:19 PM 11/15/00 -0500, Charles Day wrote: # We added the line below to AuthCookie.pm $r-header_out("Location" = $args{'destination'}.$args{'args'}); Why pass a new argument? Can't you just add the query string onto the destination field in your login.pl script? Something like the untested: my $uri = $r-prev-uri; my $query = $r-prev-args; $uri = "$uri?$query" if $query; a little off the subject, but close. it the pointer for login is a complete URL ie http://foo.com/login.pl then the $r-prev-args; seem to get lost. There is real application for this sort of thing and I would like to figure out how to make it work. Any ideas why it does not? Michael [EMAIL PROTECTED]
Re: Microperl
- Original Message - From: "Bill Moseley" [EMAIL PROTECTED] To: "Les Mikesell" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, November 15, 2000 8:04 PM Subject: Re: Microperl I don't build mod_rewrite into a mod_perl Apache as I like rewriting with mod_perl much better. But it doesn't make much sense to go that route for a light-weight front-end to heavy mod_perl backend servers, of course. Just curious: what don't you like about mod_rewrite? You ask that on the mod_perl list? ;) It's not perl, of course. Yes, if it weren't for a lightweight httpd with mod_rewrite able to selectively proxy to several machines my mod_perl servers would have melted long ago. I like those perl sections a lot. Oh, there were the weird segfaults that I had for months and months. http://www.geocrawler.com/archives/3/182/2000/10/0/4480696/ I usually force a proxy with [p], or immediate local action with [L] instead of falling through. I don't know if that would have avoided your problem or not. Nothing against mod_rewrite -- I was just wondering if a small perl could be embedded with out bloating the server too much. I don't think 'small' and 'perl' belong in the same sentence... Les Mikesell [EMAIL PROTECTED]
mod_proxy caching documentation
Hi, After struggling with trying to figure out mod_proxy's caching algorithm and noting from the list archive's that others had, too -- and due to the dearth of existing documentation on the subject -- I came up with some documentation below by sifting through the source code. Most of it isn't explicitly mod_perl-related, but I hope those trying to set it up will find it useful. Included at the end is a Perl script to determine the filename that mod_proxy uses to cache files, which is helpful in manually cleaning up the cache. If anyone has comments or suggestions, please let me know. Thanks, Dan Setting up Apache with mod_proxy to cache content from a mod_perl server The documentation for mod_proxy can be found at http://httpd.apache.org/docs/mod/mod_proxy.html. Unfortunately, aside from the configuration parameters, not much detail is provided on how to set up mod_proxy to cache pages from a downstream server. This explanation hopes to fill that void. Most of its content was derived by going through the mod_proxy.c, proxy_cache.c, and proxy_util.c source files and comments in the src/modules/proxy directory of the Apache 1.3.12 distribution. * The Short Story In short, mod_proxy will cache all requests that contain a Last-Modified header and an Expires header. You can insert this into your mod_perl scripts with something like this: use Apache::File (); use HTTP::Date; $r-set_last_modified((stat $r-finfo)[9]); # see Eagle book p. 493 for explanation $r-header_out('Expires', HTTP::Date::time2str(time + 24*60*60)); # expires in one day The page will live in the cache until the current time passes the time defined by the Expires header or the time since the file was cached exceeds the CacheMaxExpire parameter as set in the server config file. * The Long Story To understand how the caching proxy server works, let's trace the flow of two simple HTTP exchanges for the same file, from the browser request to the returned page. - The browser makes a request to the proxy server like this: GET /index.html HTTP/1.0 - The proxy server takes the URL and converts it to a filename on your filesystem. This filename has no resemblance to the actual URL. Instead, it is an MD5 hash of the fully qualified URL (e.g. http://www.myserver.com:80/mypage.html) to the document and is broken up in a number of directory levels, as defined by the CacheDirLevels parameter in the config file. (WHY DOES IT MATTER HOW MANY DIR LEVELS ARE IN THE CACHE?) Each of these directories will have a certain number of characters in its name, as defined by the CacheDirLength parameter in the config file. The directories will live under CacheRoot, also defined in the config file. For example, /index.html might be converted to /proxy_cache/m/EYRopVKBHMrHd2VF6WXOQ (with CacheDirLevels and CacheDirLength set to 1 and CacheRoot set to /proxy_cache). - For this example, we'll assume that at this point the cached file does not exist. The proxy server then consequently forwards the request to the mod_perl server and gets a response back. The response will then be cached UNLESS any of the following conditions are true (ap_proxy_cache_update): - The HTTP status returned by the mod_perl server is not one of OK, HTTP_MOVED_PERMANENTLY, or HTTP_NOT_MODIFIED - The response does not contain an Expires header - The response contains an Expires header that Apache can't parse - The HTTP status is OK but there's not a Last-Modified header - The mod_perl server sent only an HTTP header - The mod_perl server sent an Authorization field in the header (Furthermore, if any of the above conditions are met, any existing cached file will be deleted.) - If the server decides to cache the file, it will store the file exactly as it was received from the mod_perl server, with the addition of a one-line header at the start of the file. This header contains the following information in the following format: current time last modified time expiration time "version" content length All times are stored as hex seconds since 1970 and are taken from the HTTP header sent by the mod_perl server. If the current time cannot be parsed from this header, the proxy server determines the current time itself and uses that; if the Last Modified time cannot be parsed, it is set to the Last Modified time of the existing cached file, if it exists; if the Last Modified time is in the future, it is set to the current time as determined previously; if the Expires time cannot be parsed and a Last Modified time exists from the previous step, then the Expires time is set to "now + min((date - lastmod) * factor, maxexpire)" (as noted in the source code comments) where factor and maxexpire are the CacheLastModifiedFactor and CacheMaxExpire parameters in the config file; if the Expires time cannot be parsed and there is no Last Modified time, then the Expires time is set to "now + defaultexpire", where
Re: Microperl
On Thu, 16 Nov 2000, Robin Berjon wrote: I know what you mean but this is MicroPerl, not Perl. I don't know how much difference it makes, but it's certainly smaller. I'm afraid I can't help with embedding it though. I like the idea, not just for rewrites (I'm quite happy with mod_rewrite most of the time) but for all the conf stuff. It doesn't have dynaloader, but you could still do things like read conf from a flat file db or that sort of thing. Hacking down the size of the code is good, but now when it comes down to hacking down features, and features must go if you are to shrink perl. Ok so the fullsize language is a ~350 K addon to apache, for that we get all the good stuff like superoptimising compiler, that is very smart about figuring out 'smart' code. If you really want to go that way, PHP4 probably one of the better shots you have. Besides PHP was vowed to be an improved language over the perl for the web development, and to degree it is if you just want to hack together a small database enabled comments book. However me knowing perl is advantage over PHP, because horsepower is cheap, disk troughput will always faster than that of a network speed, modularity and superflexibility of the perl will always will be irreplacable. MicroPerl is akin to what PHP zealots used to tout PHP as, and yes perl can be awkward to read at times, but thats why it is good, there is breathing space wasted to let coder's brain sort of relax, like long function calls for invoking Regular Expressions on the string vs =~. PHP in some ways is faster than perl, but hey, I do not compare Saleen Mustang to a Lamborgini Diablo. Hope you will make the right choice for yourself, not us ;-) Pavel
ANNOUNCE: HTML-Embperl 1.3b7 (pre 1.3)
The URL ftp://ftp.dev.ecos.de/pub/perl/embperl/HTML-Embperl-1.3b7.tar.gz has entered CPAN as file: $CPAN/authors/id/G/GR/GRICHTER/HTML-Embperl-1.3b7.tar.gz size: 306074 bytes md5: 257487aa3fd8343b130930a58dd97a65 Embperl is a module for embedding Perl code in HTML pages. It has a lot of features, which should make dealing with HTML easy, including building pages/sites out of small reusable objects/components and session handling. See http://perl.apache.org/embperl/ (english) or http://www.ecos.de/embperl/ (german) for more informations. This is hopefully really the last release before the final 1.3 release. I have made a lot of enhancements in session handling. Please give it a try and report me any problems. Enjoy Gerald Changes since 1.3b6: - Fixed problem that call to close triggers error in Session.pm when using Store::File. Spotted by Alvar Freude. - Fixed problem that GetSession doesn't return a value for new session. Spotted by Angus Lees. - Added new function SetSessionCookie, which can be used to set the session cookie header in case you use Embperl session management, but don't use a Embperl page in that request. Suggested by Alex Schmelkin. - Fixed problem that DeleteSession does not work outside the base template, when used with EmbperlObject. Spotted by Angus Lees. - Fixed problem when use multiple nested ../foo.htm inside EmbperlObject. Spotted by Neil Gunton. - Included patch from Angus Lees to ease building on debian. - make test now works again with BEN-SSL httpsd. With help from Neil Gunton. - Included grammaticaly updated Embperl.pod. Many thanks to Ilia Lobsanov for doing the proof reading. - removed dbgDisableCache to avoid problems with this "feature" that isn't working anymore for a long time. - Added validaten for session cookie. If Apache::Session 1.53+ is installed it uses the validate method from Apache::Session::Generate::xxx. If a invalid session id is found a new one is generated. Spotted by Angus Lees. - If a not existing session id is received, Embperl generates now a new one. - Enhancements of Cookie resending logic. To make sure cookies are send when neccessary, but not more often. (Handles now write to session data, after a delete in the same request correctly). - Added more tests for Sessionhandling. - Fixed a bug that Content-Lenght was 2 to much, when escmode was set to zero. Spotted by Michael Smith. - Added patches from Randy Korbes for ActiveState Support. Most tests with Embperl under mod_perl nows passes. The few remaining ones that doesn't pass seems to be due to problems of mod_perl's enironment handling. - Droped support for Apache::Session 0.17. Embperl now support only Apache::Session 1.00 and higher. - Added new option: optDisableSelectScan, to allow processing of SELECT tags, while processing of TABLE tags is disabled. Suggested by Robert. - Carridge Returns are only removed for Perl 5.004. This makes using of HERE documents possible on Perl 5.005+, even if the documents has CRLF as lineendings. - Gerald Richterecos electronic communication services gmbh Internetconnect * Webserver/-design/-datenbanken * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925151 WWW:http://www.ecos.de Fax: +49 6133 925152 -
Re: database access
- Original Message - From: [EMAIL PROTECTED] To: "Les Mikesell" [EMAIL PROTECTED] Cc: "Tim Bunce" [EMAIL PROTECTED]; "Aaron" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, November 15, 2000 2:21 AM Subject: Re: database access On Tue, 14 Nov 2000, Les Mikesell wrote: I wonder if Apache::DBI could figure out what connections are worth holding open by itself? It could have some hints in the config file like regexps to match plus a setting that would tell it not to make a connection persist unless it had seen x instances of that connect string in y seconds. That really, really sucks, but Apache is selecting on the HTTP socket, and nothing matters beyond that, except signals of course. What you are implying is that DBI will be aware of the connections being closed or SIGALRM coming thru to the apache and on its lap, but it won't happen. No, I realize there is nothing to do after the fact - what I meant was that Apache::DBI might allow disconnect to really happen the first few times it sees a connect string after a child startup. If it saved the string with a timestamp and waited until it had seen the same string several times within a short interval it would be fairly likely that it would be worth staying connected. You'd trade some slower hits off against not accumulating a huge number of little-used database connections. Les Mikesell [EMAIL PROTECTED]