Problem with EXEC_ON_READ, custom block content

2008-03-24 Thread John Hallam


	I'm trying to create a custom block directive, following the 
documentation in the ModPerl2 book (or the on-line documentation).  The 
minimal code for the problem I am seeing is below.  I have the following 
block in apache2.conf for the new block  and the module is 
in the /root/apache2 tree as required.


---
PerlSwitches -wT -Mlib=/root/apache2
PerlLoadModule MyApache::StdVHost;




Order deny,allow
Deny from all


---

	I see two behaviours:  if EXEC_ON_READ is set, by removing the 
string ', #' in the code below, the handler is never invoked -- at least 
die "..." is not visibly executed;  if EXEC_ON_READ is unset, the handler 
is invoked but $cont is just the first line  and not 
the whole block.  Neither is what I wanted :-((.


	The problem seems to have been reported back in 2005, with similar 
code, and an implication that it was to be fixed.  So what am I doing 
wrong?


Thanks in advance,

John Hallam

---
# PERL module for automating a standard virtual host configuration for Apache

package MyApache::StdVHost;

use strict;
use warnings FATAL => 'all';

use Apache2::Const -compile => qw(RSRC_CONF RAW_ARGS EXEC_ON_READ);

use Apache2::CmdParms ();
use Apache2::Module ();
use Apache2::Directive ();

use Apache2::ServerUtil ();

my @directives
   = (
  # Definition of a StdVHost container
  #
  # Note that EXEC_ON_READ is necessary, according to the
  # mod_perl2 book, but in fact breaks things if included
  # by stopping the handler from being called.

  {
  name  => ' __PACKAGE__ . '::StdVHost',
  errmsg=> 'StdVHost minimal test package',
  args_how  => Apache2::Const::RAW_ARGS,
  req_override  => Apache2::Const::RSRC_CONF, #| 
Apache2::Const::EXEC_ON_READ,
  },
 );

Apache2::Module::add( __PACKAGE__, [EMAIL PROTECTED] );

# Handler for the config directive.
#
# It is unclear how to get the content of the  directive
# container:  maybe it has not been read when this routine is called?
# With RAW_ARGS, the first line of the content is available as
# $parms->directive->as_string but how do you get the rest??

sub StdVHost {
my ($self,$parms,$arg) = @_;
my $cont = $parms->directive->as_string();

die "StdVHost arg='$arg' cont='$cont'";
}

1;


Re: modperl with SSL

2008-03-24 Thread xyon
I also recommend stunnel. It has come through for me in these same
situations without problems.

On Mon, 2008-03-24 at 07:46 -0400, Roberto C. Sánchez wrote:
> On Mon, Mar 24, 2008 at 03:25:26PM +0800, J. Peng wrote:
> > hello list,
> > 
> > we have our own realserver called QHttpd.
> > This realserver doesn't support SSL protocal (https).
> > So I have to develop a proxy before QHttpd to get it be compatible with SSL.
> > I was thinking using modperl handler to do it.
> > modperl accept the SSL connection from clients, do the verification,
> > and if it's valid, redirect it to realserver with non-SSL (common
> > http) protocal.
> > Is it possible? if so, how to begin with it? at which stage?
> > Thanks in advance.
> > 
> Would something like iprelay or stunnel not be sufficient for your
> needs?
> 
> Regards,
> 
> -Roberto



Re: modperl with SSL

2008-03-24 Thread Roberto C . Sánchez
On Mon, Mar 24, 2008 at 03:25:26PM +0800, J. Peng wrote:
> hello list,
> 
> we have our own realserver called QHttpd.
> This realserver doesn't support SSL protocal (https).
> So I have to develop a proxy before QHttpd to get it be compatible with SSL.
> I was thinking using modperl handler to do it.
> modperl accept the SSL connection from clients, do the verification,
> and if it's valid, redirect it to realserver with non-SSL (common
> http) protocal.
> Is it possible? if so, how to begin with it? at which stage?
> Thanks in advance.
> 
Would something like iprelay or stunnel not be sufficient for your
needs?

Regards,

-Roberto
-- 
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com


signature.asc
Description: Digital signature


Re: modperl with SSL

2008-03-24 Thread Issac Goldstand


a backend server - the server that REALly serves the request.

Foo JH wrote:

What is a realserver?

J. Peng wrote:

hello list,

we have our own realserver called QHttpd.
This realserver doesn't support SSL protocal (https).
So I have to develop a proxy before QHttpd to get it be compatible 
with SSL.

I was thinking using modperl handler to do it.
modperl accept the SSL connection from clients, do the verification,
and if it's valid, redirect it to realserver with non-SSL (common
http) protocal.
Is it possible? if so, how to begin with it? at which stage?
Thanks in advance.

B. Regards,
Joy P.
  


Re: modperl with SSL

2008-03-24 Thread J. Peng
realserver, generally, it means a web server like apache, which is
different from a proxy like squid.

On Mon, Mar 24, 2008 at 3:56 PM, Foo JH <[EMAIL PROTECTED]> wrote:
> What is a realserver?
>
>
>
>  J. Peng wrote:
>  > hello list,
>  >
>  > we have our own realserver called QHttpd.
>  > This realserver doesn't support SSL protocal (https).
>  > So I have to develop a proxy before QHttpd to get it be compatible with 
> SSL.
>  > I was thinking using modperl handler to do it.
>  > modperl accept the SSL connection from clients, do the verification,
>  > and if it's valid, redirect it to realserver with non-SSL (common
>  > http) protocal.
>  > Is it possible? if so, how to begin with it? at which stage?
>  > Thanks in advance.
>  >
>  > B. Regards,
>  > Joy P.
>  >
>
>


Re: modperl with SSL

2008-03-24 Thread Foo JH

What is a realserver?

J. Peng wrote:

hello list,

we have our own realserver called QHttpd.
This realserver doesn't support SSL protocal (https).
So I have to develop a proxy before QHttpd to get it be compatible with SSL.
I was thinking using modperl handler to do it.
modperl accept the SSL connection from clients, do the verification,
and if it's valid, redirect it to realserver with non-SSL (common
http) protocal.
Is it possible? if so, how to begin with it? at which stage?
Thanks in advance.

B. Regards,
Joy P.
  




modperl with SSL

2008-03-24 Thread J. Peng
hello list,

we have our own realserver called QHttpd.
This realserver doesn't support SSL protocal (https).
So I have to develop a proxy before QHttpd to get it be compatible with SSL.
I was thinking using modperl handler to do it.
modperl accept the SSL connection from clients, do the verification,
and if it's valid, redirect it to realserver with non-SSL (common
http) protocal.
Is it possible? if so, how to begin with it? at which stage?
Thanks in advance.

B. Regards,
Joy P.