Re: Dynamic content that is static

2000-12-25 Thread Joshua Chamas

Apache::ASP has a cgi/asp script in the distribution that 
I use to generate apache-asp.org and chamas.com.  Its 
a bit rough but works for static HTML generation from
ASP scripts.  Also you can consider using a combination
of mod_proxy and specific headers like Expires to cache
your content for X time like 1 hour.  

I have never done the latter, and you should use 
lwp-request -ed do see what headers your site is really 
sending, as ASP sends a no-cache pragma by default which 
you'll need to override, I forget which header at this time.  
The proxy method should work generally in this case, though
I like generating content that can be offline.

--Josh

--- Philip Mak [EMAIL PROTECTED] wrote:
 Hi everyone,
 
 I have been going over the modperl tuning guide and the suggestions
 that
 people on this list sent me earlier. I've reduced MaxClients to 33
 (each
 httpd process takes up 3-4% of my memory, so that's how much I can
 fit
 without swapping) so if the web server overloads again, at least it
 won't
 take the machine down with it.
 
 Running a non-modperl apache that proxies to a modperl apache doesn't
 seem
 like it would help much because the vast majority of pages served
 require
 modperl.
 
 I realized something, though: Although the pages on my site are
 dynamically generated, they are really static. Their content doesn't
 change unless I change the files on the website. (For example,
 http://www.animewallpapers.com/wallpapers/ccs.htm depends on
 header.asp,
 footer.asp, series.dat and index.inc. If none of those files change,
 the
 content of ccs.htm remains the same.)
 
 So, it would probably be more efficient if I had a /src directory and
 a
 /html directory. The /src directory could contain my modperl files
 and a
 Makefile that knows the dependencies; when I type "make", it will
 evaluate
 the modperl files and parse them into plain HTML files in the /html
 directory.
 
 Does anyone have any suggestions on how to implement this? Is there
 an
 existing tool for doing this? How can I evaluate modperl/Apache::ASP
 files
 from the command line?
 
 Thanks,
 
 -Philip Mak ([EMAIL PROTECTED])
 
 
 
 
 
 


__
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/



development question

2000-12-25 Thread Steven Lembark


apache 1.3.14.

 havemultiple developers hacking html, mod_perl w/ own sandboxes.
need them to start up their own servers on various ports (e.g.,
8081, 8082...).  we are using CVS and need to share access to a
valid httpd.conf file.  

hmmm...  we all use the same httpd.conf and we all step on one 
another w/ ports and dir's.  not good.

no way i know of use specify htdocs as a relative path or use
$HOME or $SANDBOX to set it.

virtual hosts don't work well since everyone collides on the 
main server's PORT setting and none of has have SU access to 
suck up port 80 (which still wouldn't help if we collide on 80).

trying to avoid people using -d for now -- still doesn't help
since DocumentRoot wants an absolute path.

include doesn't work since we are sharing the same CVS tree and
would end up with the same includes -- unless there is something
like

Include "$ENV{LOGNAME}-conf"

to allow per-user portions of the config.

never learned how to configure apache w/ the perl format,
which might solve the entire thing via $ENV{HOME}.  might not...

so...

anyone have an example httpd.conf (stock or perly) that would
allow multiple people on the same machine to check out the same
httpd.conf, start up httpd w/ -f ./httpd.conf and not collide
on the ports, dir's?   

the only thing i can come up with so far is rather messy,
using, with

IfDefine blah
Include blah-config
/IfDefine

we can edit the common httpd.conf file for each of ourselves.

seems like performing the replacement in-place (e.g., via 
$LOGNAME) would be a cleaner way.

thanx




-- 
 Steven Lembark   2930 W. Palmer St.
 Chicago, IL  60647
 [EMAIL PROTECTED]   800-762-1582



Re: Modifying the reported size in a directory index

2000-12-25 Thread Doug MacEachern

On Tue, 22 Aug 2000, Jens-Uwe Mager wrote:

 I am looking for a way to update the reported size of a file in a plain
 directory index generated by Apache. I have installed a perl fixup
 handler that does check if a Macintosh resource fork is available
 additionally to the plain data fork and it replaces the default content
 handler with a custom one that combines both the data and resource fork
 on the fly in the MacBinary archive format. This all runs fine and well.
 
 The problem I have now that I need to modify the displayed size in the
 directory index. For example if the file in question is a Mac resource
 file with no data area the directory index displays 0k as the plain data
 file really has a zero length. I would believe that I need to delve into
 the C innards of the request record and add the size of the resource
 fork to the st_size field of the stat record to fix this, or does
 anybody have any better idea how to do this in plain perl?

i probably shouldn't be 'working' on xmas, but have some time to kill
before the airport and have had this in mind since you first posted (4
months ago!).  with the patch below and this package:
http://perl.apache.org/~dougm/Sys-Stat-0.01.tar.gz

a fixup handler can modify the reported size like so:

sub MyFixup::handler {
my $r = shift;
my $stat = Sys::Stat-stat($r-filename);
$stat-size(10_000); #whatever size
$r-finfo($stat); #changed size will be reflected in dirindex output
0;
}

Index: src/modules/perl/Apache.xs
===
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.118
diff -u -r1.118 Apache.xs
--- src/modules/perl/Apache.xs  2000/12/22 20:56:24 1.118
+++ src/modules/perl/Apache.xs  2000/12/26 02:02:13
@@ -1906,10 +1906,26 @@
 #  struct stat finfo;  /* ST_MODE set to zero if no such file */
 
 SV *
-finfo(r)
+finfo(r, sv_statbuf=Nullsv)
 Apache r
+SV *sv_statbuf
 
 CODE:
+if (sv_statbuf) {
+if (SvROK(sv_statbuf)  SvOBJECT(SvRV(sv_statbuf))) {
+STRLEN sz;
+char *buf = SvPV((SV*)SvRV(sv_statbuf), sz);
+if (sz != sizeof(r-finfo)) {
+croak("statbuf size mismatch, got %d, wanted %d",
+  sz, sizeof(r-finfo));
+}
+memcpy(r-finfo, buf, sz);
+}
+else {
+croak("statbuf is not an object");
+}
+}
+
 statcache = r-finfo;
 if (r-finfo.st_mode) {
laststatval = 0;




Re: development question

2000-12-25 Thread James G Smith

Steven Lembark [EMAIL PROTECTED] wrote:

apache 1.3.14.

 havemultiple developers hacking html, mod_perl w/ own sandboxes.
need them to start up their own servers on various ports (e.g.,
8081, 8082...).  we are using CVS and need to share access to a
valid httpd.conf file.  

hmmm...  we all use the same httpd.conf and we all step on one 
another w/ ports and dir's.  not good.

no way i know of use specify htdocs as a relative path or use
$HOME or $SANDBOX to set it.

First, read up on perl.../perl sections (Ch. 8 - appr. pg. 416 - in the 
eagle book).

If everyone's uid is between 1024 and 65536 exclusive (or whatever the valid 
range is for ports), you could do something like this:

perl
  $DocumentRoot = $ENV{'HOME'} . "/htdocs";
  $Port = $UID;
/perl

If the uid is not conducive to this, at worst, you could do the following:

perl
  %ports = (
  #  uid = port
1001 = 8000,
1002 = 8001,
1020 = 8002,
  );

  $Port = $ports{$UID};
/perl

and hope only people with defined ports try to start the server.

Similar things can be done with the rest of the configuration, and everyone 
can share the same configuration file.
+-
James Smith - [EMAIL PROTECTED] | http://www.jamesmith.com/
[EMAIL PROTECTED] | http://sourcegarden.org/
  [EMAIL PROTECTED]  | http://cis.tamu.edu/systems/opensystems/
+--