Re: Apache::DProf problems

2003-08-30 Thread Brian Hirt
i'll double check, but i'm fairly certain it's loaded first.

what if a module is loaded after the fact, but like this:   eval { use 
$module };

some modules are dynamically loaded at run time depending on certain 
situations.

On Friday, August 29, 2003, at 04:26 PM, Stas Bekman wrote:

Brian Hirt wrote:
I've installed Apache::DProf, but it seems hardly any of the calls 
are profiled.   dprofpp shouws MOF::Dispatcher::handler as taking up 
100% of the time, but there is no information recorded in for calls 
within that function.  MOF::Dispatcher::handler is calling thousands 
of other functions and there is absolutely no record of any of those 
calls in tmon.out.
Any ideas an what's going on?  I'm running mp1.27 and compiled it 
with EVERYTHING=1
Remember that any PerlHandler that was pulled in before Apache::DProf 
in the httpd.conf or startup.pl file will not have code-debugging 
information inserted. Make sure that you load before any code that you 
plan to profile.

__
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


--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Apache::DProf problems

2003-08-29 Thread Brian Hirt
I've installed Apache::DProf, but it seems hardly any of the calls are 
profiled.   dprofpp shouws MOF::Dispatcher::handler as taking up 100% 
of the time, but there is no information recorded in for calls within 
that function.  MOF::Dispatcher::handler is calling thousands of other 
functions and there is absolutely no record of any of those calls in 
tmon.out.

Any ideas an what's going on?  I'm running mp1.27 and compiled it with 
EVERYTHING=1

[EMAIL PROTECTED] modperl]# dprofpp logs/dprof/2734/tmon.out
Total Elapsed Time = 7.359757 Seconds
  User+System Time = 0.349757 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 100.   0.350  0.350  1   0.3499 0.3499  MOF::Dispatcher::handler
 0.00   0.000 -0.000  1   0.  -  
MOF::Dispatcher::ProxyCleanup::handler
 0.00   0.000 -0.000  8   0.  -  Apache::Table::TIEHASH
 0.00   0.000 -0.000  1   0.  -  Apache::Table::FETCH
 0.00   0.000 -0.000 16   0.  -  Apache::Table::DESTROY
 0.00   0.000 -0.000  5   0.  -  MOF::DBObject::DESTROY
 0.00   0.000 -0.000 14   0.  -  DBD::Pg::db::prepare
 0.00   0.000 -0.000 14   0.  -  DBI::st::TIEHASH
 0.00   0.000 -0.000 28   0.  -  DBI::st::DESTROY
 0.00   0.000 -0.000 14   0.  -  DBD::_mem::common::DESTROY
 0.00   0.000 -0.000  8   0.  -  IO::Handle::DESTROY
 0.00   0.000 -0.000  1   0.  -  DBD::Pg::db::quote
 0.00   0.000 -0.000  7   0.  -  Apache::PRINT
 0.00   0.000 -0.000  2   0.  -  Image::Magick::DESTROY
 0.00   0.000 -0.000  1   0.  -  MOF::Object::DESTROY



--
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html


Re: problems with characters being added to a request.

2002-11-21 Thread Brian Hirt
Okay, I've been able to create a simple testcase that reproduces the
problem I'm having.  Hopefully some perl/mod_perl guru out there will be
able to tell me what the deal is.   The program basically print out
three strings, concatinates a few strings and print them out too.  I've
attached two files, the handler, and the output of a page it created.

Any help would really be appreciated. 


On Wed, 2002-11-20 at 21:53, Brian Hirt wrote:
 I'm running into a problem with some characters being added during a
 mod_perl request.  An  charater is getting added when i print the
 document  STDOUT.  When i print that exact same variable to STDERR the Â
 is not added.  Here are two hex dumps (via od -hc).  The first is what
 is sent to the web browser, and the 2nd is what is sent to stderr.  The
 issue is coming in with the hex92 and hex96 characters.
 
 This sounds like some encoding issue UTF8/ISO-8859-1??  I can't make
 heads or tails of it.  Any ideas?
 
 Here is a dump (od -hc) of the document that is getting sent to the web
 browser:
 
 0002740 6967 3d6e 3e32 6863 7261 6361 6574 c272
   g   i   n   =   2  c   h   a   r   a   c   t   e   r   Â
 0002760 7392 7720 7469 2068 96c2 6520 6576 686e
 222   s   w   i   t   h   Â 226   e   v   e   n   h
 
 And here is a partial dump of the exact same variable being sent to
 STDERR:
 0002520 3130 302c 640a 636f 3343 635b 6168 6172
   0   1   ,   0  \n   d   o   c   C   3   [   c   h   a   r   a
 0002540 7463 7265 7392 7720 7469 2068 2096 7665
   c   t   e   r 222   s   w   i   t   h 226   e   v
 
 
 Notice that when the variable is sent to STDOUT, r   Â   222 is
 getting printed, and when the variable is sent to STDERR  r 222  is
 getting sent.  I get the added character with IE, Netscape, telnet
 localhost 80 and wget.  So i don't think it with the browser.
 
 
 And here are the exact two lines in my handler that are printing this
 variable:
 
   print STDERR docC3[$docContents]\n;
   print $docContents;
 
 
 I'm using perl 5.8.0, Apache/1.3.26 and mod_perl/1.27
-- 
Brian Hirt [EMAIL PROTECTED]

package WierdHandler;

use MIME::Base64;
use Storable qw(freeze thaw);
use Apache::Constants 'OK';
use strict;

EOF;
Add the handler to your httpd.conf file, and make sure the module is in your search 
path.

Location /wierd
SetHandler perl-script
PerlHandler WierdHandler
/Location
EOF

sub handler
{
  my $apache = shift;
  
  $apache-content_type('text/html; charset=ISO-8859-1');
  $apache-send_http_header;

  print htmlheadtitleblah/title/headbody;

  # notice that the frozen/base64 encoded strings are slightly different.
  my $string1 = 
thaw(decode_base64('BAUEMTIzNAQEBAgXhWh0dHA6Ly93d3cuYW1hem9uLmNvbS9leGVjL29iaWRvcy9yZWRpcmVjdD90YWc9bW9ieWdhbWVzJTI2Y3JlYXRpdmU9RDEySkVYSDg3QjRWTEslMjZjYW1wPTIwMjUlMjZsaW5rX2NvZGU9c3AxJTI2cGF0aD1BU0lOL0IwMDAwMlNVUVY='));
#   ^AgXh^

  my $string2 = 
thaw(decode_base64('BAUEMTIzNAQEBAgKhWh0dHA6Ly93d3cuYW1hem9uLmNvbS9leGVjL29iaWRvcy9yZWRpcmVjdD90YWc9bW9ieWdhbWVzJTI2Y3JlYXRpdmU9RDEySkVYSDg3QjRWTEslMjZjYW1wPTIwMjUlMjZsaW5rX2NvZGU9c3AxJTI2cGF0aD1BU0lOL0IwMDAwMlNVUVY='));
#   ^AgKh^

  my $string3 = characters with  even;

  print h1perl says string 1 and 2 are identical/h1\n if $$string1 eq $$string2;

  print '$string1 is: ul',$$string1,/ul;
  print '$string2 is: ul',$$string2,/ul;
  print '$string3 is: ul',$string3,/ul;
  print hr;

  my $test1 = $string3 . $$string1;
  print '$test1 = $string3 . $string1 is: ul',$test1,/ul;

  my $test2 = $string3 . $$string2;
  print '$test2 = $string3 . $string2 is: ul',$test2,/ul;

  print hrWierd, huh?  If you look in the error log, you'll see that both test1 and 
test2 printed out without that funny looking character.br;

  print /body/html;

  print STDERR test1:[$test1]\n;
  print STDERR test2:[$test2]\n;

  return OK;
}

1;

Title: blah
perl says string 1 and 2 are identical
$string1 is: http://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV$string2 is: http://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV$string3 is: characters with  even$test1 = $string3 . $string1 is: characterÂs with  evenhttp://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQV$test2 = $string3 . $string2 is: characters with  evenhttp://www.amazon.com/exec/obidos/redirect?tag=mobygames%26creative=D12JEXH87B4VLK%26camp=2025%26link_code=sp1%26path=ASIN/B2SUQVWierd, huh?  If you look in the error log, you'll see that both test1 and test2 printed out without that funny looking character.

question about using a proxy with mod_perl

2002-10-18 Thread Brian Hirt

I have a question about setting up a proxy for a mod_perl server.  I've
got a simple proxy set up that listens on port 80 and proxies to the
mod_perl server running on a different port.  

For example. http://blah.blah.com/anything/ will go to
http://blah.blah.com:4374/anything/  and the rules to do that are below.

RewriteEngine on
RewriteLogLevel   0
RewriteRule   ^/(.*)$  http://blah.blah.com:4374/$1   [P,L]
NoCache   *
ProxyPassReverse  /  http://blah.blah.com/

This is fine when you are proxying a single machine name, but how would
i set up a proxy that would send http://a.blah.com -
http://a.blah.com:4374,  http://b.blah.com - http://b.blah.com:4374,
etc etc etc.  There are about 40 different names that need to be
proxied, and it's important that the destination name is the same as the
source machine name.

It seems like something like 
RewriteRule ^http://([^.]+).blah.com/(.*)$   http://$1.blah.com:4374/$2
[P,L] 

should work, but it doesn't.

-- 
Brian Hirt [EMAIL PROTECTED]




Re: mod perl and apache with ssl and openssl

2002-09-24 Thread Brian Hirt

here's a simple script i use to build one of my servers, it builds
openssl, and apache with mod_ssl / mod_perl

On Tue, 2002-09-24 at 09:07, Allan P. Magmanlac wrote:
 Hello,
 
Can anyone advise me on how to build
 apache server with ssl and openssl and
 using mod perl.
 
 this is how I do it WITHOUT mod perl support
 cd to modssl soure directory and then run the following command
 ./configure \
 --with-apache=../apache_1.3.26 \
 --with-ssl=../openssl-0.9.6g  \
 --prefix=/usr/local/root/httpd_1.3.26 \
 --with-crt=/usr/local/root/httpd/usr/local/www/conf/ssl.crt/server.crt \
 --with-key=/usr/local/root/httpd/usr/local/www/conf/ssl.key/server.key \
 --enable-module=proxy
 
 So how would I do it WITH mod perl support. (exact commands would
 be appreciated)
 
 Thanks



# build script
#

export MOD_PERL=mod_perl-1.27
export MOD_PERL_TGZ=${MOD_PERL}.tar.gz

export MOD_SSL=mod_ssl-2.8.10-1.3.26
export MOD_SSL_TGZ=${MOD_SSL}.tar.gz

export OPENSSL=openssl-0.9.6g
export OPENSSL_TGZ=${OPENSSL}.tar.gz
export OPENSSL_PREFIX=/usr/local
export SSL_BASE=../${OPENSSL}

export APACHE=apache_1.3.26
export APACHE_TGZ=${APACHE}.tar.gz
export APACHE_SRC=../$APACHE/src;
export APACHE_PREFIX=/usr

rm -rf $APACHE
rm -rf $MOD_PERL
rm -rf $OPENSSL
rm -rf $MOD_SSL

gunzip  $OPENSSL_TGZ | tar xfop -
gunzip  $APACHE_TGZ | tar xfop -
gunzip  $MOD_SSL_TGZ | tar xfop -
gunzip  $MOD_PERL_TGZ | tar xfop -

cd $OPENSSL
./config --prefix=$OPENSSL_PREFIX
make  make install

cd ../$MOD_SSL
./configure \
--with-apache=../$APACHE \
--with-ssl=../$OPENSSL \
--with-crt=$APACHE_PREFIX/conf/ssl.crt/server.crt \
--with-key=$APACHE_PREFIX/conf/ssl.key/server.key \
--prefix=$APACHE_PREFIX



cd ../$MOD_PERL

perl Makefile.PL \
APACHE_PREFIX=$APACHE_PREFIX \
APACHE_SRC=../$APACHE/src \
DO_HTTPD=1 \
USE_APACI=1 \
EVERYTHING=1 \
APACI_ARGS=' --enable-module=so, \
--enable-module=ssl, \
--enable-module=proxy, \
--disable-module=imap, \
--disable-module=cgi, \
--disable-module=asis, \
--disable-module=autoindex, \
--disable-module=actions, \
--enable-module=info, \
--enable-module=usertrack'

make  make install



Sites Running mod_perl

2000-09-12 Thread Brian Hirt

 This document contains information to give you an idea of where and more 
 importantly, how mod_perl is being used. If you have an interesting 
 mod_perl application, let us know about it! 

FYI:  http://www.mobygames.com, the world's most ambitious and 
comprehensive PC game database project.  This website is written 
100% in mod_perl.

--brian