Re: (maybe offtopic) mod_perl/DBI/PostgreSQL
Do you have any code that might do a select to determine the value of the sequence used? Example: INSERT blah blah blah; SELECT currval(sequence_name); or somethign like that? If so, the SELECT may be incrementing the counter and that would explain the jump by 2 your seeing. There is a function to determine the value of the sequence without incrementing for postgres, but I don't remember right now what that is. I actually just did something like this myself. Creating an entry in a table and then needing to find out what the entry id was. In my case, I actually ended up just doing a SELECT with a where clause including the data I just inserted, reverse sorted by record creation date (timestamp default now() kind of thing, not included in INSERT statement) with a limit of 1. I know I could have used the function to get the sequence value, but I wasn't absolutely sure what would happen. If two processes incremented the sequence at the same time, what would the function return, the value for that connection's insert, or the value of the other session? Especially when I added Apache::DBI to the mix where db connections appear to be pooled and shared. This way I know I'm getting the value I'm looking for. Greg
Re: [Slightly OT] Port forwarding (Was: How to restart the rootserverfrom within modperl?)
When moving a server from MN to VA I used port forwarding to make the transition totally seamless. This includes DNS. I wanted to make sure all my services worked in both places, and I didn't want to have split systems. That would have been a nightmare for services like e-mail where a message to one server and the user getting mail from the other server would have been possible. I used xinetd and it's built in port forwarding capabilities to migrate one service at a time from MN to VA. Once the service was running in VA, I'd disable the service on the MN server and forward all traffic to VA. Went through each service (email, pop, imap, http, etc. etc. etc.) that I had active this way. Finally, the only thing running in MN was xinetd on all my active service ports. Worked beautifully. Users never knew about the server relocation and absolutely no disruption to services or missed/interrupted mail. Just the way I like things. Greg On Wed, 13 Aug 2003, Craig Edwards wrote: > Hi, > I once saw an example of port forwarding using netcat and inetd, i think it involved > setting up a listening netcat as the application, using inetd to bind it to a > specific port and then forwarding the connection onwards to the ip and/or port where > you want it to go, something like this: > > service geofwd > { >flags = REUSE >socket_type = stream >wait = no >user = root >server = /usr/bin/nc >server_args = 192.168.124.38 1005 >log_on_failure += USERID > } > > > not sure if this is what you want :-) > > Craig > > >Hello, > > > >ML>If you absolutely need to be in port 80, either setup a simple > >ML>lightweight apache on port 80 as a reverse proxy (see the mod_perl > >ML>guide) or, even simpler, do some port forwarding from port 80 to your > >ML>high port of choice. > > > >Has anybody had very good experiences using a simple port forwarder in a > >production setup? We had a somewhat bad experience with using portfwd > >under Solaris (images and other binary data got randomly corrupted, and we > >never got around to figuring out why), and I'm wondering what others use > >instead. It seems like the port forwarder involved would also be important > >performance wise. > > > >The applications I am typically interested in are forwarding ports on the > >same interface (like the port 80 example here) as well as between > >interfaces (or between external interfaces and loopback). > > > >Humbly, > > > >Andrew > > > >-- > >Andrew Ho http://www.tellme.com/ [EMAIL PROTECTED] > >Engineer1-800-555-TELL Voice 650-930-9062 > >Tellme Networks, Inc. Fax 650-930-9101 > >-- > >
Getting list of all cookies available?
I'm using Apache 1.3.27, mod_perl 1.28, and Apache::ASP 2.53 (+ mod_ssl, all on cygwin). I know how I can get and set cookies in Apache:ASP, this is no problem. What I am trying to figure out is how to get a list of cookies that are available. Is there a way to get the list of available cookies from Apache::ASP or mod_perl? Or should I just use the HTTP_COOKIE variable and parse that to get my list? Thanks, Greg
Re: Problem configuring and making mod_perl
Try adding a -I for /usr/kerberos/include. Since they are not in the /usr/include path that may be why it has problems. On Fri, 18 Jul 2003, Richard Kurth wrote: > I get this when I run locate krb5.h > /usr/kerberos/include/gssapi/gssapi_krb5.h > /usr/kerberos/include/krb5.h > > So I would say it is there > > > > >Richard Kurth wrote: > >>Thanks for the suggestion but it did not work I still get the same error. > >>Also this is a rh9.0 Server > > > >it's possible that you don't have the kerberos package installed. What: > > > > % locate krb5.h > > > >gives? If you get nada, install the package and try again. > > > >>>I hit the same error trying to build on a rh9.0 workstation. This solved > >>>my problem: > >>> > >>>CPPFLAGS=-I/usr/kerberos/include > >>>export CPPFLAGS > >[...] > >>> > -DMOD_SSL_VERSION=\"2.8.12\" mod_ssl.c && mv mod_ssl.o mod_ssl.lo > >>> > In file included from /usr/include/openssl/ssl.h:179, > >>> > from mod_ssl.h:116, > >>> > from mod_ssl.c:65: > >>> > /usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory > >[...] > > > >__ > >Stas BekmanJAm_pH --> Just Another mod_perl Hacker > >http://stason.org/ mod_perl Guide ---> http://perl.apache.org > >mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com > >http://modperlbook.org http://apache.org http://ticketmaster.com >
Re: mod_accel redirects
Check UseCanonicalName in Apache config. What you describe is what happens when this is turned ON and Apache generates a URL that points back to itself. Try turning this off and see if it makes a difference. On Fri, 18 Jul 2003, Philip Mak wrote: > Given this server configuration (this is a front-end lightweight > Apache, which uses mod_accel to proxy to a back-end mod_perl Apache): > > GET /redir.asp HTTP/1.1 > Host: shoujoai.com > > and the following response: > > Location: http://www.shoujoai.com/mush/
Problems with shared build under cygwin
I've been googling the net and search list archives for information on getting mod_perl working under cygwin. I'm using the latest cygwin (installed yesterday) w/o apache. Then I got apache 1.3.27 and mod_perl 1.28 sources and set to build them. I'm running this under XP Home. I've managed to get a static version built and running under cygwin with no problem. However when I attempt to enable the so module it all bombs out. The bottom of this message will includes how I successfully got this built and how it failed, as well as excerpt from the errors in the build log. I've found two or three messages that were helpful when I was attempting to build the shared version -- but the most recent helpful information seems to have been from June 2002. Is there more recent information? Is a static http the only way to get mod perl working under cygwin? Any assistance getting the shared version built is greatly appreciated. Thanks, Greg STATIC BUILD -- THIS WORKED:: cd /home/Greg/apache/mod_ssl-2.8.14-1.3.27 ./configure --with-apache=../apache_1.3.27 cd ../mod_perl-1.28 perl Makefile.PL\ USE_APACI=1 \ DO_HTTPD=1\ EVERYTHING=1 \ SSL_BASE=/usr \ APACHE_PREFIX=/opt/apache \ APACI_ARGS='--prefix=/opt/apache --runtimedir=/opt/apache/run \ --with-port=80 --server-uid=Greg --server-gid=None\ --with-perl=/usr/bin/perl --enable-module=auth_db \ --enable-module=digest --enable-module=expires\ --enable-module=usertrack --enable-module=rewrite \ --enable-module=unique_id --enable-module=vhost_alias \ --enable-module=expires --enable-module=info \ --enable-module=ssl' make SHARED BUILD -- THIS DOES NOT WORK:: cd /home/Greg/apache/mod_ssl-2.8.14-1.3.27 ./configure --with-apache=../apache_1.3.27 cd ../mod_perl-1.28 perl Makefile.PL\ USE_APACI=1 \ DO_HTTPD=1\ EVERYTHING=1 \ SSL_BASE=/usr \ APACHE_PREFIX=/opt/apache \ APACI_ARGS='--prefix=/opt/apache --runtimedir=/opt/apache/run \ --with-port=80 --server-uid=Greg --server-gid=None\ --with-perl=/usr/bin/perl --enable-module=auth_db \ --enable-module=digest --enable-module=expires\ --enable-module=usertrack --enable-module=rewrite \ --enable-module=unique_id --enable-module=vhost_alias \ --enable-module=expires --enable-module=info \ --enable-module=ssl --enable-module=so' make When compiling the shared version, it works fine until it gets to the following point (errors included): <=== src/modules env LD_RUN_PATH=/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE gcc -c -I. -I/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE -I./os/cygwin -I./include -DCYGWIN -DNO_DBM_REWRITEMAP -DMOD_SSL=208114 -DMOD_PERL -DUSE_PERL_SSI -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSE_HSREGEX -DEAPI -DSHARED_CORE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing `./apaci` modules.c env LD_RUN_PATH=/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE gcc -c -I. -I/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE -I./os/cygwin -I./include -DCYGWIN -DNO_DBM_REWRITEMAP -DMOD_SSL=208114 -DMOD_PERL -DUSE_PERL_SSI -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSE_HSREGEX -DEAPI -DSHARED_CORE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing `./apaci` buildmark.c dllwrap --export-all -o libhttpd.dll buildmark.o modules.o modules/standard/libstandard.a modules/ssl/libssl.a modules/perl/libperl.a main/libmain.a ./os/cygwin /libos.a ap/libap.a regex/libregex.a -lcrypt -lgdbm dllwrap: no export definition file provided. Creating one, but that may not be what you want modules/standard/libstandard.a(mod_include.o)(.text+0xb4):mod_include.c: undefined reference to `__imp__ap_ht_time' modules/standard/libstandard.a(mod_include.o)(.text+0xcf):mod_include.c: undefined reference to `__imp__ap_table_setn' modules/standard/libstandard.a(mod_include.o)(.text+0xf4):mod_include.c: undefined reference to `__imp__ap_ht_time' modules/standard/libstandard.a(mod_include.o)(.text+0x10f):mod_include.c: undefined reference to `__imp__ap_table_setn' modules/standard/libstandard.a(mod_include.o)(.text+0x13a):mod_include.c: undefined reference to `__imp__ap_ht_time' modules/standard/libstandard.a(mod_include.o)(.text+0x155):mod_include.c: undefined reference to `__imp__ap_table_setn' modules/standard/l
RE: Can't use sendmail more than once
That's fixed it - I don't server many images - thanks very much! -Original Message- From: Perrin Harkins [mailto:[EMAIL PROTECTED] Sent: Thursday, 29 May 2003 1:07 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Can't use sendmail more than once On Wed, 2003-05-28 at 22:45, Greg Dutkowski wrote: > I have migrated my site from IIS and Active State to Apache 1.3 and mod_perl > on a Windows machine. I use the site to send emails to registered users > using Mail::sendmail through our SMTP server (another machine). > > With Apache I can only send emails once after I start the Apache server, > thereafter it tells me it can't connect to the SMTP server. Restarting the > Apache server leads to again being able to only send emails once. > > Any ideas? This is a known problem with mod_perl 1.x on Win32. Sockets only work when you make it single-threaded (ThreadsPerChild 1). Doing that doesn't make a difference in terms of your actual script performance, since mod_perl is already single-threaded on Win32, but it will make images slow. One solution is to serve the images from a separate web server. - Perrin
Can't use sendmail more than once
I have migrated my site from IIS and Active State to Apache 1.3 and mod_perl on a Windows machine. I use the site to send emails to registered users using Mail::sendmail through our SMTP server (another machine). With Apache I can only send emails once after I start the Apache server, thereafter it tells me it can't connect to the SMTP server. Restarting the Apache server leads to again being able to only send emails once. Any ideas?
Re: okay, I give, I'm stumped
I actually was successful at building apache/mod_perl static with DSO support and not having to change the rest of the modules. It appears to be working, so will continue to test further. Greg * Drew Taylor ([EMAIL PROTECTED]) [020728 22:19]: > There are well written instructions in The Guide that show step by step how > to roll a static mod_perl/php/ssl binary. And I've done it personally > without much trouble, so it's easier than you might think. ;-) Here's the > direct link: > http://perl.apache.org/docs/1.0/guide/install.html#mod_perl_and_mod_php > > Drew > > At 07:59 PM 7/28/2002 -0700, Greg Rumple wrote: > >Yup, this is it. If I build it without DSO support, it appears to work. > >Of course I build this with mod_php, mod_ssl, mod_perl, and a couple of > >custom modules. So running without DSO support isn't to easy. I guess > >I can attempt to build mod_perl in, but keep DSO support and dynamic > >load the rest of the modules. Will try that. > > == > Drew Taylor | Freelance web development using > http://www.drewtaylor.com/ | perl/mod_perl/MySQL/postgresql/DBI > mailto:[EMAIL PROTECTED] | Email jobs at drewtaylor.com > -- > Netflix: Unlimited DVD rentals with NO LATE FEES for $19.95/mo. > http://service.bfast.com/bfast/click?bfmid=27276611&siteid=39734327&bfpage=special > == > -- Greg Rumple [EMAIL PROTECTED]
Re: okay, I give, I'm stumped
Yup, this is it. If I build it without DSO support, it appears to work. Of course I build this with mod_php, mod_ssl, mod_perl, and a couple of custom modules. So running without DSO support isn't to easy. I guess I can attempt to build mod_perl in, but keep DSO support and dynamic load the rest of the modules. Will try that. * Kyle Dawkins ([EMAIL PROTECTED]) [020728 18:58]: > Hey Greg et al. > > I'd betcha your problem is almost certainly caused by your use of DSOs. If > you *really* want to prune your system down to see where your bug is, then > build apache and mod_perl statically. There was a very well-known bug that > caused DBI to segfault if it was run under a DSO. Please rebuild your > binary and then let us know if that was the problem. > > Kyle Dawkins > Central Park Software > http://www.centralparksoftware.com > > > > Okay, I've been staring at this problem for close to 48 hours straight > > now and have finally narrowed it down to a set of lines of code. > > > > So let me first expand. > > > > I currently have a system running, with Apache 1.3.14 and Mod_Perl 1.24 > > on Redhat 7.0 (yeah REALLY REALLY ancient) and Perl 5.005003. It also > > has mod_ssl, and several other modules loaded, but for the sake of the > > problems I am having, I completely removed those. > > > > This actually runs perl scripts that connect and talk to (yeah dig > > this), Postgres, Mysql, and Informix. The root of my problems, as I > > have finally found, is Informix. > > > > In our httpd.conf, we utilize a PerlScript directive to preload a bunch > > of environment variables, and other stuff at startup. The script is > > pretty nasty and harry, and buried deep within it happened to be a call > > to Informix. > > > > So for the record, the current system (ancient stuff) works. > > > > So the problems began. I decided to upgrade to Apache 1.3.26 and > > Mod_Perl 1.27 on Debian Woody (3.0) and Perl 5.006001. I also built all > > the other libraries, and than the fun began. > > > > At first, I just got seg faults attempting to start apache. But as I > > have said above, I have narrowed it down to a set of lines of code that > > cause it to fail. > > > > So if I build Apache 1.3.26 and Mod_perl 1.27 by themselves, using > > pretty straight forward options.. > > > > Apache > > -- > > CC="gcc" \ > > CFLAGS="-g" \ > > LIBS="-L/home/grumple/src/test/lib > > -L/home/grumple/src/test/system/lib " \ > > ./configure \ > > "--prefix=/home/grumple/src/test/system" \ > > "--enable-module=most" \ > > "--enable-shared=max" \ > > "--with-layout=GNU" \ > > "--disable-rule=EXPAT" \ > > "$@" > > -- > > > > and > > > > Mod_perl > > > > perl Makefile.PL PERL_USELARGEFILES=0 PERL_DEBUG=1 USE_APXS=1 > WITH_APXS=/home/grumple/src/test/system/sbin/apxs EVERYTHING=1 > INC=/home/grumple/src/test/system/include > > -- > > > > and than my conf > > > > httpd.conf > > -- > > AccessConfig /dev/null > > ResourceConfig /dev/null > > > > LoadModule env_module libexec/mod_env.so > > LoadModule config_log_module libexec/mod_log_config.so > > LoadModule mime_modulelibexec/mod_mime.so > > LoadModule autoindex_module libexec/mod_autoindex.so > > LoadModule dir_module libexec/mod_dir.so > > LoadModule alias_module libexec/mod_alias.so > > LoadModule access_module libexec/mod_access.so > > LoadModule auth_modulelibexec/mod_auth.so > > LoadModule setenvif_modulelibexec/mod_setenvif.so > > > > AddModule mod_env.c > > AddModule mod_log_config.c > > AddModule mod_mime.c > > AddModule mod_autoindex.c > > AddModule mod_dir.c > > AddModule mod_alias.c > > AddModule mod_access.c > > AddModule mod_auth.c > > AddModule mod_setenvif.c > > > > ServerType standalone > > ServerRoot "/home/grumple/src/test/system" > > > > PidFile/var/tmp/run/test.pid > > LockFile /var/tmp/test.lock > > ScoreBoardFile /var/tmp/test.scoreboard > > > > Timeout 300 > > KeepAlive On > > MaxKeepAliveRequests 100 > > KeepAliveTimeout 15 > > MinSpareServers 2 > > MaxSpareServers 10 > > StartServers3 > > MaxClients 256 > > MaxRequestsPerChild 1000 > > > > LoadModule perl_module libexec/libperl.so > >
Re: okay, I give, I'm stumped
4023829a in Perl_yyparse () from /usr/lib/libperl.so.5.6 #36 0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6 #37 0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6 #38 0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6 #39 0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6 #40 0x4021a89e in perl_call_sv () from /usr/lib/libperl.so.5.6 #41 0x4021e1db in Perl_call_list () from /usr/lib/libperl.so.5.6 #42 0x4021de4f in Perl_call_list () from /usr/lib/libperl.so.5.6 #43 0x40242b92 in Perl_newATTRSUB () from /usr/lib/libperl.so.5.6 #44 0x4023face in Perl_utilize () from /usr/lib/libperl.so.5.6 #45 0x4023829a in Perl_yyparse () from /usr/lib/libperl.so.5.6 #46 0x4028bc49 in Perl_sv_compile_2op () from /usr/lib/libperl.so.5.6 #47 0x4028cf6c in Perl_pp_require () from /usr/lib/libperl.so.5.6 #48 0x40262411 in Perl_runops_standard () from /usr/lib/libperl.so.5.6 #49 0x4021ab2c in perl_call_sv () from /usr/lib/libperl.so.5.6 #50 0x4021acce in perl_eval_sv () from /usr/lib/libperl.so.5.6 #51 0x404856e4 in perl_require_module (name=0x404abd64 "Apache", s=0x8094c04) at perl_util.c:550 #52 0x4047e9d7 in perl_cmd_module (parms=0xb8fc, dummy=0x8096904, arg=0x82147fc "Apache::DBI") at perl_config.c:591 #53 0x08054e7d in invoke_cmd (cmd=0x404b3090, parms=0xb8fc, mconfig=0x8096904, args=0xbfffd872 "") at http_config.c:946 #54 0x08055301 in ap_handle_command (parms=0xb8fc, config=0x8095134, l=0xbfffd85c "PerlModule Apache::DBI") at http_config.c:1079 #55 0x0805539d in ap_srm_command_loop (parms=0xb8fc, config=0x8095134) at http_config.c:1093 #56 0x08055a69 in ap_process_resource_config (s=0x8094c04, fname=0x808d700 "/var/tmp/test.conf", p=0x8094bdc, ptemp=0x809f2fc) at http_config.c:1355 #57 0x080563bc in ap_read_config (p=0x8094bdc, ptemp=0x809f2fc, confname=0x808d700 "/var/tmp/test.conf") at http_config.c:1647 #58 0x08060c43 in standalone_main (argc=6, argv=0xba64) at http_main.c:5158 #59 0x080615cc in main (argc=6, argv=0xba64) at http_main.c:5558 So for grins, I than decided I would try postgres to just verify this is an Informix issue. I commented out the Informix lines in my startup perl script, and added the 4 lines necessary to connect to a local postgres database, and sure enough it works. Here's what the output looks like. DBI 1.21-nothread dispatch trace level set to 2 Note: perl is running without the recommended perl -w option BEGIN --- -> DBI->Apache::DBI::connect(dbi:Pg:dbname=ftf;host=grumple;port=6110, , ) -> DBI->install_driver(Pg) for linux perl=5.006001 pid=17070 ruid=1000 euid=1000 install_driver: DBD::Pg version 1.11 loaded from /home/grumple/src/ftf.newshit/ext/lib/perl5/DBD/Pg.pm <- install_driver= DBI::dr=HASH(0x819f0a8) <- FETCH= 'Pg' ('Name' from cache) at DBI.pm line 64 17070 Apache::DBI skipping connection during server startup, read the docu !! -> connect for DBD::Pg::dr (DBI::dr=HASH(0x819f0a8)~0x81f656c 'dbname=ftf;host=grumple;port=6110' '' HASH(0x817d044)) pg_db_login pg_db_login: conn_str = >dbname=ftf host=grumple port=6110< <- connect= DBI::db=HASH(0x81f6530) at DBI.pm line 83 -> STORE for DBD::Pg::db (DBI::db=HASH(0x81f6518)~INNER 'PrintError' 1) dbd_db_STORE <- STORE= 1 at DBI.pm line 513 -> STORE for DBD::Pg::db (DBI::db=HASH(0x81f6518)~INNER 'AutoCommit' 1) dbd_db_STORE dbd_db_STORE: initialize AutoCommit to on <- STORE= 1 at DBI.pm line 513 <- connect= DBI::db=HASH(0x81f6530) END --- -> DESTROY for DBD::Pg::db (DBI::db=HASH(0x81f6518)~INNER) Database handle destroyed without explicit disconnect. dbd_db_disconnect dbd_db_destroy <- DESTROY= undef It seems to just look good, and work all dandy. Yet the Informix driver just blows up horribly. > > > use DBD::Informix; > > i don't think you need this use statement at all. the DBI->connect() call > should load the "correct" DBD Driver, for you, not that it *should* make any > difference... but hey. Me either, just put it in there just in case. Makes NO difference. > i would certainly suggest adding: > > or die DBI::errstr; > > to that connect() call! Yeah, was just throwing together a sample program. Not trying to put together something to be "production" quality. :-) > > > $dbh->disconnect(); > > um, okay but why disconnect at all, if you know the segfault is caused by > the connect and/or disconnect calls? have you tries simply *not* > disconnecting? one of The Features/Advantages of Apache::DBI (over plain > ole DBI) is that disconnect calls simlpy destroy the connection *object* > (the perl data structure) without actually disconnecting from the DB, and > therby maintaining a pool of cached connections, and therby speeding things > up nicely. I have removed the disconnect, but it makes no difference as suspected. I will note that once the server is started, it has 0 problems communicating with Informix, it's only in this startup script that it blows up badly. -- Greg Rumple [EMAIL PROTECTED]
okay, I give, I'm stumped
'LD_LIBRARY_PATH'} .= ":$ENV{'INFORMIXDIR'}/lib"; my $catalog = 'test'; my $constr = join(':', 'dbi', 'Informix', $catalog); my $user = 'test'; my $password = 'test'; my $dbh = DBI->connect($constr,$user,$password); $dbh->disconnect(); 1; -- So all looks good right? Well it does, other than running above yields the following crash in GDB. Program received signal SIGSEGV, Segmentation fault. 0x400e7a90 in free () from /lib/libc.so.6 (gdb) bt #0 0x400e7a90 in free () from /lib/libc.so.6 #1 0x40255d3b in Perl_safefree () from /usr/lib/libperl.so.5.6 #2 0x402705eb in Perl_sv_clear () from /usr/lib/libperl.so.5.6 #3 0x4027088f in Perl_sv_free () from /usr/lib/libperl.so.5.6 #4 0x40274d6f in Perl_sv_vcatpvfn () from /usr/lib/libperl.so.5.6 #5 0x4026a378 in Perl_sv_add_arena () from /usr/lib/libperl.so.5.6 #6 0x4026a434 in Perl_sv_clean_all () from /usr/lib/libperl.so.5.6 #7 0x40219b75 in perl_destruct () from /usr/lib/libperl.so.5.6 #8 0x401bbb77 in perl_shutdown (s=0x0, p=0x0) at mod_perl.c:294 #9 0x401bc507 in mp_dso_unload (data=0x8094bdc) at mod_perl.c:489 #10 0x08050c39 in run_cleanups (c=0x80a06cc) at alloc.c:1713 #11 0x0804f2d5 in ap_clear_pool (a=0x8094bdc) at alloc.c:538 #12 0x08060bfc in standalone_main (argc=6, argv=0xbac4) at http_main.c:5058 #13 0x080615cc in main (argc=6, argv=0xbac4) at http_main.c:5448 The test.pl script works fine by it's self. Turning on full PERL debugging/tracing yields that the actual script has fully finished, and that it's in the tear down of the actualy perl stuff that this failure is coming from. Not from the script per se. But it is the script that is causing this problem. Commenting out the connect and disconnect lines causes the server to startup and function just fine. So I'm not quite sure what to do. I know I can get my entire system working if I don't make the calls to Informix at startup (it appears it's purely the connect that causes the error (whether it's a good connect or not, I tried giving it a bogus password, and it still crashes)), but well that's kind of a pain in the butt. So if anyone has ANY clues, it would be sincerely appreciated, as I need sleep, and I also would love to get this working. Thanks a ton in advance. Greg -- Greg Rumple [EMAIL PROTECTED]
PERL/SQL job listing:
We have a ground floor opening for a perl programmer for a TELECOMMUTING situation for web/wireless/telecom system development. Requirements: Strong Perl 5 experience SQL database knowledge Experience: CGI is a big plus Unix/Linux is a plus mod_perl apache servers are a plus DBI database experience is a big plus The company is a startup focusing on the transportation industry. The position is for direct employment and stock options. The company management has had great success launching and selling web sites in the past (last 3 companies sold for about $85 million) We have done a lot, but have many fun projects remaining like XML interfaces, Interactive Voice Response (IVR), FAX gateways, Linux, and many interesting business processes to automate. Please respond with: resume $salary requirements example web sites if available sample perl code Thank you, Greg http://www.CargoTel.com/ (email) [EMAIL PROTECTED]
Re: Excellent article on Apache/mod_perl at eToys
Andrew Ho wrote: > > Hello, > > I checked the list archives and it didn't look like this had been posted yet. > For those of you who haven't seen it yet... a great read on perl.com about > the Apache/mod_perl setup at eToys, co-authored by our own mod_perl > regular contributer Perrin Harkins. > > http://www.perl.com/pub/a/2001/10/17/etoys.html > Yup, this is an excellent read. Thanks Perrin. Greg
apache::dbi vs mysql relay
Hello, Are there any benchmark comparisons between apache::dbi and mysql relay? We're planning on having four sql servers, one of them will do all of the writes to the db and the other three will only be used for reads from the db. The data in the db that is doing the writing will be constantly replicated across the other three machines. Which would be better to use to initiate a persistent database connection? The main concern we have is having to have two different database handles open for one script, one to the machine that does the writing and the other to do the reads. Can Apache::DBI detect this? Thanks in advance, greg
CPAN and libapreq
Dear All Doing an automated install on a new dev server I noticed that with a snapshot bundle created on another, it lists libapreq-0.33 as being Apache::libapreq. When cpan comes to install the bundle and looks for Apache::libapreq it downloads 0.31 eg: cpan> i /libapreq/ Going to read /root/.cpan/sources/authors/01mailrc.txt.gz CPAN: Compress::Zlib loaded ok Going to read /root/.cpan/sources/modules/02packages.details.txt.gz Database was generated on Tue, 25 Sep 2001 08:01:47 GMT CPAN: HTTP::Date loaded ok Going to read /root/.cpan/sources/modules/03modlist.data.gz DistributionD/DO/DOUGM/libapreq-0.31.tar.gz DistributionJ/JI/JIMW/libapreq-0.33.tar.gz Module Apache::libapreq (D/DO/DOUGM/libapreq-0.31.tar.gz) I am assuming something is up here - I can overide this, but can the pointer for module Apache::libapreq been changed to libapreq-0.33 on cpan mirros ? Thanks Greg
using DBI with apache
I can run this simple script through perl itself, but when I put it in the cgi-bin and try to run it using mod_perl Perl pops up in windows with an error. I assume this means I need something like Apache::DBI?... I originally got Apache in binary form with mod_perl installed and did not have to compile anything. I tried to follow the instructions but i dont seem to be able to build Apache::DBI I ran perl makefile.pl which creates a file called makefile then the instructions tell you to run make make test make install make by run by itself says 'No terminator specified for in-line operator' and i dont have a test or install file that came with the Apache:DBI download. I have a test.pl but that doesnt seem to be what i need. I am running Win 98se if that helps. Anyone have any suggestions? Here is the code I tried to run. #!\perl\bin\perl use DBI; $dbh = DBI->connect('dbi:ODBC:Test1Db'); $sqlstatement="SELECT * FROM ASTAB"; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; #output database results while (@row=$sth->fetchrow_array) { print "@row\n" } _ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
Apache=SCALAR(?????)
hello, I recently changed a username/password check script to mod_perl, however when under mod_perl, I noticed that failed logins with the correct username and password combination show the password in the log as Apache=SCALAR(???), i.e. Apache=SCALAR(0x2d9f74). What is mod_perl doing here to my password parameter. I am running solaris 5.6 with ApacheSSL. thanks, greg
crash on exit with -X
Hi. We're getting a segfault when httpd shuts down when using mod_perl on Red Hat 6.2, and I'd like to know whether anyone else has seen this as well. If I run "httpd -X -f /home/gvwilson/httpd.conf" under gdb, the stack trace is: #0 0x4000af21 in _dl_debug_state () at dl-debug.c:56 #1 0x40183156 in _dl_close (map=0x853bb78) at dl-close.c:195 #2 0x400a1430 in dlclose_doit (handle=0x853bb78) at dlclose.c:26 #3 0x4000ac3b in _dl_catch_error (errstring=0x400a3080, operate=0x400a1418 , args=0x853bb78) at dl-error.c:141 #4 0x400a18b9 in _dlerror_run (operate=0x400a1418 , args=0x853bb78) at dlerror.c:125 #5 0x400a13fe in dlclose (handle=0x853bb78) at dlclose.c:32 #6 0x806748c in ap_os_dso_unload () #7 0x4026c3ec in unload_xs_so () from /etc/httpd/modules/libperl.so #8 0x4026c42b in mp_dso_unload () from /etc/httpd/modules/libperl.so #9 0x8051068 in ap_run_cleanup () #10 0x804fe59 in ap_clear_pool () #11 0x805bf76 in ap_child_terminate () #12 0x805c65f in main () #13 0x400bc9cb in __libc_start_main (main=0x805c3e0 , argc=4, argv=0xbb54, init=0x804f014 <_init>, fini=0x807b99c <_fini>, rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbb4c) at ../sysdeps/generic/libc-start.c:92 "perl -V" gives: Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=linux, osvers=2.2.5-22smp, archname=i386-linux uname='linux porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2 09:11:51 edt 1999 i686 unknown ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O2 -m486 -fno-strength-reduce', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include' ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include' stdchar='char', d_stdstdio=undef, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lc -lposix -lcrypt libc=, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Built under linux Compiled at Feb 2 2000 15:35:58 @INC: /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 . "/usr/sbin/httpd -V" gives: Server version: Apache/1.3.12 (Unix) (Red Hat/Linux) Server built: Mar 1 2000 13:37:34 Server's Module Magic Number: 19990320:7 Server compiled with -D EAPI -D HAVE_MMAP -D HAVE_SHMGET -D USE_SHMGET_SCOREBOARD -D USE_MMAP_FILES -D USE_FCNTL_SERIALIZED_ACCEPT -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard" -D DEFAULT_LOCKFILE="/var/run/httpd.lock" -D DEFAULT_XFERLOG="/var/log/httpd/access_log" -D DEFAULT_ERRORLOG="/var/log/httpd/error_log" -D TYPES_CONFIG_FILE="/etc/httpd/conf/mime.types" -D SERVER_CONFIG_FILE="/etc/httpd/conf/httpd.conf" -D ACCESS_CONFIG_FILE="/etc/httpd/conf/access.conf" -D RESOURCE_CONFIG_FILE="/etc/httpd/conf/srm.conf" "uname -a" and "cat /etc/redhat-release" give: Linux snuff.testbed.private 2.2.14-5.0 #1 Tue Mar 7 20:53:41 EST 2000 i586 unknown Red Hat Linux release 6.2 (Zoot) respectively. Is this a known issue? If so, I'd be grateful for pointers to a solution. Thanks, Greg
Re: Mod_perl and Post Read Request
Jay Thorne wrote: > > I'm trying to use mod_perl in conjunction with another module called > mod_adbanners.c > > >From our tests, its quite apparent that when a is handled by > mod_perl, our other apache handler is not called called, though we've > compiled perl to not hook into PostReadRequest > > Any suggestions? > Is there a spell we can invoke? Do I need a dead chicken? > Did you complie mod_perl with the configure option of EVERYTHING=1 ? I've found that dead chickens help the juju along, but invaribaly the answer lies elsewhere ;-) Hope that helps. Greg > -- > Jay Thorne Manager, Systems & Technology, UserFriendly Media, Inc.
Re: unreleased sockets using DBI / DBD::mysql under mod_perl?
Joern Janoschek wrote: > > On Wed, 14 Mar 2001 18:46:31 +, Greg Cope wrote: > > >There's no reason why Apache::DBI should not work - by the sounds of it > >the connections strings may have been different ? > > > >Apache::DBI works in an environment where on user ID is used to connect > >to the DB mulitple time. If you use two different connection strings > >Apache::DBI will try and make both persistent (IIRC). > > > >So check your DBI connection strings as they should be indentical. > > Here is the problem: The connection strings _are_ the same. No > change at all between two connects... same host, same user, same > DB, even the same table (not that it bothers)... nothing > changes. That's the strange thing and that's what we didn't > understand at all and what pushed us to the point where we > disabled Apache::DBI. > Could it be that there is a connection between the socket > problem and the ever rising persistent connections? Maybe the > Apache::DBI cannot share an already connected handle because the > system says the socket is still in use and not free at all. That > would explain the unusual behaviour of Apache::DBI... > Maybe someone who hasn't an explaination could tell me at least > where to look at? Linux system? Apache? mod_perl? Mysql? > DBI/DBD? > This would appear to be a DBI problem - but I'm no expert. Have you tried the DBI list ? I am afraid I can shed no further light on this. Greg > Thanks anyway, > > Jörn Janoschek. > KLAHOLD - We make IT work! - http://www.klahold.de > - WebDevelopment - http://www.klahold.de > - Content-Management-System - http://www.interred.de
Re: unreleased sockets using DBI / DBD::mysql under mod_perl?
Joern Janoschek wrote: > > Hi, > > we are currently developing several Perl scripts for a big > german site with high traffic and the need of fast DB > connections. The webserver are Apache 1.3.14 setup with mod_perl > (current version as far as I know). The scripts connect to a > Mysql 3.2332 on another machine over a socket connections. > Now the problem: High traffic result to many connections to the > DB. The DB seems to be fast enough (4 Xeon 750 machine with 4 > GB) to handle those requests. BUT after some time the DB get > flooded by unauthorised connections. Looking at the DB server > stats it doesn't look like a high demand for processor power... > the machine is idling as far as a DB server can be idle. Those > faulty connection, we can't get rid of. Once they are coming in, > the DB doesn't seem capable of handling, authenticating or > refusing them properly. > We regard this as a some sort of mod_perl socket problems > because performance tests during the night, using PHP with the > same queries and similar load proof to be all correctly > answered. No unauthenticated connection in the processlist of > the mysql, even when there are 500 concurrent DB requests > running. > Taking a peek at the webserver netstats when connecting with > Perl scripts show a lot of open and not closing socket > connections to the mysql... only after some timeout period they > get disconnected. > Currently Perl tests over mod_cgi still have to be made, but I > doubt this will be a problem, but who knows... maybe we have > some DBD::mysql configuration problem here? This is surely the > wrong list to ask... :-) but you'll never know, maybe sonmeone > reading this can point me in the propper direction. > > Anyway, anyone experienced the same behaviour before? Any hint > to a solution are greatly appreciated, we need a > fix/solution/workaround soon! > > A word on Apache::DBI: Yes, we did try persistant connections to > avoid heavy connection load on the mysql. BUT it simply didn't > work. Well sort of. Persistant connections were established, but > they never got reused. Until about 7 open connections > resulted in a DB crash. Not nice. Same problem with a > corresponding persistant connection test using PHP... maybe a > Mysql client source configuration problem or something like it? > Anyone experienced this before? > There's no reason why Apache::DBI should not work - by the sounds of it the connections strings may have been different ? Apache::DBI works in an environment where on user ID is used to connect to the DB mulitple time. If you use two different connection strings Apache::DBI will try and make both persistent (IIRC). So check your DBI connection strings as they should be indentical. Greg > Thanks for any help or hint, > > Jörn Janoschek. > KLAHOLD - We make IT work! - http://www.klahold.de > - WebDevelopment - http://www.klahold.de > - Content-Management-System - http://www.interred.de
Re: [OT] Re: mod_perl shared memory with MM
Perrin Harkins wrote: > > > Can I ask why you are not useing IPC::Sharedlight (as its pure C and > > apparently much faster than IPC::Shareable - I've never benchmarked it > > as I've also used IPC::Sharedlight). > > Full circle back to the original topic... > IPC::MM is implemented in C and offers an actual hash interface backed by a > BTree in shared memory. IPC::ShareLite only works for individual scalars. > Not tried that one ! I'ce used the obvious Sharedlight plus Storable to serialise hashes. > It wouldn't surprise me if a file system approach was faster than either of > these on Linux, because of the agressive caching. I would be an interesting benchmark ... Althought it may only be a performance win on a lightly loaded machine,the assymption being that the stat'ing is fast on a lowly loaded system with fast understressed disks. I could be completly wrong here tho ;-). Has anyone used the file system approach on a RAM disk ? Greg > > - Perrin
Re: [OT] Re: mod_perl shared memory with MM
DeWitt Clinton wrote: > > On Sun, Mar 11, 2001 at 03:33:12PM +0100, Christian Jaeger wrote: > > > I've looked at Cache::FileCache now and think it's (currently) not > > possible to use for IPC::FsSharevars: > > > > I really miss locking capabilities. Imagine a script that reads a > > value at the beginning of a request and writes it back at the end of > > the request. If it's not locked during this time, another instance > > can read the same value and then write another change back which is > > then overwritten by the first instance. > > I'm very intrigued by your thinking on locking. I had never > considered the transaction based approach to caching you are referring > to. I'll take this up privately with you, because we've strayed far > off the mod_perl topic, although I find it fascinating. > > > - why don't you use 'real' constants for $SUCCESS and the like? (use > > constant) > > Two reasons, mostly historical, and not necessarily good ones. > > One, I benchmarked some code once that required high performance, and > the use of constants was just slightly slower. > > Two, I like the syntax $hash{$CONSTANT}. If I remember correctly, > $hash{CONSTANT} didn't work. This may have changed in newer versions > of Perl. > > Obviously those are *very* small issues, and so it is mostly by habit > that I don't use constant. I would consider changing, but it would > mean asking everyone using the code to change too, because they > currently import and use the constants as Exported scalars. > > Do you know of a very important reason to break compatibility and > force the switch? I'm not opposed to switching if I have to, but I'd > like to minimize the impact on the users. > > > - you probably should either append the userid of the process to > > /tmp/FileCache or make this folder globally writeable (and set the > > sticky flag). Otherwise other users get a permission error. > > As of version 0.03, the cache directories, but not the cache entries, > are globally writable by default. Users can override this by changing > the 'directory_umask' option, or keep data private altogether by > changing the 'cache_root'. What version did you test with? There may > be a bug in there. > > > - why don't you use Storable.pm? It should be much faster than Data::Dumper > > The TODO contains "Replace Data::Dumper with Storable (maybe)". :) > > The old File::Cache module used Storable, btw. > > It will be trivial to port the new Cache::FileCache to use Storable. > I simply wanted to wait until I had the benchmarking code so I could > be sure that Storeable was faster. Actually, I'm not 100% sure that I > expect Storeable to be faster than Data::Dumper. If Data::Dumper > turns out to be about equally fast, then I'll stay with it, because it > is available on all Perl installations, I believe. > > Do you know if Storeable is definitely faster? If you have benchmarks > then I am more than happy to switch now. Or, do you know of a reason, > feature wise, that I should switch? Again, it is trivial to do so. I've found it to be arround 5 - 10 % faster - on simple stuff on some benchmarking I did arround a year ago. Can I ask why you are not useing IPC::Sharedlight (as its pure C and apparently much faster than IPC::Shareable - I've never benchmarked it as I've also used IPC::Sharedlight). Greg > > > >I have some preliminary benchmark code -- only good for relative > > >benchmarking, but it is a start. I'd be happy to post the results > > >here if people are interested. > > > > Could you send me the code?, then I'll look into benchmarking my > > module too. > > I checked it in as Cache::CacheBenchmark. It isn't good code, nor > does it necessarily work just yet. I simply checked it in while I was > in the middle of working on it. I'm turning it into a real > benchmarking class for the cache, and hopefully that will help you a > little bit. > > Cheers, > > -DeWitt
Re: Translation handler continuous loop problem
"Sinclair, Alan (CORP, GEAccess)" wrote: > > I am hoping someone might have a clue on how to resolve this awkward > problem. > > I have just installed a mod_perl URI translation handler to extract a > session id from the URI. In general the translation works correctly by > removing the session id from the URL when detected. However, a Netscape > browser client triggers Apache to enter a continuous loop if I do not > specify the domain name in the hostname component of the URL. The problem > does not occur in Internet Explorer (that surprised me.) > > All these examples are from Nestcape on both NT and Unix. > For example, say I enter http://lions.access.com/sp9/outage.html The > translation handler works correctly. > If I then enter: http://lions/sp9/outage.html There is a continuous loop in > Apache and on each iteration, an entry is written to access_log. I have to > stop the request in Netscape. > > The bizarre thing is I can enter any other URL such as > http://lions/internal/whatever and there is no problem. The mod_perl > translation header goal is stripping session id info from the URL in the > form http://hostname/SESSION_ID/sp9/whatever It looks for sp9 in the path. I > have attempted to debug by trying to send error messages to the error log > without success. > > Does anyone have any suggestions on how I can determine why the translation > handler is entering into a continuous loop when a request is sent from > Netscape? > > I would be appreciative of any help!! I could be completely wrong but ... I can't see a problem here - although I would need to see the code. There could be an issue with how IE and Netscape actually format the header (i.e you may enter the above, but the header that gets sent may be different) - but I could be completely wrong on this ! You may wish to look at http://sourceforge.net/projects/sessionmanager/ Which is URI transhandler / session manager that I wrote for a project that never came about. I may make another release that uses PerlSetVars to configure the module if I get a chance to test it. If this does not help, then post either the code, or a URL to the code if its long, so that some of us can have a look. Greg > > Env is: Solaris 2.6 Apache 1.3.14 mod_perl 1.24_01
Perl / DBI Job - Telecommute - Full Time
We have a ground floor opening for a perl programmer for a TELECOMMUTING situation for web/wireless/telecom system development. Requirements: Strong Perl 5 experience SQL database knowledge Experience: CGI is a big plus Unix/Linux is a plus mod_perl apache servers are a plus DBI database experience is a big plus The company is a startup focusing on the transportation industry. The position is for direct employment and stock options. The company management has had great success launching and selling web sites in the past (last 3 companies sold for about $85 million) We have done a lot, but have many fun projects remaining like XML interfaces, WML/WAP, Interactive Voice Response (IVR), FAX gateways, Linux, and many interesting business processes to automate. Please respond with: resume $salary requirements example web sites if available sample perl code Thank you, Greg http://www.CargoTel.com/
Whats the status of libapreq-32 ?!
Dear All I can rememeber that Jim Winstead was overhauling libapreq and sugested that ver 0.32 may be out early in the new year if OK, is this still the case ? Greg
Re: [JOB] another bloke for hire...
Matt Sergeant wrote: > > If anyone has any spare tuits they want to donate to Take23, we have > started the job postings stuff and have a spec for exactly what we want, > but not really enough time to code it up. Experience with AxKit would be a > huge bonus, otherwise you'll be right in at the deep end. > Matt, I've been looking at this - not alot, but a bit (as I am in the deep end, and there is only so much XML I want at a time ;-) A few minor issues: Your NewsAdmin module appears to assume that all XML file under the doc root are news XML files - how do you want to deal with this - I'll change the last bit of the doc root (defined line 11) from news to jobs. Also what sort of validation do you want on job posting - at the mo we just upload a file, and edit the XML, I am happy posting jobs like this, but what about t'others ? I can write a kludgy form that accepts / validates input and creates some XML as per discussions if thats what you want ? Greg > -- > > > /||** Director and CTO ** >//||** AxKit.com Ltd ** ** XML Application Serving ** > // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** > // \\| // ** Personal Web Site: http://sergeant.org/ ** > \\// > //\\ > // \\
Re: Upgrading mod_perl on production machine (again)
Bill Moseley wrote: > > This is a revisit of a question last September where I asked about > upgrading mod_perl and Perl on a busy machine. > > IIRC, Greg, Stas, and Perrin offered suggestions such as installing from > RPMs or tarballs, and using symlinks. The RPM/tarball option worries me a > bit, since if I do forget a file, then I'll be down for a while, plus I > don't have another machine of the same type where I can create the tarball. > Sym-linking works great for moving my test application into live action, > but it seems trickier to do this with the entire Perl tree. > > Here's the problem: this client only has this one machine, yet I need to > setup a test copy of the application on the same machine running on a > different port for the client and myself to test. And I'd like to know > that when the test code gets moved live, that all the exact same code is > running (modules and all). > > What to do in this situation? > > a) not worry about it, and just make install mod_perl and restart the server > and hope all goes well? Hum ignoring problem means that will bite you ! > > b) cp -rp /usr/local/lib/perl5 and use symlinks to move between the two? > When ready to move, kill httpd, change the perl symlinks for the binary, > perl lib, and httpd, and restart? This is what I would do. depending on present set up I would install all the above in a "new" location - and then symlink to it. Yup this does mean a few more disk stat's, but means I can roll back most installs very quickly if required. Having said that I have not done it too often on an alien box. Also is the present perl easily simlinkable (i.e the binary and the lib tree). I just play with the --prefix and usually do --prefix=package_version (eg apache_perl_1.3.14 would be a mod_perl apache version 1.3.14). Also you could script the change over if required to be xtra quick (although this is getting silly) I've used this without any issues on Linux boxes for 18 months, but I am very conservative about my perl (i.e I'm still on 5.005_03 and waiting for 5.6.1 ;-) > > c) setup a new set of perl, httpd, and my application and when ready to go > live just change the port number? > > Or simply put - how would you do this: > > With one machine I want to upgrade perl to 5.6.0, upgrade your application > code, new version of mod_perl, and allow for testing of the new setup for a > few weeks, yet only require a few seconds of downtime to switch live (and > back again if needed)? > > Then I wonder which CPAN module I'll forget to install... do a CPAN snapshot bundle of a known good install, and install that - easy no ? Just my 2 euro worth. Greg > > Bill Moseley > mailto:[EMAIL PROTECTED]
[JOB SEEKER] Freelancer / contractor based in England (S.E)
Dear All I will be "available" soon for contract (tele-commuting) / freelance work. My skills include perl obviously! (mod_perl, OO, modules, and DBI), Apache, MySQL, Linux, Solaris, qmail, DNS, and iffy Sybase / Oracle. I've been doing the usual CGI work and some mod_perl dynamic content / custom handlers. Also I been doing custom emailing, SMS server work, and Sys admin (Linux and Solaris) I can make meetings in London / South East (England, UK) if required. URL's / code samples / references / CV etc available on request. Thanks, Greg Cope
Re: Book/code recommendations needed for an urgent mod_perrl task
Peter Demling wrote: > > Greetings from a 1st-time poster, > > I'm a seasoned web programmer, but a Perl beginner and > mod_perl stranger who has an "as soon as possible" > mod_perl script to write for our Apache web server, so > I'd appreciate any recommendations for books or code > you may have, which could assist me in my task. What > I have to do is as follows: > > Write a mod_perl script which will: 1] be invoked > (with parameters) by a web client; 2] use its input > parameters to construct an SQL statement; 3] query an > Oracle database on a seperate machine with the > constructed SQL statement; 4] use the returned query > results to set the values of some variables; 5] use > these variables to construct HTML output, and send it > back to the web client. > > I'm a quick-read, so as a Perl beginner who wants to > keep the script as simple as possible, I'm assuming > that "Learning Perl" is the best text for me, but does > anyone think that "Programming Perl" OR "The Perl > Cookbook" might be a better choice? I'm also thinking > that "Writing Apache Modules with Perl and C" will be > neccessary, but perhaps the online mod_perl guide > would be sufficient? IMHO Learning Perl is a little basic for someone with a bit of programming experience - if you have little experience then read it. Apache Modules in Perl & C has is some excellent book - and has some good examples. I find the Cookbook excellent for the answer to the "How do I do XXX ?" questions. Read the Guide - period ! > > Last, I'm assuming that the basic structure of this > databse-driven web script is fairly common, so any > pointers to relevant code I could base this on would > be greatly appreciated. >From the above you will have lots of examples to choose from. Greg Cope > > Sincerely, > -Peter Demling > Amherst, MA > [EMAIL PROTECTED] > > __ > Do You Yahoo!? > Yahoo! Photos - Share your holiday photos online! > http://photos.yahoo.com/
Re: cookies cookies cookies
John Hurst <[EMAIL PROTECTED]> writes: > At 01:47 PM 12/12/00, Joshua Chamas wrote: > Greg Stark wrote: > > > > How do I reliably remove a cookie from a browser's memory? > > Then Josh said: > > What about setting the cookie with an expires date in the past? > > $Response->{Cookies}{YourCookie} = { > > Value => '', > > Expires => -86400, > > }; Having actually gone and read the spec, yes you're supposed to set the expire time to a time in the past. This apparently is true even if the original cookie had no expire time. Leaving an interesting situation when you aren't sure you can trust the clock on the browser... > In most cases, this will only work for a cookie that is an _exact_ > match with the one you wish to expire. This is really hard to do > if your code didn't write the cookie, since most browsers will use > the 'path' and 'domain' values to evaluate exactness, but do not > send those values to you in a request, obscuring them. > > While writing a cookie handling library, I found it necessary to > trash my cookies file when things got weird, since writing code > to remove cookies that were the result of bad code seemed a waste > of time. Once it was stable it worked rather well, assuming that > calls to the library were consistent about 'path' and 'domain'. Well this is actually similar to my situation. I'm trying to remove cookies a browser has picked up from a previous system and put in a new set of cookies. This means I want to remove cookies regardless of what domain and path they have. At least in my case there's only a finite set of possibilities. > Unless you're required to use 'path', I recommend that you explicitly > set 'path' to '/' on all set cookie operations, and similarly make > use of a canonical 'domain' value. Then it will be easy to construct > 'kill cookies'. Otherwise, you'll have to construct logic to determine > the right 'path' and 'domain' for a particular cookie (yech). In my experience the Path setting on cookies isn't supported on some browsers. I suggest having all the pages that share a cookie actually use the same URL prefix, preferably simply "/". Anything else, even if you're within the spec won't work on some systems. (Notably some versions of one that shall remain unnamed but it rhymes with "teevee".) -- greg
Re: Mod_perl tutorials
Nathan Torkington wrote: > > J. J. Horner writes: > > What is the story on these tutorials? Is it something you can > > distribute, or did most of it come off of the top your head? > > Tutorials seems like a deadend for effort. I've had zero (0) > responses to my offer of my "Introduction to mod_perl" tutorial. I'd be interested - although I hope I am beyond that stage now ;-). I would like to see these sorts of things and "success stories" - how ever short in the web to do a bit of advocay and (hopefully) attract more developers (and mindshare). Subliminal hint - www.take23.org > > If nobody's interested in increasing the number of mod_perl > programmers through tutorials, then the only other option I can think > of is strategically-placed success stories. agreed. > > I know that perl.oreilly.com is making a point of collecting Perl > success stories and is always hungry for more. They won't convert > the unwashed there, though. > > It'd sure be nice to have a WebTechniques special issue on mod_perl. > Hint, hint, Randal :-) nudges from here as well ;-) Greg > > Nat
Re: Article idea: mod_perl + JSP
Chris Winters wrote: > > * Gunther Birznieks ([EMAIL PROTECTED]) [001212 23:53]: > > > ... > > > > A well-specified app is always easier to code regardless of Java or Perl. > > Over the years I've become more of a fan of seeing the benefits of good > > software engineering than really thinking a particular language is a silver > > bullet. > > Yes -- it really comes down to what a company uses already and what > it's being used for. My company is developing from scratch a web-based > front end to a Visual Basic/SQL Server application. We could certainly > do it faster in Perl (that's just because our Perl background is much > stronger than our Java background), but having a Java-based solution > is sexier and therefore more marketable than a Perl-based > solution. (We are in business to make money, after all.) Is that a > legitimate reason? I think so, but it's certainly a grey area. > > > With that said though, I still love Perl. > > Me too :-) It's frustrating to be doing something in Java that would > take a much shorter time in Perl. But then there are things in Java > that are simpler than Perl as well. > Appologies if I am butting in - but what you apppear to say here is that you are using JAVA because its sex / marketdriods know of it, yet perl would be the quicker (and hence cheaper solution ?). Surley for this reason you should use perl and persuade the PBH of the cost benefit here ? This has hit on a point - in that may people choose Java over Perl because its sexier, which becomes self forfilling, unless we (the perl community) persaude people that (mod_)perl is sexy Greg > > Chris > > -- > Chris Winters ([EMAIL PROTECTED]) > Building enterprise-capable snack solutions since 1988.
cookies cookies cookies
How do I reliably remove a cookie from a browser's memory? I've only just begun to experiment but it seems if I set the cookie to "" or undef Apache::ASP doesn't send the right headers to remove the cookie. (Actually undef seems to corrupt the cookie). I could just write a handler to set the header appropriately but I'm not even sure what I should be putting in the header. -- greg
Re: mod_perl & IPC under Solaris 7
Steven Cotton wrote: > > Hi, > > Anyone here any good with debugging IPC "No space left on device" errors? > I can't find anything on the web or in deja, and am basically at a > loss. Using Storable 0.703 and ShareLite 0.08 I'm getting a lot of the > above errors when I have around 40 httpd children. Has anyone else used > IPC under mod_perl and had the same errors? I can't even seem to find out > what it is I'm running out of .. shared memory segments ... Different OS have different IPC limits My linux box has ipcs and ipcrm (look at the man page first). Greg Cope > > Thanks, > > -- > steven > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RFC: mod_perl advocacy project resurrection
[EMAIL PROTECTED] wrote: > > On Thu, 7 Dec 2000, Matt Sergeant wrote: > > > > > I'd love that. In fact anything that anyone had waiting to go onto > > PerlMonth please drop a mail to [EMAIL PROTECTED] and we'll get you > > published. (assuming that PerlMonth isn't going to resurrect itself) > > Actually its kinda has been resurrected. Or it will be on the upcoming > monday. There are a lot of mod_perl articles on PelrMonth and it will > continue. > > Next issue has an article by Stas and Gerald Richter. As far as articles > are concerned perlmonth.com has about 20 or so mod_perl related articles. > > I know I've kinda been absent for some time. And I want to publicly > apologize to the readers and the writers. Hurray ! Can I say thanks - I like perl month! Is the HTML::Template part 2 in there ? Is it back for "good" (good >= 3 plus months ?) Greg > > But the next issue will be out upcoming monday. > > I am also contemplating on starting www.apachemonth.com, and looking for > someone to possibly write mod_perl related articles on such topics like, > handling different phases of Apache with mod_perl, writing > PerlTransHandlers, explanations on *Handlers, stuff that is more closely > related to Apache, rather than templating solutions and such, which serve > better under PerlMonth. > > If anyone is interested in that please drop me a line or two. > > - > Baiju Thakkar > http://www.perlmonth.comhttp://www.linuxmonth.com > Just use Perl; #!/boot/linux > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RFC: mod_perl advocacy project resurrection
Stas Bekman wrote: > > Well as you've probably figured out, based on the load of email from me, > I've dropped my last job, in order to finally finish the mod_perl book, > have some rest and make a push to mod_perl. > Well best of luck & hope you have a good rest - I'll certainly buy the book! > In Paris we couldn't hire a single mod_perl programmer, because people > don't even know what that. They know a lot about php and ASP. It's true > that they don't even know what's Perl :( I think this is a general situation - sounds similar to the uk. > But, you all know that php pretty much takes over. Why? For two reasons: > 1) initial corporate pushing (press/ads) > 2) once well known, the word of the mouth does the rest. Well go back 2 / 2 1/2 years and PHP was little known. > mod_perl lucks the corporate money/PR to get pushed. But we can still work > on the exposure, which will bring corporate money/PR thru the word of the > mouth. I think your on the right track, as many other popular open source things have started this way. \> Luckily Matt has got sick of waiting for someone to work on the advocacy > of mod_perl and he has just taken over it. Having a good informational > site is good, but it's not enough. We need to solve the problem of people > to find this site and wanting to use mod_perl. Solution? Spreading the > word. > > I see two main streams: > 1) Online zines. > 2) Conferences. > > I think that we should start working on locating ezines wanting to publish > mod_perl related articles (preferrably for a fee, to give incentives for > others to write) and conferences where mod_perl can be relevant. The data > is to be collected and distributed to the people who wish to advocate > mod_perl, thru written articles and conference classes. I suppose that we > will also look for companies who want to order mod_perl classes and find > the teachers in the appropriate areas. I think may people could write simple "How to ZXY" in mod_perl. PHP has excellent resources for similar things i.e how to do this or that. Very much like the Perl Cookbook. I am not saying that mod_perl does not have these, and the guide has some excellent examples, but these are often not easy to find and will not attact people half as much as reading a single all-in one atricle. > May be we could organize some certification classes, to give more PR to > mod_perl. Not wishing to sound negative - but certification more often causes problems - MCSE's a case in point. Overall Stas I think more aticles in the general IT press be it ezines or in paper is the way to go to raise the profile. As an aside whats happening to perl month ? as this appears to be exactly the sort of thing we need. Greg > I suppose that much more can be done. Comments are welcome. > > _ > 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://jazzvalley.com > http://singlesheaven.com http://perl.apache.org http://perlmonth.com/ > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HTTP Mod_Perl mini-server
Perrin Harkins <[EMAIL PROTECTED]> writes: > On Fri, 3 Nov 2000, Vivek Khera wrote: > > Lately I've been getting very interested in using solid-state disks > > for high-performance issues. They're expensive, but if you need that > > much speed, they're worth it. > > Are they? I tried one once, and it wasn't any faster than my normal disk > because I had so much RAM it was all getting buffered already. If you > don't have enough RAM, it might help, but I suspect these are more > expensive than equivalent amounts of RAM. Solid state disks are very effective for particular applications like mail spools and database logs where the application waits for data to be flushed to disk before continuing. For most normal applications the same effect can be obtained by adding RAM and/or playing with tools like memfs. -- greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Antwort: RFC: DBI::Prof
Tim Bunce wrote: > > On Fri, Dec 01, 2000 at 09:48:34AM +, Matt Sergeant wrote: > > On Fri, 1 Dec 2000, Tim Bunce wrote: > > > > > On Fri, Dec 01, 2000 at 02:37:47AM +0100, Stas Bekman wrote: > > > > > > > > It would be much easier for Tim to do it from the inside than any of us > > > > doing the overloading hacking, but that's up to Tim to decide when if ever > > > > this should go in :) > > > > > > Things are changing for the better workwise now and I hope to get back to > > > regular DBI and DBD::Oracle (and Oracle::OCI) work early next year. > > > > You said that at TPC :-) > > Yeah, well... there are plans and there are plans :) > > I recently gave notice to the company that I've been Technical Director > of for many years that I'll be leaving in March 2001. Such big changes > of direction take time to work up to and work out smoothly. I am > specifically rearranging things so I have time for DBI related work. Very interesting. Although a bit OT, but I am sure everyone is interested, what changes are you planning for DBI ? Greg > > Tim. > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: WebDAV support in mod_perl
On Wed, Nov 29, 2000 at 09:20:49AM -0800, Ian Kallen wrote: > > Yes, I've contemplated either: > > 1) implementing the DAV protocols entirely in Perl for mod_perl > 2) gluing in XS into mod_dav -- IIRC mod_dav has hooks for non-filesystem > respositories; it'd be great just to expose that API to mod_perl (haven't > cracked open that code yet though) Yes, mod_dav has a pluggable backend. Since Perl can be embedded (i.e. apps can call into it to exec code), then you could implement a mod_dav backend in Perl. That would save you a bunch of time over trying to do all the protocol work. The mod_dav in Apache 2.0 has a better dynamic-load plugin/backend story, but mod_dav 1.0 (which is built for Apache 1.3) still has all the same features/functionality for backends. > Issues: what will be required to implement DeltaV (I need concurrent > checkouts and versioning) as well? All of this is being developed within the mod_dav as part of Apache 2.0. Through the plugin mechanism, we'll be using Subversion (SVN) (http://subversion.tigris.org/) as the backend. SVN will be using DeltaV as the network protocol, and Apache 2.0 as the network server. There is also some DeltaV work going on in the CVS version of mod_dav, with much of the same backend interfaces and code. I wouldn't call any of the mod_dav DeltaV work "cooked" though. I'm going to be testing the Apache 2.0 this week and next, for Milestone 2 of Subversion which occurs at the end of next week. M2 will be a very limited DeltaV server... but that does include checkout and versioning :-) > What's up with the expat-lite > in Apache conflicting with XML::Parser's expat? The intent is to find time to upgrade Apache to use Expat 1.95.0 and axe the expat-lite stuff. It should work fine (and part of the Expat 1.95 release was specifically to fix the Apache/mod_perl Expat conflict), but time/priority just hasn't happened yet. It should over the next couple weeks, as we're trying to nail down an Apache 2.0 beta and we want to resolve that problem. > Given a clear picture of these options and issues, I'd be more than > pleased to bang out a good Apache::WebDAV code base implementation. > -Ian > > Today, Joao Pedro Goncalves <[EMAIL PROTECTED]> frothed and gesticulated about...: > > Hi, is there any current project going on for using the WebDAV protocol > > in > > mod_perl, something like Apache::WebDAV? There is client side work at http://www.webdav.org/perldav/ > > I am familiar with the mod_dav efforts however they seem to be oriented > > to > > filesystem repositories and i would like to use WebDAV in a more dynamic > > environment such as repositories being in a database, or for supporting > > new stuff like Outlook HTTPmail, that uses WebDAV to connect to Hotmail. Oracle has built a backend for mod_dav which stores all of the content and properties into an Oracle database. It should be appearing on the Oracle Technical Network "real soon now". So... mod_dav can do it, but yes: it would be C coding rather than Perl :-) Cheers, -g -- Greg Stein, http://www.lyra.org/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Probably [OT] Are there any Simple Generic Server modules
Dear All This is a little OT - but bear with me. I am looking for a simple generic server (prefably OO) that I can use for my NON OO stuff. I have writen my own, but I am after ideas One project I've got involves getting HTML (template)files via LWP, and uploads them into an IPC cache for HTML::Template. It needs to accept signals so that Apache can HUP it to go get new templates. Using a generic server class can enable me to get the code out of apache. Any clues welcome. Thanks. Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANNOUNCE] ApacheCon USA 2001: Call For Papers
Gunther Birznieks wrote: > > At 01:58 PM 11/14/00 +0100, Robin Berjon wrote: > >At 11:22 14/11/2000 +0100, Stas Bekman wrote: > > >Just as with TPC our aim is to have a full double room track for mod_perl > > >for all 3 days. So make sure that you submit enough mod_perl material, so > > >we will have it full. > > > >I have some experience speaking before a crowd at conferences (though not > >at technical ones) or on stage and I think I know mod_perl enough to be > >able to write about several aspects of using it. The one thing I'm missing > >is inspiration :) Are there any subjects that desperatly beg to be talked > >about but have no writer/speaker ? > Speaking on just what I'd like to see... but my tastes may be a bit eclectic. > > I'd like to see a talk on templating systems and mod_perl. Hint to whomever > is watching. :) Your trying to reignight that old thread don the flame proff stuff, seriously this would be a good mod_perl thing. Matt are you going to do something on AXKit ? > > Actually I suspect case studies would be good. > > I'd also be very interested in performance benchmarks related to some of > the more sophisticated techniques people talk about (eg using IPC vs files > for storing shared data). > > > Maybe a case study on developing huge sites on mod_perl. I imagine the > system Ask works on would be an interesting engineering case study with > real world benchmarks. This would be good "advertising" and hence help when we go to a {client|boss|manager|person with pointy hair} and say look at mod_perl site XZY runs it (and hopefully they go "Ah ... your hired !" ;-). > I'd also love to see an as objective as possible talk comparing the > mod_perl 1.0 and 2.0 architectures to the Apache Java Servlet/JSP stuff. > And maybe some performance comparisons for simple stuff written in both. > Not too many people use both Java and Perl and I think most people don't > really understand how or where one should/could be used over the other. Gunter - sounds like you are talking yourself into a slot here - again this would be interesting from a PHB perspective i.e put mod_perl into context with Java. If any one is interested I could do something on Session Manager - which I've been looking at rewriting in C - but I have to learn C at the same time so its very slow Greg > > Later, > Gunther
Re: [OT] mod_perl evangelism
David Hodgkinson wrote: > > Chaps, > > In the last couple of days and on several mailing lists (MySQL for > one), I've seen people pointed to www.phpbuilder.org for answers. > > Where the hell's the mod_perl version?! Agreed. I've always thought that php had better "web support" in terms of "How to do this in php" or tutorials. mod_perl's lack of similar resources is not a bad thing. Stas was up to something similar with sourcegarden - do not know where thats upto - I think Stas has been buzy with other things. I'd help with something (sticking his head out on a block ;-) Greg > > -- > 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: Sharing vars across httpds
Perrin Harkins wrote: > > On Mon, 6 Nov 2000, Differentiated Software Solutions Pvt. Ltd wrote: > > We want to share a variable across different httpd processes. > > Our requirement is as follows : > > > > 1. We want to define one variable (which is a large hash). > > 2. Every httpd should be able to access this variable (read-only). > > 3. Periodically (every hour) we would like to have another mod_perl program to >refresh/recreate this large hash with new values > > 4. After this, we want the new values in the hash to be available across httpds > > If that's all you want to do, I would stay away from the notoriously slow > and sometimes tricky IPC modules. My dirt simple approach is to put the > data in a file and then read it into each httpd. (No point in trying to > load it before forking if you're going to refresh it in an hour > anyway.) You can use Storable for your data format, which is compact and > fast. To check for an update, just stat the file and reload the data if > it has a newer mtime. If you don't like doing the stat every time, put a > counter in a global variable and just stat once every 10 requests or > something, like Apache::SizeLimit does. If your data is too big to pull > into memory, you can use a dbm file instead. > > - Perrin Have you benchmarked this vs IPC::ShareLite ? I've heard similar rumours about IPC being slow - but is this using Shareable (a pure perl implementation) or ShareLite (C / XS implentation). I would be interested in any results / ideas on how to do it. Greg
Re: database access
Jason Liu wrote: > > Is Apache::DBI absolutely necessary if you want to establish persistent > database connection per child? No you can write your own (its open source remember ;-) but why bother - standing on the shoulders of giants etc .... Greg > > Thanks, > > Jason > > > -Original Message- > > From: David Hodgkinson [mailto:[EMAIL PROTECTED]] > > Sent: Monday, November 06, 2000 5:10 AM > > To: Jason Liu > > Cc: [EMAIL PROTECTED] > > Subject: Re: database access > > > > > > "Jason Liu" <[EMAIL PROTECTED]> writes: > > > > > In general, how should database connections be handled between > > parent and > > > child processes? Can you establish database connections from within a > > > handler? > > > > Absolutely. And using Abache::DBI caches the connection handle. > > > > -- > > 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: input from external process
Eric Smith wrote: > > Hi > > Is it possible to have an existing mod_perl application read from an > external process? The case in point is procmail piping mails to the > mod_perl application. With high volumes of email, we would prefer not > to have to launch the perl interpreter each time to perform the tasks > specified by the incoming email. > > Nasty way of effecting this communication is to have each mail message > saved to a file and do a readdir every time interval. > > Is it possible to have the mod_perl process listen on a socket (or > something) that procmail may write to? Why not write a perl server that lisens to a socket ? Regards Greg Cope > > -- > Eric Smith > Fruitcom.com Amsterdam > Wire phone : +31 20 528 7340 > Mobile: +31 6 241 259 16 > www.fruitcom.com
[ NOW OT ] Re: HTTP Mod_Perl mini-server
Perrin Harkins wrote: > > On Fri, 3 Nov 2000, Vivek Khera wrote: > > Lately I've been getting very interested in using solid-state disks > > for high-performance issues. They're expensive, but if you need that > > much speed, they're worth it. > > Are they? I tried one once, and it wasn't any faster than my normal disk > because I had so much RAM it was all getting buffered already. If you > don't have enough RAM, it might help, but I suspect these are more > expensive than equivalent amounts of RAM. > > - Perrin A bit OT but: Do they help with STATing of files ? as this appears to be a bottle neck on some of my machines (i.e stating on the disks) Greg
Re: dynamic vs. mostly static data
Matt Sergeant wrote: > > On Thu, 2 Nov 2000, Neil Conway wrote: > > > I'm writing a web app in mod_perl, using a PostgreSQL database > > backend and HTML::Template. In looking for ways to optimize > > performance, I noticed that although my code is doing several > > (say, 4-5) database queries per handler/webpage, a large part > > of the data (~2 queries) is mostly static (it will change > > perhaps once per week, or once per month). It's obviously > > inefficient to run these queries on the database for every > > single request. > > > > How can I 'cache' this data so that all Apache children can > > access it quickly? Is there a way to automatically update > > this cache periodically (say every 10 minutes)? Also, this > > solution should work on any reasonably modern UNIX system > > (Win32 is not important for now). > > Along with all the other fine suggestions here, you might like to check > out the Memoize module on CPAN. I don't think it yet offers a way to > invalidate the cache, but I know that is planned. What about IPC::SharedCache ? This should allow you to cache stuff in IPC and updateit from outside apache via a crond job ? just my 2 euro's worth. Greg > > -- > > > /||** Director and CTO ** >//||** AxKit.com Ltd ** ** XML Application Serving ** > // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** > // \\| // ** Personal Web Site: http://sergeant.org/ ** > \\// > //\\ > // \\
Re: [ ANNOUNCE ] Apache::SessionManager-0.07
Dave Rolsky wrote: > > On Mon, 30 Oct 2000, G.W. Haywood wrote: > > > If you can write Perl you can write C, there are onlya couple of dozen > > keywords. It's just that you're not so mollycoddled in C, you're much > > closer to the machine, and you have to plan further ahead (instead of > > waiting for the bang:). I prefer it. > > I think you're forgetting about little things like regexes and such. Yes, > Perl and C share a lot of syntax, but there are many things you can do > easily in Perl that are brutal in C. I agree but apache has regex.h ... a regex libary - hence these should be possible - or am I missing the point ? Greg > > -dave > > /*== > www.urth.org > We await the New Sun > ==*/
Re: [ ANNOUNCE ] Apache::SessionManager-0.07
"G.W. Haywood" wrote: > > Hi there, > > On Mon, 30 Oct 2000, Greg Cope wrote: > > > In theory there is no reason why this should not be translateable to C, > > it is quite small (in perl). > > However: > > a) I cannot do C (and translating this is beyond me as a learning > > exercise at the mo). > > b) Also waiting is a good idea till all the bugs are sorted. (I am sure > > there are more). > > I think it's right to turn things like this into C. I'll help you > with it if you like, but I think you're right about waiting until the > design is stable before doing it. > > If you can write Perl you can write C, there are onlya couple of dozen > keywords. It's just that you're not so mollycoddled in C, you're much > closer to the machine, and you have to plan further ahead (instead of > waiting for the bang:). I prefer it. Thank you Ged. I have been meaning to learn C (along with lots of other things). Any good books to recommend - I've got practicle C from O'Reilly - I need something that is not too dry and manpage ish, but also not an idiots guide as I can do perl (well I think I can). I've been toying with the idea of C as this would push it out of the mod_perl areana. The logic of it is quite simple. But for a beginer it look all to complex. Plus there is the minor issue of time ! Thanks again for the offer of help, I may take you up on that. Greg > 73, > Ged.
Re: [ ANNOUNCE ] Apache::SessionManager-0.07
Gunther Birznieks wrote: > > At 01:31 AM 10/30/2000 +, Greg Cope wrote: > >[...snip...] > > > > > > And don't forget about the use of DirectoryIndex: > > > GET /index.html http/1.0 > > > > > > HTTP/1.1 302 Found <<== here's your redirect > > > > > > Now this gets through: > > > GET / http/1.0 > > > >Hum ... > > > >Nice one - I had not tried this It took me a while to trap a '/' > >request (it would go into an endless loop and blow out when the GET > >request topped 4k, mostly full of session ID's). > > > >Not sure how to fix this - ideas anyone ? > > > >I do the following to trap a '/' style request - this is where I am > >losing the /index.html (that's getting turned into a simple '/'). > > > >if ($redirect !~ m#/$# && -d $r->lookup_uri($redirect)->filename) { > > $redirect .= '/'; > > } > > > >Is this a major issue ? (as apache should if I am not mistaken turn that > >back into an index.html or whatever is the directory index directive) > > This is an issue if your index.html requires the session id. So if you > direct to / you'll lose it. It's not bad if index.html is static, but it > could be generated via a handler or perhaps it's an index.cgi This should work (i think I test this case - cant remember) with just '/' as it just adds the '/' on - i,e you keep the session ID. My brain is stuck on the implications of this at the mo - I cannot see the "issue". The behavour appears wrong as the redirect is not right, yet it seems to come out in the wash . Any ideas on what needs to be done - Gunther ? Bill ? > > >As apache has yet fully to do the URI translation I apear to be missing > >this an assuming its a '/' on its own ?!?! > > > > > > > > HTTP/1.1 200 OK > > > > > > I'm also unclear about excluding some files with $NON_MATCH. Perhaps I > > > didn't set it up correctly. > > > > > > If the session is in the URL, and a browser uses relative links it will try > > > to use that session for all links. So if $NON_MATCH is used to ignore > > > .gif, for example, I see this: > > > > > > File does not exist: > > > /usr/local/apache/htdocs/f0d960ddbbe1e82ca55ed2372447751e/apache_pb.gif > > > >I wondered on this for some time - as I use a new virtual host for > >static content {gif|jpeg|js|css} files (with logging turned off). > > > >Err - on this point I am a plank and offer my apologies - a few '#' too > >many and this functionality no longer works - whops > > > >In the meantime remove the hashes that > >comment out the lines between 48 and 51 inclusive, also in the source is > >a line: > > > >$NON_MATCH = '\.gif|\.jpeg|\.jpg';# ignore images > > > >So if you only want gifs try: > > > >$NON_MATCH = '\.gif'; > > So what is the logic here? You must always process an existing session id > for images because they will be in the path, but you just shouldn't > generate the session id if one does not exist for these mime types. The module does a simple regex on DIR_MATCH and DECLINES if there is no match. If there is a match it then checks NON_MATCH and DECLINES if there is a match here (i.e if we want to avid these hence NON_MATCH). This was easier for me that to make a complex regex that matched this, but not that etc ... The logic is to not session these matches as they are not need. If you keep your images on a different Vhost, or in a diferent dit (that DIR_MATCH does not match and is hence ignored) then you do not need this. If you keep your images in the same place as the stuff you want to session - then you may be interested. It occurred to me whilist writing this module that there are manu permutations (TMTOWTDI) and hence this was writen for the above combo. Personnaly I do not use it. > > > You might consider moving some of your code into other handlers later in > > > the request and just let the transhandler extract out the session id. That > > > way you can use and friends to configure what requires a > > > session and what doesn't, and you can use PerlSetVars to control behavior > > > section-by-section in httpd.conf. > > > >Gerald has already suggested this - I was thinking of controlling > >directory access via the match variable. Why ? well perlset var gets > >checked each request - performance wise a little nasty. This is however > >due to most of m
[ ANNOUNCE ] Apache::SessionManager-0.07
Bill Moseley wrote: > > At 05:24 PM 10/29/00 +, Greg Cope wrote: > >Announcing Apache::SessionManager. > > Hi Greg, > > Here's a couple of other comments. I should have mentioned that this was my first bit of public code - and to be gentle .. > > Don't forget to keep track of args on redirects: > > GET /a5cc39a8c110566e41b5b8efafc2a055/index.html/abc/123?query=abc http/1.0 > Cookie: SESSION=cb74254c1de96365e91fa6d6d481f952 > > HTTP/1.1 302 Found > Date: Sun, 29 Oct 2000 18:28:54 GMT > Server: Apache/1.3.14 (Unix) mod_perl/1.24_01 > Location: /index.html/abc/123<<<<=== lost the args here. I thought I had this covered ages ago. ... I've just tried this on my set up and I do not lose the args e.g. Netscrape 4.75 on Linux / Redhat switch cookies off in preferences - redirect on: get Cart/cat?foo=bar redirect to: get /{insert session id here}/Cart/cat?foo=bar But I was not checking COOKIE_CHECK A few minutes later that should be fixed ... I have not being doing a COOKIE_CHECK style redirect against a foo.html?arg=bar style get request - all mine have been simple HTML pages. Thanks. > > And don't forget about the use of DirectoryIndex: > GET /index.html http/1.0 > > HTTP/1.1 302 Found <<== here's your redirect > > Now this gets through: > GET / http/1.0 Hum ... Nice one - I had not tried this It took me a while to trap a '/' request (it would go into an endless loop and blow out when the GET request topped 4k, mostly full of session ID's). Not sure how to fix this - ideas anyone ? I do the following to trap a '/' style request - this is where I am losing the /index.html (that's getting turned into a simple '/'). if ($redirect !~ m#/$# && -d $r->lookup_uri($redirect)->filename) { $redirect .= '/'; } Is this a major issue ? (as apache should if I am not mistaken turn that back into an index.html or whatever is the directory index directive) As apache has yet fully to do the URI translation I apear to be missing this an assuming its a '/' on its own ?!?! > > HTTP/1.1 200 OK > > I'm also unclear about excluding some files with $NON_MATCH. Perhaps I > didn't set it up correctly. > > If the session is in the URL, and a browser uses relative links it will try > to use that session for all links. So if $NON_MATCH is used to ignore > .gif, for example, I see this: > > File does not exist: > /usr/local/apache/htdocs/f0d960ddbbe1e82ca55ed2372447751e/apache_pb.gif I wondered on this for some time - as I use a new virtual host for static content {gif|jpeg|js|css} files (with logging turned off). Err - on this point I am a plank and offer my apologies - a few '#' too many and this functionality no longer works - whops In the meantime remove the hashes that comment out the lines between 48 and 51 inclusive, also in the source is a line: $NON_MATCH = '\.gif|\.jpeg|\.jpg';# ignore images So if you only want gifs try: $NON_MATCH = '\.gif'; > > You might consider moving some of your code into other handlers later in > the request and just let the transhandler extract out the session id. That > way you can use and friends to configure what requires a > session and what doesn't, and you can use PerlSetVars to control behavior > section-by-section in httpd.conf. Gerald has already suggested this - I was thinking of controlling directory access via the match variable. Why ? well perlset var gets checked each request - performance wise a little nasty. This is however due to most of my projects being a easy to split on a URI '/foo/' entry i.e I know which parts of a URI need sessioning as it were. I was going to go for a perlset var as per Gerald Suggestions - but am having secound thoughts - What do you|everyone think - using globals (a la Apache::DBI style) is not as clean, but easy and fast whilst perlsetvar is slower yet better to configure. > Hope some of this helps. Yup, you spotted a few bugs I had not seen - thanks > > Have fun, Define fun ;-) I have found this one of the most rewarding coding exercises recently - why: a) Its complex. b) Having all the mod_perl people have a go at breaking it (which they have done ! ) c) fixing it - which is has thus far been quite eaay (famous last words ;-) I'll be uploading a version 0.07 with the fixes outlined above. Thanks Bill, much appreciated as you have tested it in ways that I had not thought of (and I've tried a few), hopefull v 0.07 should fix most of the above. Thanks again. Greg > > Bill Moseley > mailto:[EMAIL PROTECTED]
[ ANNOUNCE ] Apache::SessionManager-0.06
Dear All I've finally got a tar ball onto sourceforge (but that's another [OT] story ;-) Announcing Apache::SessionManager. For those that do not know this is a (near) Transparent Session Manager module - it will get (and optionally set) a Session ID from a client request. It does no more that this with the ID - authenticating it / checking validity is up to you. It is supposed to compliment Apache::Session, which can be used as the backbend session store. It has some perldoc in the Apache::SessionManager.pm file. There is an example startup.pl in the example dir. of the tar ball. It is quite configurable in that you can change its behaviour to taste - see the perldoc / source. It works in my development environment. It is BETA and the API may change. Use it at your own risk! The usual warranty applies - in that if it breaks please send any bits to /dev/null, and any patches / bug fixes to me! Please send me any feedback directly. A BIG thank you to all that have help / sent me feedback / ideas, and also to Doug for mod_perl and the Apache and perl authors. Oh, Find it here: http://sourceforge.net/projects/sessionmanager/ Regards Greg Cope
Re: [ RFC ] New Module Apache::SessionManager
Gunther Birznieks wrote: > > How long have you been a member of sourceforge and when was the project > created? 7 days ago I am the admin - its called - wait for the great supprise - Session Manager > > Sometimes it takes changes (eg giving you access to the project directory > with write permissions) the famous 6 hour wait for their cluster of > machines to get up to date. > > You know that you are the default project admin, but if I remember > correctly you have to give yourself write privileges to the project just > like anyone else in the project list there. > > Anyway, we've had similar issues with SourceForge. As a FAQ, it sounds OK > to have a wait like that, but in practice it does get frustrating. However, > in the end, it's a lot easier to have the CVS infrastructure hosted > somewhere else cuz it's a pain in the ass to set up CVS for anonymous > access securely and then all the tools surrounding it (eg cvsweb) and keep > them up to date as security patches come out. > > With that said though, I think their support has been responsive to us for > a free service. We've usually had 24 hour turnaround on any question > (except no answer on weekends -- but I've never had a high priority support > issue to warrant that). No I've np argument with the service at all its great. It could do with a few obivious points like "Go here to add a description" if $description == undef && user eq 'admin' . I've managed to add a description etc ... but as yet have not mastered uploading a file Although this is not mod-perl related - because its about sourceforge - I am trying to sort out a mod perl module hence any clues as to how to upload a file would be welcome. Greg > > Later, > Gunther > > At 12:53 PM 10/29/00 +, Greg Cope wrote: > >Matt Sergeant wrote: > > > > > > On Wed, 25 Oct 2000, Gerald Richter wrote: > > > > > > > I have three anonations: > > > > > > > > 1.) > > > > > > > > $r->header_out(Location => $r->uri()); > > > > > > > > Also this code works with most browsers it doesn't conform to the HTTP > > > > specs. A location header must include a host part. Shouldn't be to > > hard add > > > > something like > > > > > > > > $r->header_out(Location => 'http://' . $r -> server -> server_hostname . > > > > $r->uri()); > > > > > > + port too. > > > >Ok > > > >I've not had a chance to play with anything as I recovering from a > >rather long week > > > >On another note I've had little success with Sourceforge - I've set a > >project up but cannot seem to login to FTP nor upload a CVS snapshot, > >nor add a description . I've been in touch with support and am > >awaiting more news. > > > >Hence is it worth a CPAN entry ? (I've not got an account ) > > > >Anyway thanks for the tips. > > > >Greg > > > > > > > > -- > > > > > > > > > /||** Director and CTO ** > > >//||** AxKit.com Ltd ** ** XML Application Serving ** > > > // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** > > > // \\| // ** Personal Web Site: http://sergeant.org/ ** > > > \\// > > > //\\ > > > // \\ > > __ > Gunther Birznieks ([EMAIL PROTECTED]) > eXtropia - The Web Technology Company > http://www.extropia.com/
Re: [ RFC ] New Module Apache::SessionManager
darren chamberlain wrote: > > Greg Cope ([EMAIL PROTECTED]) said something to this effect: > > > $r->header_out(Location => 'http://' . $r -> server -> server_hostname . > > > $r->uri()); > > > > Seems easy - will add it in. > > It's not that simple, of course -- you need to maintain port numbers and > all that. I recommend using Apache::URI -- create a new Apache::URI object, > set its attributes from the Apache object, and then call unparse on it. I don't see the complication - this appears to work ok: my $uri = Apache::URI->parse($r); # hostinfo give port if necessary - otherwise not my $hostinfo = $uri->hostinfo; my $scheme = $uri->scheme . '://'; $redirect = $scheme . $hostinfo . '/'. $session_id . '/' . $rest . $args; This should always give the following redirect URI: http://www.foo.com/456456456456456/orginal_request.hmtl the scheme and port changing as neccessary. The only possible issue is if the hostname / scheme containt duff (un uencoded) chars - which appears illogical to me. Greg > > (darren) > > -- > In the fight between you and the world, back the world.
Re: [ RFC ] New Module Apache::SessionManager
Matt Sergeant wrote: > > On Wed, 25 Oct 2000, Gerald Richter wrote: > > > I have three anonations: > > > > 1.) > > > > $r->header_out(Location => $r->uri()); > > > > Also this code works with most browsers it doesn't conform to the HTTP > > specs. A location header must include a host part. Shouldn't be to hard add > > something like > > > > $r->header_out(Location => 'http://' . $r -> server -> server_hostname . > > $r->uri()); > > + port too. Ok I've not had a chance to play with anything as I recovering from a rather long week On another note I've had little success with Sourceforge - I've set a project up but cannot seem to login to FTP nor upload a CVS snapshot, nor add a description . I've been in touch with support and am awaiting more news. Hence is it worth a CPAN entry ? (I've not got an account ) Anyway thanks for the tips. Greg > > -- > > > /||** Director and CTO ** >//||** AxKit.com Ltd ** ** XML Application Serving ** > // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** > // \\| // ** Personal Web Site: http://sergeant.org/ ** > \\// > //\\ > // \\
Re: ApacheCon report
Matt Sergeant wrote: > > On Sat, 28 Oct 2000, Greg Cope wrote: > > > Matt Sergeant wrote: > > > > > > http://modperl.sergeant.org/ApacheConRep.txt > > > > > > Enjoy. > > > > Thanks for that Matt, I did enjoy it - IBM's party coninciding with Suns > > keynote made me chukle ;-) > > > > I eventually could not make the conferance due to a nasty deadline > > > > Did Doug mention when mod_perl 2.0 would / maybe / migh possibly be > > ready (I know, I know that it will be ready when its ready, only > > asking!) > > Unfortunately I had to run (I had a beer with my name on it) before > getting chance to speak to Doug again. But it also depends a *lot* on the > progress of Apache 2.0, which is really holding mod_perl 2.0 up, from what > I can tell. But once that's out of the way, I don't think anything is > stopping mod_perl 2.0 progress - Doug seems to be able to move pretty > quickly on things, as he has a good idea where he's going with the > project. Sounds sooner than I though - great. Doug and Ryan appear to work for the same company - Covalent - so Doug should go bend Ryans ear - I want my mod_perl 2.0 ;-) Thanks again Matt. Greg > > -- > > > /||** Director and CTO ** >//||** AxKit.com Ltd ** ** XML Application Serving ** > // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** > // \\| // ** Personal Web Site: http://sergeant.org/ ** > \\// > //\\ > // \\
Re: ApacheCon report
Matt Sergeant wrote: > > http://modperl.sergeant.org/ApacheConRep.txt > > Enjoy. Thanks for that Matt, I did enjoy it - IBM's party coninciding with Suns keynote made me chukle ;-) I eventually could not make the conferance due to a nasty deadline Did Doug mention when mod_perl 2.0 would / maybe / migh possibly be ready (I know, I know that it will be ready when its ready, only asking!) Greg > > -- > > > /||** Director and CTO ** >//||** AxKit.com Ltd ** ** XML Application Serving ** > // ||** http://axkit.org ** ** XSLT, XPathScript, XSP ** > // \\| // ** Personal Web Site: http://sergeant.org/ ** > \\// > //\\ > // \\
Re: [ RFC ] New Module Apache::SessionManager
Gerald Richter wrote: > > Hi Greg, > > > > > I also hot heard anything back from the poeple I sent a copy to, I can > > hence only assume that its so good that it's made them speachless ;-) > > > > That's more a matter of time, then a matter of speach... I am up against a deadline and hence will be a little short - but this is excellent. > Greg, I have taken a look at your module and the code and I think it is > really worth publishing it. > > I have three anonations: > > 1.) > > $r->header_out(Location => $r->uri()); > > Also this code works with most browsers it doesn't conform to the HTTP > specs. A location header must include a host part. Shouldn't be to hard add > something like > > $r->header_out(Location => 'http://' . $r -> server -> server_hostname . > $r->uri()); Seems easy - will add it in. > 2.) You use global variables for configuration. While this is fast and easy > your aren't be able to have different configurations for different > directories or virtual hosts. From my point of view this is a must! I want > to only run SessionManager for certain directories and are able to use > different configurations for different applications. > > I would highly recomend to use PerlSetVar for configuration. Ok - will require some changes - will add these. > > 3.) You have a hard coded make_session_id function. This function should be > customable i.e. calling a user defined function which returns a new session > id and there should be some way to interact with Apache::Session which > already have a (configurable) class that generates session ids. Before the > session id is send out to the browser, there must be some way to check if it > is valid i.e. doesn't already exists, because it can't be (easily) corrected > afterwards. I had orgininally though of this, and decided against as this was simpler. My orgininal thoughts were to: a) keep it very small (the whole thing => fast) b) Keep it very simple The logic is that this module just gets the session ID and other handlers / modules authenticate that session ID. If it is wrong then you need to either change the cookie or redirect to a different ID (if no cookies are set). I can see that adding a call back to a user defined subroutine that returns a Session ID would be possible. Adding in a link to Apache::Session would also be possible. As I wrote above I am up against a deadline and will not be able to do anything till next week - I will impliment the above in the order they are writen as they are in simplest -> complex ity order. Thanks Gerald for the feedback above - much appreciated (even if there are quite a few good ideas that involve changes !) Thanks again Greg > > Gerald > > - > 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: [ RFC ] New Module Apache::SessionManager
Gunther Birznieks wrote: > > I believe Greg is familiar with Apache::Session. There have been > discussions about this before. A session manager manages the workflow > around sessions. A session stores information. They are two different things. > > In addition, I believe the name session manager has come up on this list > before with regards to this. That just about covers it. Thanks Gunther As for cpan, I have an aliase for th cpan shell, and excellent module. Greg > > Later, > Gunther > > At 07:04 PM 10/21/00 -0500, James G Smith wrote: > >Check out Apache::Session, available on CPAN and see if your code > >could be moulded to fit it's way of thinking. If they are too > >much different, then you might want to consider contacting the > >module list to see if what you have is a good name (it probably > >is) before going all out with distribution (and consider CPAN). > > > >For more information, > > > >http://www.cpan.org/modules/00modlist.long.html#Part1-Modules:C > > > > > > > >Greg Cope <[EMAIL PROTECTED]> wrote: > > >Greg Cope wrote: > > >> > > >> Dear ALL > > >> > > >> I've writen a module that does transparent session management via either > > >> Cookies, Munged URI or Query Args. > > >> > > >> It has quite a few options to change the behavour, and appears stable in > > >> my developement environment. > > >> > > >> What I suggest is that unless there is a major objection I call it > > >> Apache::SessionManager and set up a Source Forge project with the same > > >> name. > > >> > > >> Unless there is a major issue I assume that by the weekend everyone whom > > >> wants to will have made thier view clear and will hopefully go forward > > >> from there. > > >> > > >> Regards > > >> > > >> Greg > > > > > > > > >Dear All > > > > > >Not having heard anything bad about this I will go ahead a setup a > > >sourceforge project. > > > > > >I also hot heard anything back from the poeple I sent a copy to, I can > > >hence only assume that its so good that it's made them speachless ;-) > > > > > >Seriously, could poeple drop me a note as to how they found it ? I do > > >not want to go to all the trouble of writing docs / install files / > > >source forge projects etc ... if its a load of rubbish and I am wasteing > > >my time. > > > > > >Regards > > > > > >Greg Cope > > > > > > >-- > >James Smith <[EMAIL PROTECTED]>, 979-862-3725 > >Texas A&M CIS Operating Systems Group, Unix > > __ > Gunther Birznieks ([EMAIL PROTECTED]) > eXtropia - The Web Technology Company > http://www.extropia.com/
Re: [ RFC ] New Module Apache::SessionManager
Greg Cope wrote: > > Dear ALL > > I've writen a module that does transparent session management via either > Cookies, Munged URI or Query Args. > > It has quite a few options to change the behavour, and appears stable in > my developement environment. > > What I suggest is that unless there is a major objection I call it > Apache::SessionManager and set up a Source Forge project with the same > name. > > Unless there is a major issue I assume that by the weekend everyone whom > wants to will have made thier view clear and will hopefully go forward > from there. > > Regards > > Greg Dear All Not having heard anything bad about this I will go ahead a setup a sourceforge project. I also hot heard anything back from the poeple I sent a copy to, I can hence only assume that its so good that it's made them speachless ;-) Seriously, could poeple drop me a note as to how they found it ? I do not want to go to all the trouble of writing docs / install files / source forge projects etc ... if its a load of rubbish and I am wasteing my time. Regards Greg Cope
Re: IPC::Shareable (was Re: Perl module - LWP)
"Alexander Farber (EED)" wrote: > > "David M. Davisson" wrote: > > Yes, it works fine. No mods. > > > From: "David Jourard" <[EMAIL PROTECTED]> > > > Has anyone worked with the LWP module under mod_perl and have they found > > > that it works with no modification. > > I would like to ask the same question about IPC::Shareable. > > Is anybody successfully using it under Solaris or OpenBSD? > "make test" hangs for me on these platforms and the module > author is unreachable :-( > > http://vorpal.mcs.drexel.edu/bsd-ports/helix/shared-memory.html > doesn't seem to help on OpenBSD (increasing SHMMAXPGS up to 4096) > > If not IPC::Shareable, what module do you use for fast > communication between Apache-children? IPC::ShareLite is writen in C (and hence faster (arguably)), but it does not serial data structures, so either Freeze / Thaw or DataDumper are you friends here. I've seen IPC::Sharable working ok on Solaris 2.6 but cannot offer any guideance as to why it may not work. Greg
Re: [ RFC ] New Module Apache::SessionManager
Gunther Birznieks wrote: > > I like the name as it works well with our naming (SessionManager, Session > hierarchy) so I can probably write a wrapper that assumes your > SessionManager is embedded in Apache and it's not confusing for our users > who want to configure our apps to use your session manager. Thanks Gunther If anyone wants a copy in the mean time drop me a line. Greg > > Thanks, > Gunther >
[ RFC ] New Module Apache::SessionManager
Dear ALL I've writen a module that does transparent session management via either Cookies, Munged URI or Query Args. It has quite a few options to change the behavour, and appears stable in my developement environment. What I suggest is that unless there is a major objection I call it Apache::SessionManager and set up a Source Forge project with the same name. Unless there is a major issue I assume that by the weekend everyone whom wants to will have made thier view clear and will hopefully go forward from there. Regards Greg
Re: Spawning
[EMAIL PROTECTED] wrote: > > Hi there, > I am working on a web-oriented game that runs on Apache/modperl and > MySQL. I have one perl process that runs forever and is outside of Apache > that does a lot of tallying up and cleaning. I want the process to be > started by Apache on server startup and give the process access to Apache > much like a normal modperl script. Is this possible? > Atli. I would always seperate any proccess that are not web request orientated outside the request architecture - i.e write your own daemon / crond script thats does this exterior processing. What do you need to access apache internals for ? Starting something on startup is just a question of adding the required lines to the server startup script. > p.s. I was able to achieve something similar by placing the script in my > modules directory and simply calling it from a browser. The script never > returns so the browser hangs but at least the script runs. This is however > rather messy and obviously not a method I want to use. Not highly recomended but what about an exec / system call from the startup.pl ? (as root remeber!). Greg Cope
Re: Bug in mod_perl
>I'm using mod_perl 1.24/Apache 1.3.12/Perl 5.00503 and find that I receive >no output after the \0. Is this a mod_perl or Apache bug? Or is it a >client bug (using Netscape 4.75) or is it the expected behavior. It would be expected, I'd assume. perl5-porters discussed this back in January when phrack ran an article claiming it was a 'bug' with security implications. To summarize, this isn't really bug, but merely what you'd expect when the PV gets passed to a C function which expects a NULL terminated string. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-01/msg00020.html .g -- - Crack RC5-64 with Bovine: http://www.distributed.net/rc5/ - #!/bin/perl -sp0777i
Re: [Apache::ASP] $Request->QueryString->('foo')->Item() support
At 14:23 -0700 2000/10/09, Joshua Chamas wrote: >$Request->QueryString->('foo')->Item() isn't valid perl syntax, >is it? >perl -c $Request->QueryString->('foo')->Item() __END__ - syntax OK ;-) .g -- Greg Williams, Cnation, (310) 228-6924 "Wow, no intel, no microsoft, sounds like a computer that might... dare I say it... work!" -LHB
Re: open(FH,'|qmail-inject') fails
Doug MacEachern <[EMAIL PROTECTED]> writes: > On Mon, 25 Sep 2000, Stas Bekman wrote: > > > All you care about is to measure the time between email sending start and > > end (when the process continues on its execution flow). Why should one > > care about the details of internal implementation. > > i only skimmed the first part of this thread, but assumed if you're > talking about performance, you'd want to compare the overall impact on > your system(s) of Net::SMTP vs. |qmail-inject. you cannot measure the > overall impact just using Benchmark.pm is all i'm trying to clarify. A better plan for such systems is to have a queue in your database for parameters for e-mails to send. Insert a record in the database and let your web server continue processing. Have a separate process possibly on a separate machine or possibly on multiple machines do selects from that queue and deliver mail. I think the fastest way is over a single SMTP connection to the mail relay rather than forking a process to inject the mail. This keeps the very variable -- even on your own systems -- mail latency completely out of the critical path for web server requests. Which is really the key measure that dictates the requests/s you can serve. -- greg
Re: OOP and mod_perl question
Andreas Grupp wrote: > > Hello > > I am trying to develop for the first time a perl module. It should work on a > server with mod_perl. The objects are not using mod_perl ($r) and are just > solving some of my work in a nicer way. Since I'm new in OOP on perl (I only > know C++) I would hear from some experts that the following is allowed in Perl > OO modules and does not conflict with mod_perl. > > The question belongs to the constructor. I have $self as a class reference on > the brandnew object. Now in the rest of my constructor I do some Querys on a > MySQL database to get information about the authenticated user (.htaccess with > AuthenDBI). Afterwards I store the user-data retrieved from the database in a > hash-variable and put a reference to this hash in the $self object in the > following way: > > $self->{'userdata'}->$hashref > > Now I can get the different parts of userdata in other instance-methods with > code like the following ($po is an object of this class): > > my $po = new Peseta; > print "This desk belongs to: " . $po->{'userdata'}->{'ulname'} . ""; er ... this may be wrong but ... Here you are directly referancing the Objects data structure - which in OO is a little naughty (you should repsect an Objects privacy, but perl will not enforce it). Hence you would need a method call to return said data, in your Peseta package put something thus: sub get_desk_owner { my $self = shift; my $name = shift; return $self->{'userdata'}->{$name}; } and the secound line becomes: print "This desk belongs to: " . $po->get_desk_owner('ulname'} . ""; Why bother - well you may change the internal objects data structure and hence your method will break all code that uses it, yet in mine all I need is to change the object implemetation. > My question is now: Can I be sure that there are no conflicts when several > users are requesting pages that work with this module? Can I be sure that the > object data is not shared between different requests and the object has really > only data corresponding to the actual request when I follow the general rules > for OOP under perl? The objects instance data will not be shared between requests if you are carfull (and useing strict, and -w will help alot here) to initialise and scope variables properly. In your example you use 'my' and hence this will be fine. The way to make something global (BEWARE) is to use a package global (via use vars), and not to reinitaialise it after the first request - then the variable WILL have the same value as it had after its last use IN THAT CHILD (as apache is a multi-process model - the var will have different states in different children). The mod_perl guide covers these issues very well. Hope that helps. Greg Cope > > Thanks a lot for your answers > > Andreas > > -- > > > Elektronikschule Tettnang http://www.elektronikschule.de/~grupp > Oberhofer Str. 25 mailto:[EMAIL PROTECTED] > 88069 Tettnang PGP-Key available via mail. Use subject > Tel.: +49 7542 9372-33 Use subject: send pgp-public-key > Fax.: +49 7542 9372-40
Re: tracking down why a module was loaded?;
Matt Sergeant wrote: > > On Wed, 27 Sep 2000, Matthew Byng-Maddick wrote: > > > > We all have to do our part to evangelize mod_perl more. I think ISPs are > > > really key here as I think I may have mentioned before. If you get the ISPs > > Actually I think the people we need to get involved are the web site > builders - the larger companies offering dynamic web content creation. We > also need some more mainstream tools, the oft-requested "Zope-a-like" in > Perl. And it needs to be trivial to install (I'm not sure how likely that > is to be yet). Hum - most commercial companies that I know in London (few I know), either use ASP (the M$ version) or PHP. The best solution for them is often not what is technically the best, but the compromise of staff cost / availability, and hence development cost. e.g. I have a few friends whom work in ASP shops whom know little about the web in terms of cookies, sessions, headers, but they all know how to set a session in ASP, and hence get the job done. Their employers get the job done, at a lower cost (IMHO ASP programmers are paid less than perl ones). The fact that they often get stuck when trying to do something a little out of the ordinary does not appear to matter much! As for a "Zope-a-like" or similar, I agree that there are few mod_perl applications out there, and judging by the number of PHP apps on freshmeat there's allot of competition. A (or many) flagship application(s) would help evangelise mod_perl allot. On the easy to install front, I think that's due to programmer being lazy. I know there are issues, but making a module install using h2xs stuff is easy (both for programmer and end user). Supplying example httpd.conf files is also easy - it just takes time. > > > advertise support for mod_perl? How many without charging like US$100 more > > > a month on top of the normal account fees? > > > > This is difficult, due to the security issues. If you have client cgi, you > > can always use something like suEXEC or even something as complex as userv > > to run your cgi scripts. With mod_perl, the plugged in scripts can do > > anything that the webserver can, and you can (by writing a module that > > doesn't compile) break the entire webserver. > > > > > PHP comes with a lot of ISP accounts for free with no extra cost. Java does > > > not yet, but I've started seeing ISPs starting to support Java in the low > > > end shared server accounts... > > > > Wow. I'm surprised, for the security reasons I've outlined above. But then > > I don't know much about PHP, really. > > PHP can runs as a normal CGI, using suExec. So it's like advertising Perl > support. > > What would help mod_perl is a working sandboxing system, based on Safe and > SafeHole. I've advocated that idea before, but still don't have the time > to go and build it. With that sort of system, and ISP could easily trap or > prevent whatever they need to, and we could work with them to build up > secure proffessional installations. > > However, I'm honestly not sure if the whole of mod_perl is "right" for the > majority of small fee ISP's. What the ISP's need is perhaps one of the > mod_perl modules, like Mason, Embperl or AxKit, or something like > that. Rather than letting users write PerlInitHandlers! Unfortunately I > have no idea how you might secure one of these modules, even though one is > my own. Because mod_perl is so far entrenched into apache it is difficult to sandbox it. I've looked at running it for a hosting service and it was less than easy, nor eligant to allow users access to mod_perl. I agree with Matt's last point that mod_perl may not be right for the mainstream "free ISP's". After all with performance comes power, and in an ISP's world do you want your webserver going wild due to a badly written bit of perl ? mod_perl is ideal for single use servers that host one application, tailor made for that client (as in customer not http). IMHO mod_perl cannot be beaten on performance or flexibilty in this scenario. Should we not promote mod_perl as a web platform for the 'cognisenti'. After all, all the 'best' things are usually not the most popular, but most people know they are the best. Perhaps this last bit is where the mod_perl 'marketing machine' is failing. just by 2 pence worth. Greg Cope > > -- > > > Fastnet Software Ltd. High Performance Web Specialists > Providing mod_perl, XML, Sybase and Oracle solutions > Email for training and consultancy availability. > http://sergeant.org | AxKit: http://axkit.org
Re: Clean way of transfering Objects between childinit and requesthandlers ?
Matt Sergeant wrote: > > On Sun, 17 Sep 2000, Chris Winters wrote: > > > Hi Greg, > > > > Check out Class::Singleton for this purpose. Works great for me. > > . > One thing C::Singleton misses is a clear_instance method though, which is > pretty much necessary for mod_perl work (I'm surprised Andy hasn't fixed > this, since he does a lot of mod_perl stuff)... > > However copying the code is pretty trivial and adding that method is about > another 3 lines. Thanks gents - I'd not seen this one before. Oh, Chris I think your ratio is a bit low - the actual module code is extremely short. Greg > > -- > > > Fastnet Software Ltd. High Performance Web Specialists > Providing mod_perl, XML, Sybase and Oracle solutions > Email for training and consultancy availability. > http://sergeant.org | AxKit: http://axkit.org
Clean way of transfering Objects between childinit and request handlers ?
Dear All I want to create an Object in a ChildInit handler and then pass it to request handlers. Its a DB Object / module and it does some initialiastion, it prepares a few statment handles and then stores them in an array for later execution. One solution is to create a the object in a child init handler and to store it in a package global - and then to use a type glob to referance it from other handlers by using that package global (detailed below). However this appears as a bit of a kludge and does not have any repect for encapsulation ;-). I feel there must be a cleaner way of doing this ? A read of the guide etc ... has not given me any clues. Any ideas appreciated. Greg Cope ### type glob example (off the top of my head - could be wrong) package child_init; use vars qw($foo); $foo = My::db_handler->new(); ### package request_handler; *db = \$child_init::foo; $db->foo();
ACCEPT_LANGUAGE leaking mysterious information
[I could swear i sent this already and even got a couple responses but no answers, however I cannot find any such things in my mail logs or in the searchable list archives. If I did and there were answers posted if someone could point me to the result in the list archives that would be fine] In the process of setting up a multilingual site we started logging the accept_languages header just out of curiosity. I've noticed a strange HTTP_ACCEPT_LANGUAGE header appearing: HTTP_ACCEPT_LANGUAGE=en,x-ns1bdJ6k9jzNhQ;q=0.7,x-ns2r3109OnmPe2;q=0.3 HTTP_ACCEPT_LANGUAGE=en-us,x-ns1x2TumPKxNhQ;q=0.4,x-ns2r3409OnmPe2 HTTP_ACCEPT_LANGUAGE=en,x-ns1bdJ6k9jzNhQ;q=0.7,x-ns2r3109OnmPe2;q=0.3 Note the x-ns1 and x-ns2 languages that seem to be leaking random data. It looks to me like base64 encoded 8 byte blocks. About the right size for DES keys or blcoks. (In fact two of them would be exactly right for DES3.) I've done web searches and cannot turn up any documentation or comment on this. It seems like an odd side-channel to be using to leak this information. Does anyone know anything more about it? -- greg
Re: [ RFC ] A Session Manager module
Jules Cisek wrote: > > Sounds interesting. > > Is this module just managing the sessionID or also the session data? i.e. > is the manager capable of storing complex objects (via something like > Storable or Data::Dumper)? Will you provide hooks "caching and DB > abstraction" layers so that the developer can provide the backend > implementation? Just managing the session ID between client and server. I prefer simple modules that are small and neat (KISS). storage of any data is upto you - can I suggest Apache::Session ? All I want to do is provide a simple module in the unix sense of doing one thing well. I also had the idea of creating a BB (BareBones) version that has few(er) configuration options and is very simple. Greg > > ~J
[ RFC ] A Session Manager module
Dear All As some of you are aware for the past few weeks I have been working on a Session Manager style module. It works (ish ;-), I know of a few issues (that may not be important enough to change), but it works in my developement environment. What do I do with it now ? I think it may fit in well as a front end to Apache::Session, although it needs a name. Its only around 400 lines (including some POD and comments). It could fit in quite well with Apache::Session (ie providing a session id, and Apache::Session does the server side storage). It may also fit in with other implementations such as Embperl, Apache::ASP, and Mason - although most of these have their own implenetations. My original plan - believe it or not - was to write a short "how to" style tutorial to creating a mod perl shopping cart, the idea was not to have another shopping cart, as there are many other better implentations, but to have a few reasonably easy examples of mod_perl in a real world type example. This was inspired by someones post a few months back for documentation / articles etc. Well I started and wrote a few modules, and went on to create a templating module (as per any true path to mod_perl wisdom!), this session module and a DB abstraction layer (and aparently I should be creating a caching module as well!). Well any ideas - please let me know. Greg Cope A few details below. AIM: To manage session ID's between client and server - to get (or optionally set) a sesion id via Cookies, Mungled URL or path_info. Implemetation: Uses a transhandler. Optional configurations to alter logic / options via a package scalar eg (some but not all) in a startup.pl: use SessionManager(); $SessionManager::DIR_MATCH = '/foohandler'; # default is match everything of /\.html/ ! $SessionManager::REDIRECT = 1; # default to no redirect $SessionManager::DEBUG = 7; # default debug is off $SessionManager::SESSION_ID_LENGTH = 32;# nice long ID lenght $SessionManager::NON_MATCH = '\.gif|\.jpeg|\.jpg'; # ignore images i.e. the above will session manager a URI matching 'foohandler', if cookies are off it will redirect and set an mungled URI with a session id length of 32 - it will also dump loads of debug info (between 3 and 20 lines a request), and ignore any gifs, jpegs, and jpg files within a URI 'foohandler'. Also: $SessionManager::COOKIES_ONLY = 1; Will only try cookies and then stop $SessionManager::ARGS_ONLY = 1; Will only try ARGS (after cookies). $SessionManager::URI_FIRST = 1; Try URI (mangled) after cookies, before ARGS, this allows changing the order of which things are checked. $SessionManager::USE_ENV = 1; Instead of using pnotes entries use Environmental variables. There are aslo a few other bits in the works for trying to setting a cookie if they are off by redirecting, and then using a mangled URI or ARGS if that failed - this will have a TTL, and DOMAIN vars that will allow overriding of the defaults. Thats about it.
Re: SELECT cacheing
Brian Cocks wrote: > > I'm wondering how much improvement this caching is over the database caching > the parsed SQL statement and results (disk blocks)? > > In Oracle, if you issue a query that is cached, it doesn't need to be parsed. > If the resulting blocks are also cached, there isn't any disk access. If the > database is tuned, you should be able to get stuff out of cache over 90% of > the time. I don't know what other databases other than Oracle do. Oracle is clever in this respect - and you are right if you tune correctly you should hit the cache ... But may other DB's do not have a shared executition plan / results cache. MySQL, msql and postgreSQL do not. As far as I am aware Sybase only has an execution plan cache that is per connection (could be wrong here). The MySQL developers have got a SELECT CACHED idea, where you can define a statement as cacheable, and further calls to SELECT CACHE will return the cached results - this is all on the todo list with no fixed date. > What are the advantages of implementing your own cache? Is there any reason > other than speed? Could be wrong but no - and it has a bad point in that it introduces an added layer of complexity . I am certainly interested as accessing a local cache should be an order of magnitude faster than asking a buzy DB. Greg Cope > > -- > Brian Cocks > Senior Software Architect > Multi-Ad Services, Inc. > [EMAIL PROTECTED]
Re: open(FH,'|qmail-inject') fails
Perrin Harkins wrote: > > On Fri, 8 Sep 2000, Stas Bekman wrote: > > > As far as benchmarks are concerned, I'm sending one mail after having > > > displayed the page, so it shoul'dnt matter much ... > > > > Yeah, and everytime you get 1M process fired up... > > Nevertheless, in benchmarks we ran we found forking qmail-inject to be > quite a bit faster than Net::SMTP. I'd say that at least from a > command-line script qmail-inject is a more scalable approach. Or even better would be to use qmail-remote and avoid the queue, but thats a qmail and not a mod_perl thing. BTW I'm looking at this at the mo and have decided to go back to a dump email to db -> crond robot sends mail to port 25 -> mail delt with there. Why ? Well this is the most scalable, and its cross platform, talking directly via pipes / forks etc usually has a limit somewhere, and all too often I may reach it far sooner than I thought. Greg > > - Perrin
Re: upgrading mod_perl on production machine
Stas Bekman wrote: > > On Wed, 6 Sep 2000, Perrin Harkins wrote: > > > On Wed, 6 Sep 2000, Bill Moseley wrote: > > > I hope I didn't miss anything in the Guide at install.html and in > > > control.html, but I was looking for any suggestions on upgrading mod_perl > > > and Perl on a running production machine to limit the amount of down time. > > > > We use RPMs. Some form of package, even if it's just a tarball, is a good > > idea. Build it on a different server and then just install it. Having > > multiple servers really comes in handy here because you can take some off > > line, upgrade them while the others are live, and then switch. Then your > > site remains up the whole time. > > The problem of the tar-ball is that it doesn't know to cleanup previously > installed files. Imagine a situation where some module that was previously > installed in perl5/5.00503 now installed in perl5/site_perl/5.005 -- You > get the problem where the old version is loaded before the new one. > > Therefore tar-ball is not a good solution, unless you scratch the whole > tree a moment before you untar the ball. Ah - what about this ... install (using tarballs complie target dirs) in a package_name-version_number directory. Then symlink to that dir from where ever you need to. My /usr/local looks like this on some of my production machines: drwxr-xr-x6 root root 4096 Jun 28 16:25 BerkeleyDB.3.1 lrwxrwxrwx1 root root 13 Jul 7 06:21 apache -> apache1.3.12/ drwxr-xr-x3 root root 4096 Jun 18 22:55 apache1.3.12 drwxr-xr-x2 root bin 4096 Jun 18 23:09 bin drwxr-xr-x2 root root 4096 Jun 18 23:12 include drwxr-xr-x2 root root 4096 Jun 15 18:15 lib lrwxrwxrwx1 root root 30 Sep 2 11:57 mysql -> /usr/local/mysql-3.23.23-alpha drwxr-xr-x7 root root 4096 Jul 31 17:28 mysql-3.23.22-alpha drwxr-xr-x7 root root 4096 Sep 2 11:14 mysql-3.23.23-alpha drwxr-xr-x2 root bin 4096 Jun 8 21:42 sbin drwxrwxr-x9 root root 4096 May 29 11:38 ssl I can now roll back any new installs by just changing the symlink, and a tarball of the required dir does the trick. After testing I brought up new versions in the time in takes to make a online command with a few &&'s in and apache is backup in the time it takes for apache to restart - which depends on the ammount of perl modules it needs to deal with etc ... Greg Cope > > _ > 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://jazzvalley.com > http://singlesheaven.com http://perlmonth.com perl.org apache.org
Re: multilanguage site
> >> can someone suggest me the best way to build a multilanguage web site > >> (english, french, ..). > >> I'm using Apache + mod_perl + Apache::asp (for applications) I'm really interested in what other people are doing here. We've just released our first cut at i18n and it's going fairly well. But so far we haven't dealt with the big bugaboo, character encoding. One major problem I anticipate is what to do when individual include files are not available in the local language. For iso-8859-1 encoded languages that's not a major hurdle as we can simply use the english text until it's translated. But for other encodings does it make sense to include english text? If we use UTF-8 all the ascii characters would display properly, but do most browsers support UTF-8 now? Or do people still use BIG5, EUS, etc? As far as I can tell there's no way in html to indicate to the browser that a chunk of content is in some other encoding other than what was specified in the headers or meta tag. There's no attribute or anything like that. This seems to make truly multilingual pages really awkward. You basically must use an encoding like UTF-8 which can reach the entire unicode character set or else you cannot mix languages. -- greg
Re: Apache::Reload 0.04
Stas Bekman <[EMAIL PROTECTED]> writes: > But adds an additional stat() call for each request, which might be not > desired for "some" sites... I know it's quite fast. See: > >http://thingy.kcilink.com/modperlguide/performance/Reducing_the_Number_of_stat_Ca.html > > But, yeah it's cool! In practice I find that stat calls are a minor performance factor when compared with database calls so for any fairly dynamic site it's not a big factor. However, perhaps a better tradeoff for a production site would be to perform these stat calls in the parent just before a graceful restart. Then to force rereading the library files without any downtime the you would just do a graceful restart, which would recompile all the .pm files and then start spawning new children with optimal shared memory behaviour:) I believe Apache::ASP's internal mechanism is capable of this now. -- greg
Re: Apache::Session and performance question
Perrin Harkins wrote: > > On Mon, 28 Aug 2000, Chris Brooks wrote: > > I went back through the documentation on Apache::Session, > > Apache::Session::DBIStore, and Apache::DBI, and I haven't found a > > problem in the way we have implemented this. Does anyone else have > > suggestions, or has anyone else experienced a similar performance hit? > > You're not doing anything wrong. As I said before, going to a databse on > every request is expensive. It will definitely crush your performance > when compared to something really lightweight like serving static files > with no db access. You could try using one of the other session stores > like FileStore to see if it's any faster for you, or you could try running > MySQL on the same machine as the web server, but if you have significant > traffic you will eventually need a separate db server machine and a > cluster of web servers. > > The only thing I could suggest for improving the performance of your setup > is to make sure you have MySQL properly tuned, with an appropriate index > on this table. > > - Perrin I think Perrin has already touched on this and it may be too bovious, but if you are session managing all requests you are wasting alot of time on non-html / dynamic content such as images, style sheets. Greg Cope
Re: Apache::Perfmon 0.011
Lupe Christoph <[EMAIL PROTECTED]> writes: > Hmm. Apache::Benchmark sounds more like a benchmark driver to me. > Apache::Instrumentation or so? Apache::Probe? Profile or even just Prof. I looked at this and really like the idea. Unfortunately I need to recompile my Apache to use it. What I think it needs is, a way to gather the statistics in a hash based on the request. That way I can make a web page that pokes around in the hash table and reports the average and maximum time taken by page. I'm not clear how or if that can be done in a separate module like this that doesn't know how the requests are dispatched. Either a regexp needs to be provided that returns the key to use for the hash, or else something similar needs to be integrated into packages like CGI and Apache::ASP. (Which was the approach I was planning on taking myself.) I like this approach better though, so it would be neat to see it polished. -- greg
problem with mod_proxy/mod_rewrite being used for the front-end proxy
This isn't entirely on-topic but it's a solution often suggested for mod_perl users so I suspect there are other users here being bitten by the same problems. In fact the manner in which problems manifest are such that it's possible that many mod_perl users who are using mod_rewrite/mod_proxy to run a reverse proxy in front of their heavyweight perl servers have a security problem and don't even know it. The problem is that the solution written in the mod_rewrite guide for a reverse proxy doesn't work as advertised to block incoming proxy requests. RewriteRule^(http|ftp)://.* - [F] This is supposed to block incoming proxy requests that aren't specifically created by the rewrite rules that follow. The problem is that both mod_rewrite and mod_proxy have changed, and this seems to no longer catch the incoming proxy requests. Instead mod_rewrite seems to see just the path part of the URI, ie, /foo/bar/baz.pl without the http://.../. I've even tried using ${THE_REQUEST} which actually matches, and says it's forcing the response to be forbidden, then it happily proxies the request anyways! I'm using a deny from all http://127.0.0.1/> allow from all section to at least avoid being an open proxy to the outside world, but I cannot find any way in 1.3.12 to refuse all proxy requests coming from the outside. If you're not aware of the problem at all and have merely followed the advice of the mod_rewrite guide you are probably an open proxy, allowing attackers to use your web server to attack other sites anonymously. -- greg
Session manager(s)-how to set an outbound session ?
Dear All I'm writing a Session-Manager (transhandler) i.e deals with getting a session id from cookies, uri, or query args, and sets one and redirects if neccessary. This is meant to compliment Apache::Session - in that you use Apache::Session to store your session data. Thanks to Mat and Eric (for the addhandler issue yesterday) I can: - get a session from cookies, query args or via URI rewriting - change the order of the last two (i.e look in uri first, query args secound, or args first, uri secound). - Only look in cookies, or args or uri. - redirect if needed to set a session if none is found(default to one - configurable to off) . - match a uri to "session" i.e session-ing can be switched off for certain uri's. - store the session id / whether cookies are on / off in either pnotes or $ENV{} - debugging can be set for copious info on whats going on. - Note there is no validation of the session - this just fetches the session id, validating is up to other handlers. - I'm adding in a check_cookie funtionality that will try to set a cookie and then redirect to itself with a check in the URI, if no session is found. - lots of bonus unexplained funtionality aka bugs I'v not found or fixed. Much of the code is a rehash of the examples in Apache Modules in Perl & C. Now I want to deal with out-bound content/session ids - obviously cookies are easy as these could just be set in the transhandler and a ref placed in pnotes (and $ENV although I'm not sure on this bit as I've not tried it). But what to do with args or uri sessioning ? If relative urls are used the session appears to be preserved in netscape between different uri's (if using uri's). This means I can do reasonable transparent session handling with Cookies or URI mangling (ignoring session id leakage at this point). This works quite well (I happy with it!). Adding to the args of links is a different question - any one any clues ? I will either have to say that adding a session to your links if cookies are off is your issue within your content handler, or find a way of manipulating them - anyone any ideas ? If anyone wants a peek I can send them the code or post it here if there'ss demand. Its my secound stab, and the logic/ style / efficiency may leave something to be desired - constructive flames welcome! The main aim/motivation is for a very simple ecommerce thing where sessions are vital - and offsite/exterior links are few and exit points want to be tracked - hence URI rewriting is acceptable and a redirector is handy. Transparent session handling is a "nice" design goal. I may also throw in a redirector that will strip session args (if I can get $r->args(undef) to work ) and/or uri's (which can help with exit tracking etc ...) before redirecting to the link to help with session leaks. Greg
Re: my transhandler runs only once in each child ?!?
Matt Sergeant wrote: > > On Sun, 13 Aug 2000, Greg Cope wrote: > > > Apache->push_handlers("PerlTransHandler", \&transhandler); > > push_handlers is temporary, not permanent. And this line only gets > executed once. Thanks Mat - Explains everything. I though it might be something as simple as this, I'll birch myself later. I spent hours yesterday looking at this. Doh, Doh, Doh !!! Thanks again Greg ps You're up early > > -- > > > Fastnet Software Ltd. High Performance Web Specialists > Providing mod_perl, XML, Sybase and Oracle solutions > Email for training and consultancy availability. > http://sergeant.org | AxKit: http://axkit.org
Re: my transhandler runs only once in each child ?!?
Eric Cholet wrote: > > > > > Apache->push_handlers("PerlTransHandler", \&transhandler); > > this will trigger the handler for the first request. Nothing > will trigger it for subsequent requests. If you want it to run > for every request, why not just drop the push_handlers call > and add PerlTransHandler tinasm::Session to httpd.conf. Thanks Eric, IIRC I had tried that arround a month ago - and it did not work - but the bug was elsewhere. The reason I was doing it this way was so that I could just do a : use tinasm::Session; in a statup file - which I think is {now think was} more elegant that adding a transhandler, that'll teach me! Now all working thanks Greg > > > > > sub transhandler { > > > > my $r = shift; > > unless ($r->uri =~ m!$DIR_MATCH!o) { > > print STDERR "SESSION-MANAGER-$$-URI not matched\n" > > if $DEBUG; > > return DECLINED; > > } > > > > print STDERR "SESSION-MANAGER-$$-URI match\n" if $DEBUG; > > > > . handler goes on for another 200 lines so I've snipped it - if > > anyone wants to look at it drop me a line. > > -- > Eric
my transhandler runs only once in each child ?!?
Dear All I've a bug somewhere that I cannot appear to spot.. I have writen parts of a transhandler to handle session's. It works in once in each child and then does not appear to be executed again. I've looked through The Guide and could not see anything there, nor in the 'Apache modules in Perl and C'. I must be missing somehing (a clue for a start ;-). The obvious answer is that a variable is not being redefined / initialised. Any ideas appreciated. Greg Cope ### some clues below (I hope) I have these lines in my startup.pl: use tinasm::Session(); $tinasm::Session::DEBUG = 1; $tinasm::Session::DIR_MATCH = 'test'; $tinasm::Session::REDIRECT = 1; $tinasm::Session::USE_ENV = 1; # end of startup.pl, snippet # part of the module below # code snippet # package tinasm::Session; use strict; use Apache; use Apache::Constants qw(DECLINED REDIRECT OK); use Digest::MD5 qw(md5_hex); use constant SESSION_ID_LENGTH => 8; use vars qw($DIR_MATCH $COOKIES_ONLY $ARGS_ONLY $DEBUG $REDIRECT $URI_FIRST $USE_ENV); Apache->push_handlers("PerlTransHandler", \&transhandler); sub transhandler { my $r = shift; unless ($r->uri =~ m!$DIR_MATCH!o) { print STDERR "SESSION-MANAGER-$$-URI not matched\n" if $DEBUG; return DECLINED; } print STDERR "SESSION-MANAGER-$$-URI match\n" if $DEBUG; . handler goes on for another 200 lines so I've snipped it - if anyone wants to look at it drop me a line.
Cant set args to $r->arg(undef);
Dear All Although this in no longer important to me, I cannot appear to reset $r->arg to an empty value. I am writing a transhandler and if the args containted a certain value I wanted to reset it to the args value without this value. hence: my $args = $r->args; # remove value $args =~ s/value//; # resetting $r->args; $r->args($value); If $args has more then value, then the args will be reset correctly. However if $args, only contains value, and hence after the regex is now empty, then the reset will not work, and $r->args() still contains the orginal values... Is this a bug / feature or just unexplained functionality ? Greg Cope
Re: Feature sets [was Re: Templating System]
Matt Sergeant wrote: > > On Tue, 1 Aug 2000, Drew Taylor wrote: > > > Bill Moseley wrote: > > > > > > It seems as if there needs to be a general templating mailing list... > > > > > > Here I have a comment about comparing template systems, and then I solicit > > > advice on which system to use... > > > > > > > Bill, > > > > After all the response the thread generated, I wonder if perhaps we > > (meaning the people who have control over those things :-) really > > _should_ setup another list. > > Look at the history of this list: it often gets very bursty and the quiet > again. I think setting up a perl-template mailing list would be initially > heavily trafficed, but be pretty much dead in a few weeks (or days even). I'd agree. The list tends to hit a raw never and trafic goes up alot and then its quite again. I would like to see discussion here as long as its relevant. Greg Cope > -- > > > Fastnet Software Ltd. High Performance Web Specialists > Providing mod_perl, XML, Sybase and Oracle solutions > Email for training and consultancy availability. > http://sergeant.org | AxKit: http://axkit.org
Re: Is there a module for getting / setting a Session-ID
[EMAIL PROTECTED] wrote: > > In a message dated 7/30/00 7:33:41 AM Eastern Daylight Time, > [EMAIL PROTECTED] writes: > > > > And, on top of that, I have emilinated session hijacking > > > (with a Back Button Breaking method). > > > > Can you enlighten me ? > > A security method that will redirect the user to a relogin page if, for > instance, > they hit the browser's back button and then use navigation on the old pages. > > Basically, while in a regular area, the links might be > http://192.168.1.100/cmp/about/about.html > and in the secure area there is a "?key=af65235cd773ae986" > tacked on the end. > Keys are transmitted over HTTPS only. > The key is transformed for each page request. > > Once the key is added to the links, it is mandatory to be returned. > If it isn't the user is directed to reenter their password. > > I've mapped out all the possibilites, and this method prevents any > serious bad effects from session hijacking, while leaving much of the site > free from slow HTTPS connections. > > However, just like anywhere, if someone steals your plaintext cookie > or you send them the link with your Url munge in it, they can add > things to your shopping cart. However, and importantly, while > the user is in the secure area, the shopping cart is locked down, so > unless they have your password also, you never have to buy any of it. Thanks for that. Greg
Re: was Re: template kit..... - now session handling
Ian Kallen wrote: > > Today, Greg Cope <[EMAIL PROTECTED]> frothed and...: > > I posted about a generic URL mangeler / cookie session handler a few > > days ago. > > > > Allthough this is not rocket science - I've writen a URI transhandler > > that will put the session id into pnotes, and if cookies are off will do > > a redirect to itself with a munged URL > > (www.foo.com/id_here/original_bit_here). A quick uri rewrite and bob's > > one of your parents sister. The only major issue is that I cannot > > Two separate issues, two separate replies :) > > If you do this, build it into Apache::Session! Leverage the existing > storage mechanisms built in there already (file, DBI, etc). My only > other feature requests for this: Why not have something that is generic that can work with Apache::Session, and on its own. Why - well some people may not like a monothic session system, and may just wish to use one or the other. For example I am presently only using sessions to store a Database ID, and that stores any data I like. I am presently not using Apache::Session (but thinking about it!) > > 1) include a %no_url_munging hash with user agents for known > indexing spider storage. You don't want inktomi or altavista returing > munged URL's in search results! I'm already including an option that will do a URI match and only session bit that match a simple REGEX - so certain areas of a domain / site can be non-sessioned. Including a hash that has indexers in is no big deal - Joshua from Apache::ASP fame has a different spin and suggests using the query args instead of URI rewriting which could help to solve this issue. > 2) Have it configurable so that the url munger session pnote'ing can be > turned off or on. So if cookies are on then put the session id into pnotes else do not do the redirect / url_munling bit - is that what you mean ? Thanks for the pointers Greg Cope > > I think without these features, url munging session mgt is pretty > worthless. > > -- > Salon Internet http://www.salon.com/ > Manager, Software and Systems "Livin' La Vida Unix!" > Ian Kallen <[EMAIL PROTECTED]> / AIM: iankallen / Fax: (415) 354-3326
Re: Is there a module for getting / setting a Session-ID
[EMAIL PROTECTED] wrote: > > I have fully implemented URL munging and Cookie support, > but SERIOUS troubles start to arise when you start adding > the notion of secure sessions. > > I have done it, but it isn't pretty. Basically, there > are three types of pages. Normal, Secure, and Secure > (but you don't need a Secure Url Munging). my methodolgy at the moment sessions everything within a give uri or matched uri (if I do a simple regex match). > And, on top of that, I have emilinated session hijacking > (with a Back Button Breaking method). Can you enlighten me ? > It was a hassle, but I liked the idea that my site > supported Cookies and URL Munging, and also made it > more secure than the major etailers. > > Unfortunately (?) my design is very tucked away inside > my overall site, and my copious spare time allotment > hasn't come in this summer. Even if you cannot help I would appreciate any comments on my methods - which only requires you to read a few emails !
Re: was Re: template kit..... - now session handling
Joshua Chamas wrote: > > Greg & Gerald, > > I wanted to bring an important issue that came up with > Apache::ASP, how will you deal with search engines indexing > the session-ids in the URL? > > In Apache::ASP, this is handled a couple of ways, first the > session-id is stored as a query string param, not in the path > to give a hint at its dynamic nature for smarter search engines > that respect this, but more important, there is detection that if > the incoming session is not active, a new session id will > be assigned to the end user. This will prevent users that come > from a search engine to all have the same session id. > > I don't know how this latter might be dealt with in this case > except by perhaps some runtime checking with Apache::Session > for existence, and then a redirect at that time to a new URL > with the right session-id? The Apache::ASP query string > SessionQueryParse implementation makes changing the id without > redirection possible, but at the expense of runtime buffer > URL parsing for those without cookies. > > Also note that a developer should be made aware of the security > implications associated with off site HTTP_REFERER logging > of one's session id, so that a developer can work around this > accordingly. In Apache::ASP, I just am careful to warn about > this issue in the docs and give a appropriate workaround: > > http://www.nodeworks.com/asp/sessions.html Thanks Joshua I've looked thorugh Apache::Asp session code and saw your args method. Ian Kallen suggested a hash of know indexers - which is a good idea - but has one problem of how to keep this upto date. A few issues that have been brought to my attention are: 1 - Wherethere to use URI rewriting - and hence the indexer issue - or to rewrite query args (i.e remove a session arg and place it into a pnotes entry). So that hopefully clever indexers will ignore the last bit. 2 - The HTTP_REFERER leaking is an issue that people need to be aware of - I could make a quick redirect filter that could remove the session id. This can also help with click throughs etc. I am not aiming to do any checking of the session id - thats left to something else. 3 - When to redirect to check for cookies etc. i.e. when a client comes in without any session info do we imediately redirect to try and set a cookie, and then use that or else do something else. Or only check after the secound request. 4 - Defining what a session is may be helpfull. What I call a session others may disagree. I need to scope what I'm going to write - otherwise I be redoing it every 5 minutes! My spin on a session is something that needs to be tracked - and I usually only do this when I have to. Others may define a session as any user interaction within a small time frame on thier site so that they can track a users click though (TMTOWTDI on this front I know). Please send me any comments. Thanks again Joshua Greg Cope > > Its a nice feature to get right when its finally working. Enjoy! > > --Joshua >
Re: was Re: template kit..... - now session handling
Gerald Richter wrote: > > Hi Greg, > > > > As far as I am aware (please someone prove me wrong!) the does not > > appear to be such a module. > > > > I meant the module your are about to write :-) > > > > > Please send me ideas / thoughs and I'll have a go. > > > > Embperl currently goes the way that it sets up a tied hash at load time (so > it only has to be done once) and monitor wherever somebody is writing to > this hash. Only in the case that a element of the hash is modified, Embperl > generates a session id (actually Apache::Session does it) and sends the > cookie to the browser. Therefore I don't have to configure anything to use > session management (of course you can configure several parameteress, like > cookie domain etc.), because if the page stores some data in the hash, > session management is enabled in all other cases it isn't used. That make > session management as transparanet as possible for the programmer. When a > new request starts, Embperl checks if there is a session id send in a cookie So therefore would it not be easy to modify your code to check for a pnotes entry called session and cookies ? If session is set then use that. If cookie is set (ie 1) then assume cookies are on! else if you have a session and cookies are off then rewrite your urls to include the session ID ? > from the browser and tells Apache::Session to restore the data in the > session hash. > > This shema may not work, with session id in the url, because you need to do > the redirect before the page is executed. Because Embperl anyways parses the > page, it would be no overhead to rewrite all hrefs (and other urls) on the > fly. I have not thought very much about, what is the best way to go here. Ok - remeber that the URI transhandler stage is before nearly all the others - hence a redirect should work. If the session ID is in the uri I rewrite the uri to exclude it thus: www.foo.com/123234345356/index.pl would get rewritten to: www.foo.com/index.pl and 123234345356 would get put into a pnotes entry called session and cookie_on would be set to O! If the redirect needs to happen then the emb perl page would never be executed until after the redirect as the embperl handler is after the transhandler stage - or have I got emb perl completely wrong ? > > This should give you a short impression what Embperl does, now we have to > think about how we can bring this together with a general module. Unless you can see nothing wrong with the above I should be able to put something basic together over the next few days ... documentation may be a bit lacking mind ... Is the pnotes issue OK ? or should we use an Environment Variable to transfere the data between handlers ? What other issue do you have ? Greg > > Gerald > > - > 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: was Re: template kit..... - now session handling
Gerald Richter wrote: > > Hi Greg, > > > > > Can I recommend you write a simple, standalone module that everyone can > > use and not just an embperl solution - I'd be willing to help (or write > > it) if people send me their wants / ideas, and then flame my code when I > > think its ready! > > > > I would be happy if there is an standalone module that handles uri > translation and cookie checking and so on. I always like more to use > existing solution, then reinventing the wheel (that's one reason why I use > Apache::Session in Embperl). As far as I am aware (please someone prove me wrong!) the does not appear to be such a module. > Embperl has some special needs, because it makes the session handling totaly > transparent to the programmer (he has just to put his values in a hash), but > if you create such a module (or extent the already existing one), I would be > happy to take a look at it and make it work with Embperl. I would be more than happy to rewrite what I have based on what you / others want. My module needs alot of tydying to be anything like the standard of the code found here, mine also includes session checking code (DB lookups). Can you and any others please post ideas of what you/they want ? Some people have already done such a module so if they can chirp up with thier wish lists then that would be great. So far I have something that: a) Checks the URI (simple regex) to see if its a URI that needs "Sessioning" b) Checks for cookies first c) puts data into pnotes (name anyone ? (I used UID, SID and COOKIES_ON)) or we could use sub env variables d) then checks for a session id in a URI. e) redirects to session id uri if non present. > > Gerald > > P.S. Could you resend me your module, because I have missed it on the list You did not miss anything I never sent anything - too embarassed! Please send me ideas / thoughs and I'll have a go. Greg > > - > 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: template kit.....
Tom Brown wrote: > > On Fri, 28 Jul 2000, Paul J. Lucas wrote: > > > On Fri, 28 Jul 2000, Denton River wrote: > > > > > Its been a long time since i have done a jobb without using sessions. I would > > > really like to have this feature included in the kit im using and i think > > > alot of developers are with me on this one. > > > > What I don't understand is *why*. Why can't you use to > > independent pieces of software: one for templates and the other > > for sessions that work perfectly well together (or seperately)? > > > > I personally prefer smaller, more easily udnerstandable pieces > > to large, complex, feature-bloated software. > > Agreed. It seems to me that someone should write a simple package for > tieing in Apache::Session (or similar) in a transparent manner, perhaps > using an early handler stage of the request and leaving the session info > in $r->pnotes() ?? (via an object/typglob/whatever??) That said, it's > late and I'm really not in the appropriate state for making _solid_ > contributions ;-) As per my other posts I think that this would be handy - and as others have mention if we could make something that is generic then people use it in small projects where they mostly roll their own, or other may include it with a TT or embperl system, like Apache::Session is supported via Embperl. I've a simple / ugly module that does the above as a URI transhandler - it is basically some code from the excellent apache modules book with some extra cookie checking. Mine also checks the cookie to see if is valid (i.e DB lookup) It: Checks the URI to see if session management is "on" - returns declined if not. Either puts the cookie value of a cookie called session into pnotes, and sets pnotes cookie_on to true. Or does a rewrite to check cookies - with a new session id.(this bits still being tested!) If this fails it looks for a session id in the URL (www.foo.com/session_id/everything else) - like the example in the apache modules book. - if a session is found it places this in pnotes, and sets pnotes cookie_on to false. If no session id in the URL it then makes one and does a redirect to that. If any sees any major issue with this then please drop me a line - I can see so far: 1. Does a lot of redirects if cookies are off first time round. 2. Session ID may get sent with the URL in a HTTP_REFERER by a browser - if you have links off your site. 3. Posted values get lost in the redirect - this is probably solvable. 4. I have added code to get the args and redirect those as well - so get request do not lose their args. If people want to send me wish lists I'll see if I can include them and then write some docs (so far its in the tradition of real programmers don't document - I'm hoping to be a real programmer ;-) and post it back here. Greg > > > > > - Paul > > > > -- > [EMAIL PROTECTED] | Don't go around saying the world owes you a living; > http://BareMetal.com/ | the world owes you nothing; it was here first. > web hosting since '95 | - Mark Twain
was Re: template kit..... - now session handling
Gerald Richter wrote: > > > I sure think that this template discussion is > > intresting, forms autofill is one thing but another > > thing that i think would be neat is if the kit could > > do session handling, like the Apache::ASP. Can embperl > > or mason do this fancy stuff. > > > > Embperl can do session handling. It uses Apache::Session for storage and > cares about the rest for you. You simply put the values for the user session > in the hash %udat and they will be automaticly restored when the same user > does the next request. Currently Embperl uses Cookies to store a session id > witht in the browser. For Embperl 2.0 I plan to support also URL rewriting. I posted about a generic URL mangeler / cookie session handler a few days ago. Allthough this is not rocket science - I've writen a URI transhandler that will put the session id into pnotes, and if cookies are off will do a redirect to itself with a munged URL (www.foo.com/id_here/original_bit_here). A quick uri rewrite and bob's one of your parents sister. The only major issue is that I cannot appear to use posted values as they appear to get lost in the redirect (Clues wanted !). It appears that a few other people would want a session handler that can do this transparent and then they can use Apache::Session to do the rest. Can I recommend you write a simple, standalone module that everyone can use and not just an embperl solution - I'd be willing to help (or write it) if people send me their wants / ideas, and then flame my code when I think its ready! Greg > Gerald > > - > 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: Is there a module for getting / setting a Session-ID
jeff wrote: > > The mod_perl eagle book has a good section on saving state information > using session ids. And it's not necessarily mod_perl based. Thanks Jeff. I've some code based on parts of the state section - speifically the ideas of URL mungling. Greg > > -- > Jeff Saenz > [EMAIL PROTECTED]
Re: Is there a module for getting / setting a Session-ID
"Issam W. Alameh" wrote: > > check Apache::ASP > > http://www.nodeworks.com/asp/ > > It is so great > Thanks - I'm looking for something more lightwieght - i.e just to do this ... But all the people pointing me to Apache::ASP is starting to tell me something. Greg > Issam \