Alias

2009-11-11 Thread Idel Fuschini
Hi,
i've got in httpd.conf this directive

Alias /dummy/ "/var/local/apache2/example"

How can I take the real path value ?

Idel


alias command in modperl environment

2012-12-19 Thread Feng He

Hello,


ServerAdmin x...@yyy.com
ServerName example.com

PerlModule Apache::DBI
PerlPostConfigRequire /path/to/startup.pl


SetHandler modperl
PerlResponseHandler Handler1



SetHandler modperl
PerlResponseHandler Handler2


Alias /zzz/ "/var/www/zzz/"

Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/cdn.access.log combined




I put some static files under /var/www/zzz/.
When accessing these static files, I got 403 error.
Can't alias command work for this case?

Thanks.


Problems with SetEnv and Alias

2009-05-24 Thread Geoff Toogood




Hi Guys,

This has most likely been answered before but I have to ask as I have
searched this mailing list and can't find the answer I am looking for.
It is also most likely in the mod_perl 2,0 documentation and if there
is a relevant part of it you can point me to regarding my issue that
would be good!

I am running mod_perl 2 on a debian server using apache2 

I have a  directive which incorporates a mod_perl
PerlTransHandler. This VirtualHost block of the config also has some
Alias and SetEnv directives defined.

The PerlTransHandler module behaves correctly and works well but it
seems that when I execute a PHP document under this VirtualHost I lose
the $_SERVER (%ENV in perl) variables and Alias settings I have set in
the Apache VirtualHost block of my config.

Attached is my PerlTransHandler and my PerlFixupHandler as well as my
Apache configuration. 

-- 

Kind regards,
Geoff T

 



  

  
   Geoff Toogood
  Analyst / Programmer & System Administration 
   a: Level 5, 128 Bundall Rd, Bundall QLD 4217,
Australia
  t: +61 7 5574 0681   f: +61 7 5574 0932
  e: ge...@allotz.com
  w: www.allotz.com 
  
  
  

  

Allotz is a proud member of the following associations...
 
  

  
  




  






ServerName www.test.com
ServerAlias www.test.com
ServerAdmin webmas...@test.com


use lib '/etc/SysAdmin/perl5/Handlers/';


DocumentRoot /vhosts/www/htdocs/
CustomLog /vhosts/www/logs/http-accesslog combined
ErrorLog /vhosts/www/logs/http-errorlog

PerlTransHandler +MyTransHandler
PerlFixupHandler +MyFixUpHandler
   
PerlSetEnv ConfigPath /etc/SysAdmin/perl5/
Alias /css/main.css /etc/SysAdmin/PrivateLabel/trunk/2/css/main.css




package MyFixUpHandler;

use strict;
use warnings FATAL => qw(all);

use Apache2::Const -compile => qw(DIR_MAGIC_TYPE OK DECLINED);
use Apache2::RequestRec;

sub handler {

	my $r = shift;

	if ($r->handler eq 'perl-script' && -d $r->filename && $r->is_initial_req){
		$r->handler(Apache2::Const::DIR_MAGIC_TYPE);
		return Apache2::Const::OK;
	}

	return Apache2::Const::DECLINED;

}

1;

package MyTransHandler;

use Apache2::RequestRec ();
use Apache2::Const -compile => qw(OK REDIRECT DECLINED);

sub handler {

	my $r = shift;

	my $dbh;

	my $ClientID = 0;

	if ($r->hostname() =~ /^(\d*).test.com$/) {

		$r->subprocess_env('DB' => 'test');
		$dbh = connectdb('test');
		$ClientID = $1;
	
	}else{

		$r->headers_out->set(Location => "http://www.test.com";);
 		$r->status(REDIRECT);
		return Apache2::Const::REDIRECT;

	}

	# check if client exists
	my $sth = $dbh->prepare(qq{
		SELECT * FROM Clients WHERE id=(?)
	});
	$sth->execute($ClientID);
	my $ClientData = $sth->fetchrow_hashref;
	$sth->finish;

	if (not defined $ClientData) {

		$r->headers_out->set(Location => "http://www.test.com";);
 		$r->status(REDIRECT);
		return Apache2::Const::REDIRECT;

	}else{

		foreach my $key ( keys(%{$ClientData}) ) {

			$r->subprocess_env('CLIENT_'.$key => $ClientData->{$key});

		}
	
		foreach my $key ( keys(%db) ) {

			$r->subprocess_env('CLIENT_DATABASE_'.$key => $db{$key});

		}
	
	}


	return Apache2::Const::DECLINED;

}

###
1



Re: alias command in modperl environment

2012-12-19 Thread Jie Gao
What's the error message in your errlog.log?


-Jie 


Please think of our environment and only print this e-mail if necessary.

* Feng He  wrote:

> Date: Wed, 19 Dec 2012 16:40:13 +0800
> From: Feng He 
> To: modperl@perl.apache.org
> Subject: alias command in modperl environment
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0
>  Thunderbird/17.0
> 
> Hello,
> 
> 
> ServerAdmin x...@yyy.com
> ServerName example.com
> 
> PerlModule Apache::DBI
> PerlPostConfigRequire /path/to/startup.pl
> 
> 
> SetHandler modperl
> PerlResponseHandler Handler1
> 
> 
> 
> SetHandler modperl
> PerlResponseHandler Handler2
> 
> 
> Alias /zzz/ "/var/www/zzz/"
> 
> Options FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> allow from all
> 
> 
> ErrorLog /var/log/apache2/error.log
> LogLevel warn
> CustomLog /var/log/apache2/cdn.access.log combined
> 
> 
> 
> 
> I put some static files under /var/www/zzz/.
> When accessing these static files, I got 403 error.
> Can't alias command work for this case?
> 
> Thanks.


Re: alias command in modperl environment

2012-12-19 Thread Feng He

于 2012-12-19 16:47, Jie Gao 写道:

What's the error message in your errlog.log?


it simply said access reject.


Re: alias command in modperl environment

2012-12-19 Thread Jie Gao
Raise loglevel to debug and see what you get in the log then. -Jie

* Feng He  wrote:

> Date: Wed, 19 Dec 2012 17:05:20 +0800
> From: Feng He 
> To: Jie Gao 
> CC: modperl@perl.apache.org
> Subject: Re: alias command in modperl environment
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0
>  Thunderbird/17.0
> 
> 于 2012-12-19 16:47, Jie Gao 写道:
> >What's the error message in your errlog.log?
> 
> it simply said access reject.


Re: alias command in modperl environment

2012-12-19 Thread André Warnier

Feng He wrote:

Hello,


ServerAdmin x...@yyy.com
ServerName example.com

PerlModule Apache::DBI
PerlPostConfigRequire /path/to/startup.pl


SetHandler modperl
PerlResponseHandler Handler1



SetHandler modperl
PerlResponseHandler Handler2


Alias /zzz/ "/var/www/zzz/"

Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/cdn.access.log combined




I put some static files under /var/www/zzz/.
When accessing these static files, I got 403 error.
Can't alias command work for this case?



I believe that you have the following problem :

What you specify in the "", by default, is inherited by all "sub-Locations" of 
"/", so for example the location "/zzz/" inherits the "SetHandler modperl" from the 
location "/".

I don't remember the exact syntax, but try to add the following :


  SetHandler default   (or maybe it is "none")
  .. (other directives)


Generally, I try to avoid setting a special handler or other special rules for the 
Location "/", for precisely that kind of reason : you find that you then need to override 
these defaults in every sub-directory of your setup.


Re: alias command in modperl environment

2012-12-19 Thread Andy Colson

On 12/19/2012 2:40 AM, Feng He wrote:

Hello,


 ServerAdmin x...@yyy.com
 ServerName example.com

 PerlModule Apache::DBI
 PerlPostConfigRequire /path/to/startup.pl

 
 SetHandler modperl
 PerlResponseHandler Handler1
 

 
 SetHandler modperl
 PerlResponseHandler Handler2
 

 Alias /zzz/ "/var/www/zzz/"
 
 Options FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 

 ErrorLog /var/log/apache2/error.log
 LogLevel warn
 CustomLog /var/log/apache2/cdn.access.log combined




I put some static files under /var/www/zzz/.
When accessing these static files, I got 403 error.
Can't alias command work for this case?

Thanks.


Here is an apache config I use that works:

PerlSwitches -I "/pub/www/world"
PerlModule World


PerlSetupEnv Off
SetHandler modperl
PerlResponseHandler World
Order allow,deny
Allow from all



SetHandler default-handler
Allow from all



SetHandler default-handler
    Allow from all


Alias /world/css /pub/www/world/css
Alias /world/js /pub/www/world/js


-Andy


Re: alias command in modperl environment

2012-12-19 Thread Feng He

Thanks a lot.


于 2012-12-19 23:02, Andy Colson 写道:

On 12/19/2012 2:40 AM, Feng He wrote:

Hello,


 ServerAdmin x...@yyy.com
 ServerName example.com

 PerlModule Apache::DBI
 PerlPostConfigRequire /path/to/startup.pl

 
 SetHandler modperl
 PerlResponseHandler Handler1
 

 
 SetHandler modperl
 PerlResponseHandler Handler2
 

 Alias /zzz/ "/var/www/zzz/"
 
 Options FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 

 ErrorLog /var/log/apache2/error.log
 LogLevel warn
 CustomLog /var/log/apache2/cdn.access.log combined




I put some static files under /var/www/zzz/.
When accessing these static files, I got 403 error.
Can't alias command work for this case?

Thanks.


Here is an apache config I use that works:

PerlSwitches -I "/pub/www/world"
PerlModule World


 PerlSetupEnv Off
 SetHandler modperl
 PerlResponseHandler World
 Order allow,deny
 Allow from all



 SetHandler default-handler
 Allow from all



 SetHandler default-handler
     Allow from all


Alias /world/css /pub/www/world/css
Alias /world/js /pub/www/world/js


-Andy




Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Jonathan Vanasco


I need to re-integrate disconnect back into Apache::DBI managed  
connections


my choices are either:
	a- do it in some hacktastical manner that is useful only to me, but  
takes 20 minutes to implement
	b- do it as an actual reintegration/patch to Apache::DBI that others  
can use , but takes way longer to do


would anyone else have a use for this?  if not, i'm going to do it in  
a craptastical way.


otherwise, i'm thinking of basically renaming disconnect to  
'_original_disconnect' or 'disconnect_real' , then overriding  
disconnect as normal.  not really sure how i'd accomplish the  
namespace mangling, but i'll figure something out.





| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -



Re: Problems with SetEnv and Alias

2009-05-27 Thread Fred Moyer
On Sun, May 24, 2009 at 11:30 PM, Geoff Toogood  wrote:
> Hi Guys,
>
> This has most likely been answered before but I have to ask as I have
> searched this mailing list and can't find the answer I am looking for. It is
> also most likely in the mod_perl 2,0 documentation and if there is a
> relevant part of it you can point me to regarding my issue that would be
> good!
>
> I am running mod_perl 2 on a debian server using apache2
>
> I have a  directive which incorporates a mod_perl
> PerlTransHandler. This VirtualHost block of the config also has some Alias
> and SetEnv directives defined.
>
> The PerlTransHandler module behaves correctly and works well but it seems
> that when I execute a PHP document under this VirtualHost I lose the
> $_SERVER (%ENV in perl) variables and Alias settings I have set in the
> Apache VirtualHost block of my config.

Can you show us how you are executing the PHP document?


>
> Attached is my PerlTransHandler and my PerlFixupHandler as well as my Apache
> configuration.
>
> --
> Kind regards,
> Geoff T
>
>
>
> 
>
>        ServerName www.test.com
>        ServerAlias www.test.com
>        ServerAdmin webmas...@test.com
>
>        
>                use lib '/etc/SysAdmin/perl5/Handlers/';
>        
>
>        DocumentRoot /vhosts/www/htdocs/
>        CustomLog /vhosts/www/logs/http-accesslog combined
>        ErrorLog /vhosts/www/logs/http-errorlog
>
>        PerlTransHandler +MyTransHandler
>        PerlFixupHandler +MyFixUpHandler
>
>        PerlSetEnv ConfigPath /etc/SysAdmin/perl5/
>        Alias /css/main.css /etc/SysAdmin/PrivateLabel/trunk/2/css/main.css
>
> 
>
>
>
>


Re: Problems with SetEnv and Alias

2009-05-27 Thread Perrin Harkins
On Mon, May 25, 2009 at 2:30 AM, Geoff Toogood  wrote:
> I have a  directive which incorporates a mod_perl
> PerlTransHandler. This VirtualHost block of the config also has some Alias
> and SetEnv directives defined.
>
> The PerlTransHandler module behaves correctly and works well but it seems
> that when I execute a PHP document under this VirtualHost I lose the
> $_SERVER (%ENV in perl) variables and Alias settings I have set in the
> Apache VirtualHost block of my config.

That should work.  Can you try it with a simple CGI script, to see if
the PHP config is the problem?

- Perrin


Re: Problems with SetEnv and Alias

2009-06-01 Thread Geoff Toogood




Perrin Harkins wrote:

  On Mon, May 25, 2009 at 2:30 AM, Geoff Toogood  wrote:
  
  
I have a  directive which incorporates a mod_perl
PerlTransHandler. This VirtualHost block of the config also has some Alias
and SetEnv directives defined.

The PerlTransHandler module behaves correctly and works well but it seems
that when I execute a PHP document under this VirtualHost I lose the
$_SERVER (%ENV in perl) variables and Alias settings I have set in the
Apache VirtualHost block of my config.

  
  
That should work.  Can you try it with a simple CGI script, to see if
the PHP config is the problem?

- Perrin
  

I just thought respond to this and say that it worked fine with a Perl
CGI script. I did manage to get things working for PHP in the end. I
was using  in the VirtualHost section (along
with NameVirtualHost *:80), as soon as I changed this and defined an IP
address instead of * (effectively making it not use NameVirtualHost) it
worked!!

That was not really a solution for me because it means I need to have a
separate IP address for each of these VirtualHost sections I may want
to add Alias' or set ENV variables in the config :oS Anyone know why
that might be? (I know it is not really a modperl
related question, more of an apache question so feel free to ignore it
:o) 
FYI I have a standard debian linux setup running apache2 and modperl. 

Thanks for all your help guys.

Geoff T


-- 

Kind regards,
Geoff T



  

  
   Geoff Toogood
  Analyst / Programmer & System Administration 
   a: Level 5, 128 Bundall Rd, Bundall QLD 4217,
Australia
  t: +61 7 5574 0681   f: +61 7 5574 0932
  e: ge...@allotz.com
  w: www.allotz.com 
  
  
  

  

Allotz is a proud member of the following associations...
 
  

  
  




  






OT hint on FTPD with 'Alias Match'

2004-01-19 Thread c . hauser
Hello 


I'm using happily 'Alias Match' in Apache and dynamic handlers in Mason. For 
the content contributors we use MM Contribute via FTP. 

When they browse to a page which is represented by a file, they can edit 
directly. 

Assume that they visit:

/fr/path/index.html

but the file is accesible by FTP as:

/path/index.fr.html

The FTPD should respond to the first and deliver the later. 

I'm looking for a hint how to configure that and on which FTP deamons it would 
be possible? Even one which would accept perl handlers? Thanks a lot.  


Christian 


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



Re: Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Perrin Harkins
On Thu, 2006-05-25 at 18:32 -0400, Jonathan Vanasco wrote:
> I need to re-integrate disconnect back into Apache::DBI managed  
> connections

What problem are you trying to solve?  You might find it more useful to
replace Apache::DBI with DBI->connect_cached.  Keep in mind though, you
will have to take care of not opening connections during startup and
doing safety rollbacks in a cleanup handler yourself, which Apache::DBI
normally does for you.

- Perrin



Re: Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Jonathan Vanasco


On May 25, 2006, at 6:52 PM, Perrin Harkins wrote:
What problem are you trying to solve?  You might find it more  
useful to
replace Apache::DBI with DBI->connect_cached.  Keep in mind though,  
you

will have to take care of not opening connections during startup and
doing safety rollbacks in a cleanup handler yourself, which  
Apache::DBI

normally does for you.


closing read-only connections opened / closed at startup

depending on the project's load order, Apache::DBI is sometimes  
loaded beforehand, resulting in a useless connection that i can't  
disconnect.


my current options are refactor 4 giant applications, or build  
disconnect back into Apache::DBI.  the latter is waay easier.





| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -






Re: Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Perrin Harkins
On Thu, 2006-05-25 at 19:18 -0400, Jonathan Vanasco wrote:
> closing read-only connections opened / closed at startup

Connections opened during startup shouldn't be persisted by Apache::DBI.
Maybe you've found a bug.

> depending on the project's load order, Apache::DBI is sometimes  
> loaded beforehand, resulting in a useless connection that i can't  
> disconnect.

It's intended to load beforehand.

> my current options are refactor 4 giant applications, or build  
> disconnect back into Apache::DBI.  the latter is waay easier.

There are some simple but ugly ways to do it.  One is to call
$dbh->DBI::db::disconnect() (or whatever the correct class is there).

- Perrin



Re: Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Clinton Gormley
> On Thu, 2006-05-25 at 19:18 -0400, Jonathan Vanasco wrote:
> > closing read-only connections opened / closed at startup
> 
> Connections opened during startup shouldn't be persisted by Apache::DBI.
> Maybe you've found a bug.
> 
There is indeed a bug under Apache 2 - I submitted a patch for this a
while ago.

http://marc.theaimsgroup.com/?l=apache-modperl&m=113849587917682&w=2

clinton



Re: Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Jonathan Vanasco


perhaps its a bug.  i don't know.

basically, i have this:

BEGIN
{
use MyApp::DB::Config;
my  $DB_config = MyApp::DB::Config->new();
		$DB_config->dbconnect(); # connects and stores a dbh in a wrapper  
class  $DB_config->{'DBH'}

=snip
pull some startup config vars
=cut
$DB_config->dbdisconnect();
$DB_config = undef;
}

dbdisconnect does this in the wrapper class:
$_[0]->{'DBH'}->disconnect();
$_[0]->{'DBH'} = undef;

that never disconnects from the db ( i even tossed in undef'ing the  
objects so they'd get __DESTROY__'ed, but no luck.


i tried doing

$_[0]->{'DBH'}->DBI::db::disconnect();

that worked perfect.


| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -






Re: Apache::DBI - alias disconnect before overload?

2006-05-25 Thread Philip M. Gollucci

Clinton Gormley wrote:

On Thu, 2006-05-25 at 19:18 -0400, Jonathan Vanasco wrote:

closing read-only connections opened / closed at startup

Connections opened during startup shouldn't be persisted by Apache::DBI.
Maybe you've found a bug.


There is indeed a bug under Apache 2 - I submitted a patch for this a
while ago.

http://marc.theaimsgroup.com/?l=apache-modperl&m=113849587917682&w=2

So sorry, I've been swamped.

I've marked it in RED in my inbox, but I'm not sure when I'm going to get to it.

If anyone wants to ping rpsier, or ask to have them fix the svn write access on 
svn.perl.org
for Apache-DBI I might be able to get to it sooner.


--

Philip M. Gollucci ([EMAIL PROTECTED]) 323.219.4708
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com
1024D/A79997FA F357 0FDD 2301 6296 690F  6A47 D55A 7172 A799 97F

"It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone..."


Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread Roger Munk
I have the following directives in my sites-available/default configuration:

   DocumentRoot /var/www/
   Alias /portal/ /var/www/drupal6/
   PerlRequire "/etc/apache2/ModPerl/TE/ST.pm"

SetHandler modperl
PerlOutputFilterHandler TE::ST


When the SetHandler and PerlOutputFilterHandler are commented out, the
redirection from /portal to /var/www/drupal6 works correctly. However,
when the SetHandler and PerlOutputFilterHander are enabled I get the
following error messages:


[Mon Feb 16 22:43:40 2009] [error] [client 192.168.1.2] Attempt to
serve directory: /var/www/drupal6/, referer: http://10.0.0.1/portal/
[Mon Feb 16 22:43:40 2009] [error] [client 192.168.1.2] script
'/var/www/index.php' not found or unable to stat, referer:
http://10.0.0.1/portal/

Why would the SetHandler and PerlOutputFilterHandler stop the Alias
directive from working correctly?

- Roger


Re: Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread Torsten Foertsch
On Sun 15 Feb 2009, Roger Munk wrote:
> I have the following directives in my sites-available/default
> configuration:
>
>        DocumentRoot /var/www/
>        Alias /portal/ /var/www/drupal6/
>        PerlRequire "/etc/apache2/ModPerl/TE/ST.pm"
>         
>             SetHandler modperl
>             PerlOutputFilterHandler TE::ST
>         
>
> When the SetHandler and PerlOutputFilterHandler are commented out,
> the redirection from /portal to /var/www/drupal6 works correctly.
> However, when the SetHandler and PerlOutputFilterHander are enabled I
> get the following error messages:
>
>
> [Mon Feb 16 22:43:40 2009] [error] [client 192.168.1.2] Attempt to
> serve directory: /var/www/drupal6/, referer: http://10.0.0.1/portal/
> [Mon Feb 16 22:43:40 2009] [error] [client 192.168.1.2] script
> '/var/www/index.php' not found or unable to stat, referer:
> http://10.0.0.1/portal/
>
> Why would the SetHandler and PerlOutputFilterHandler stop the Alias
> directive from working correctly?

It does not. You see the first message? That is the result of the alias. 
The thing that confuses me is what do you want to achieve 
by "SetHandler modperl" but leaving out the PerlResponseHandler?

If your page is generated by php and you only want to postprocess it on 
its way out then drop the SetHandler. The PerlOutputFilterHandler does 
not need a "SetHandler modperl".

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foert...@gmx.net


Re: Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread Roger Munk
On Sun, Feb 15, 2009 at 4:05 PM, Torsten Foertsch
 wrote:

> If your page is generated by php and you only want to postprocess it on
> its way out then drop the SetHandler. The PerlOutputFilterHandler does
> not need a "SetHandler modperl".

Thanks, that was perfect. One more follow-up question. I want to
filter the cookies that the app sets when the user authenticates. The
app returns two 'Set-Cookie' headers, ie:

HTTP/1.1 200 OK
Date: Mon, 16 Feb 2009 14:25:27 GMT
Server: Apache
Set-Cookie: SESSf735b3e5ffd445f569dafde349c14e35=deleted; expires=Sun,
17-Feb-2008 14:25:26 GMT; path=/
Set-Cookie: 
SESSf735b3e5ffd445f569dafde349c14e35=8281d2673e2a2d6625ec7a94ea3d9716;
expires=Wed, 11 Mar 2009 17:58:47 GMT; path=/; HttpOnly


My output filter handler gets the cookies  via:

my $Cookie = $f->r->headers_out->get("Set-Cookie");

and then removes the expires=date bit with:

if ($Cookie)
{
$Cookie =~ s/expires.*GMT\;//g;
$f->r->headers_out->set("Set-Cookie" => "$Cookie");
}

The problem is that this code only seems to remove the expires date in
the first cookie. The second cookie never shows up in the filtered
HTTP response headers. How can I filter the second cookie as well?

Thanks

- Roger


Re: Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread André Warnier

Roger Munk wrote:

I have the following directives in my sites-available/default configuration:

   DocumentRoot /var/www/
   Alias /portal/ /var/www/drupal6/
   PerlRequire "/etc/apache2/ModPerl/TE/ST.pm"

SetHandler modperl
PerlOutputFilterHandler TE::ST



See Torsten's response for the SetHandler.
But apart from that, the combination of these 3 directives sounds a bit
strange to me :

  DocumentRoot /var/www/
  Alias /portal/ /var/www/drupal6/
  


The first one means that your "document root" (in other words the
filesystem area that corresponds to the URL "/") is /var/www.
In other words, if someone requests "/drupal6", he gets to
/var/www/drupal6, and if he requests "/drupal6/abc.html", he gets
/var/www/drupal6/abc.html (if it exists).
Then the alias says that "/portal/" also maps to "/var/www/drupal6/". So
now the users have 2 ways to get there : "/drupal6" and "/portal/".
So if the user requests "/portal/abc.html", he really gets
"/var/www/drupal6/abc.html" also.
Allright, so you want to make it easy for users, they just have to
remember "portal" instead of "drupal6" (and maybe for you too, if some
day you change that to "drupal7").

But then the  relates to (and only to) when users request
"/portal/".
In other words, whatever you put in that Location section does not apply
when users request the same document via "/drupal6".
So if the user requests "/portal/abc.html", the Perl output filter would
be called, but if they ask for "/drupal6/abc.html", it would not run,
although they would get the same document abc.html.

I'm thinking that this is not necessarily the effect you want to
achieve, so what is it that you want to achieve ?




Re: Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread André Warnier

Roger Munk wrote:

On Sun, Feb 15, 2009 at 4:05 PM, Torsten Foertsch
 wrote:


If your page is generated by php and you only want to postprocess it on
its way out then drop the SetHandler. The PerlOutputFilterHandler does
not need a "SetHandler modperl".


Thanks, that was perfect. One more follow-up question. I want to
filter the cookies that the app sets when the user authenticates. The
app returns two 'Set-Cookie' headers, ie:

HTTP/1.1 200 OK
Date: Mon, 16 Feb 2009 14:25:27 GMT
Server: Apache
Set-Cookie: SESSf735b3e5ffd445f569dafde349c14e35=deleted; expires=Sun,
17-Feb-2008 14:25:26 GMT; path=/
Set-Cookie: 
SESSf735b3e5ffd445f569dafde349c14e35=8281d2673e2a2d6625ec7a94ea3d9716;
expires=Wed, 11 Mar 2009 17:58:47 GMT; path=/; HttpOnly


My output filter handler gets the cookies  via:

my $Cookie = $f->r->headers_out->get("Set-Cookie");


see http://perl.apache.org/docs/2.0/api/APR/Table.html#C_get_
(you only get the first one this way)
my @cookies = $f->r->headers_out->get("Set-Cookie");
would get you an array with both.


and then removes the expires=date bit with:

if ($Cookie)
{
$Cookie =~ s/expires.*GMT\;//g;
$f->r->headers_out->set("Set-Cookie" => "$Cookie");
}

The problem is that this code only seems to remove the expires date in
the first cookie. The second cookie never shows up in the filtered
HTTP response headers. How can I filter the second cookie as well?

Thanks

- Roger





Re: Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread Roger Munk
On Sun, Feb 15, 2009 at 5:12 PM, André Warnier  wrote:
> see http://perl.apache.org/docs/2.0/api/APR/Table.html#C_get_
> (you only get the first one this way)
> my @cookies = $f->r->headers_out->get("Set-Cookie");
> would get you an array with both.

Thanks, when I tried receiving the cookies in an array, using the code
below, I only see the second cookie now in the output. Since both
cookies are set with seperate "Set-Cookie" headers are they getting
overwritten at some point, or is there a problem with my code?

unless ($f->ctx)
{
my @Cookies = $f->r->headers_out->get("Set-Cookie");

foreach my $Cookie (@Cookies)
{
$Cookie =~ s/expires.*GMT\;//g;
$f->r->headers_out->set("Set-Cookie" => "$Cookie");
}
$f->ctx(1);
}

- Roger


Re: Alias and PerlOutputFilterHandler in virtual host configuration

2009-02-15 Thread Torsten Foertsch
On Sun 15 Feb 2009, Roger Munk wrote:
> On Sun, Feb 15, 2009 at 5:12 PM, André Warnier  wrote:
> > see http://perl.apache.org/docs/2.0/api/APR/Table.html#C_get_
> > (you only get the first one this way)
> > my @cookies = $f->r->headers_out->get("Set-Cookie");
> > would get you an array with both.
>
> Thanks, when I tried receiving the cookies in an array, using the
> code below, I only see the second cookie now in the output. Since
> both cookies are set with seperate "Set-Cookie" headers are they
> getting overwritten at some point, or is there a problem with my
> code?
>
>     unless ($f->ctx)
>     {
>         my @Cookies = $f->r->headers_out->get("Set-Cookie");
>
>         foreach my $Cookie (@Cookies)
>         {
>             $Cookie =~ s/expires.*GMT\;//g;
>             $f->r->headers_out->set("Set-Cookie" => "$Cookie");
>         }
>         $f->ctx(1);
>     }

I am about to say RTFM but being polite: Please read the documentation 
mentioned above more thouroughly. APR::Table provides an "add" method. 
And before you ask your next question "How can I get rid of the 
original cookies?" read that piece again, ;-)

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foert...@gmx.net


Alias is not being recognized undet the Directory Directive

2005-04-06 Thread raja agireddy
I have installed modperl 2.0,  Apache 2.0 and AuthenSmb. Alias is not
being recognized under the "Directory" directive in the httpd.conf
file. The same alis works for "Location" directive. The work around I
am using is giving the full path of the directory and it works. Please
let me know if you have any suggestions or reason for this behaviour.
Under the Directory directive I am using PerlAuthenHandler.

Following is the usage

> 
> AuthName "ISO Authentication"
> AuthType Basic
> PerlAuthenHandler Apache::AuthenSmb
> PerlSetVar myPDC acdc01
> PerlSetVar myBDC acdc02
> PerlSetVar myDOMAIN xxx.com
> Require valid-user
> Options FollowSymLinks
> 
>
> Where as when I use the following the authentication box pops up.
> 
> AuthName "ISO Authentication"
> AuthType Basic
> PerlAuthenHandler Apache::AuthenSmb
> PerlSetVar myPDC acdc01
> PerlSetVar myBDC acdc02
> PerlSetVar myDOMAIN xxx.com
> Require valid-user
> Options FollowSymLinks
> 
>

Regards,
Raja


Problem running Perl scripts with mod_perl from Alias directory

2008-02-19 Thread Billeb, Andrew (ATS, IT)
Hello mod_perl Gurus,

I'm not sure if this is a mod_perl issue or just an Apache configuration
issue.  Please redirect me if appropriate.

My Configuration:
Apache/2.2.8 (Win32)
Perl: v5.8.8
mod_perl 2.0
I have also followed all the directions through the Registry Scripts
section at: http://perl.apache.org/docs/2.0/os/win32/config.html

Here's The Problem
I have several Perl scripts and a module in C:/Apache2/cgi-bin/ridhwan/.
Each script has a submit button that will display a new page. All my
scripts work fine when accessed from this type of URL: 

http://localhost/cgi-bin/ridhwan/script_name.pl 

I would like to use mod_perl to handle these scripts.  So, rather than
set up a new directory on the filesystem, I have put the following in
the httpd.conf file.  Note that it is supposed to remove the /cgi-bin/
part of the path: 
 
Alias /ridhwan/ "C:/Apache2/cgi-bin/ridhwan/" 
 
   SetHandler perl-script 
   PerlResponseHandler ModPerl::Registry 
   Options +ExecCGI 
   PerlOptions +ParseHeaders 
 

The result is that when I click on a URL like the following (i.e.
missing the the /cgi-bin/): 

http://localhost/ridhwan/script_name.pl 

the script displays finebut clicking the submit button doesn't do
anythingit just redisplays the same page. But it's the *same script*
as in the first link.  It's just being accessed through the alias. So, I
don't understand why it doesn't work.

Any idea what's wrong?

Thanks,
Andrew



*
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*



Re: Alias really helpful -- Any more good tips like this?

2004-07-04 Thread Stas Bekman
Please don't forget to send the questions to the modperl list, not me. Thank you.
David Arnold wrote:
Stas et al,
I found this tip from Stas very helpful:

% lookup connection
To use method 'connection' add:
   use Apache::RequestRec ();
% lookup remote_ip
To use method 'remote_ip' add:
   use Apache::Connection ();
% alias lookup
perl -MApache2 -MModPerl::MethodLookup -e print_method

Any more good ones like this you want to share?
When I gave you these examples I've quoted the URL of the manpage which gives 
you all the information that you need. Here it is again:

http://perl.apache.org/docs/2.0/api/ModPerl/MethodLookup.html
For example, suppose I run:
[EMAIL PROTECTED] apache2]$lookup server_root_relative
There is more than one class with method 'server_root_relative'
try one of:
use Apache::Connection ();
use Apache::RequestRec ();
use Apache::ServerUtil ();
Now, is there anything I can type at the command line to get help with this
method or any of these modules?
It's explained at the quoted manpage.
--
__
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
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Problem running Perl scripts with mod_perl from Alias directory

2008-02-19 Thread Colin Wetherbee

Billeb, Andrew (ATS, IT) wrote:
The result is that when I click on a URL like the following (i.e. 
missing the the /cgi-bin/):


_http://localhost/ridhwan/script_name.pl_

the script displays fine….but clicking the submit button doesn't do
 anythingit just redisplays the same page. But it's the *same
script* as in the first link.  It's just being accessed through the
alias. So, I don't understand why it doesn't work.


Could you be more specific here?

For example, "doesn't do anything" and "redisplays the same page" are
contradictory statements.  What exactly happens?

Colin


RE: Problem running Perl scripts with mod_perl from Alias directory

2008-02-20 Thread Billeb, Andrew (ATS, IT)
Thanks Colinyou're right, my wording wasn't great.  

If I click the submit button, the page just resets to the default page.
(To be more clear.there is a popup_menu and a submit button.  If I
select a value in the popup_menu, and then click submit, the page just
resets to how it appeared before I even selected the value from the
popup_menu.)

Note: The same script works fine when called from the non-alias path.

Thanks,
Andrew

Andrew Billeb | ATS - Config | 860-547-5983 |
[EMAIL PROTECTED]

-Original Message-
From: Colin Wetherbee [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 19, 2008 5:05 PM
To: Billeb, Andrew (ATS, IT)
Cc: modperl@perl.apache.org
Subject: Re: Problem running Perl scripts with mod_perl from Alias
directory

Billeb, Andrew (ATS, IT) wrote:
> The result is that when I click on a URL like the following (i.e. 
> missing the the /cgi-bin/):
> 
> _http://localhost/ridhwan/script_name.pl_
> 
> the script displays finebut clicking the submit button doesn't do

> anythingit just redisplays the same page. But it's the *same
> script* as in the first link.  It's just being accessed through the 
> alias. So, I don't understand why it doesn't work.

Could you be more specific here?

For example, "doesn't do anything" and "redisplays the same page" are
contradictory statements.  What exactly happens?

Colin


*
This communication, including attachments, is
for the exclusive use of addressee and may contain proprietary,
confidential and/or privileged information.  If you are not the intended
recipient, any use, copying, disclosure, dissemination or distribution is
strictly prohibited.  If you are not the intended recipient, please notify
the sender immediately by return e-mail, delete this communication and
destroy all copies.
*