perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip M. Gollucci" <pgollu...@p6m7g8.com>
Subject Re: mp1 to mp2: server info in startup.pl
Date Wed, 24 Aug 2005 01:08:31 GMT
Philip M. Gollucci wrote:
>> In mp2 I am doing this:
>> -----------------------
>> use Apache2::ServerRec ();
>> use Apache2::ServerUtil ();
>> my $s = Apache2::ServerUtil->server();
>> warn "port = ",$s->port(),"\n";
> 
> Try
> use Apache2::RequestUtil ();
> Apache2::RequestUtil->request()->get_server_port()
> 
> Though I don't see why your method doesn't work. I'll give it a spin in 
> a bit.
Okay, I'll verify that neither method works from startup.pl whether I pull it in via
PerlRequire or PerlPostConfigRequire.

I will say that the following handler gives me mixed Results:

package TEST::Port;

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

use Apache2::RequestUtil ();
use Apache2::ServerUtil ();

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

sub handler {

     my $r = shift;

     $r->content_type('text/html');

     my $s = $r->server();
     my $port1 = $s->port();
     my $port2 = $r->get_server_port();
     my $port3 = Apache2::ServerUtil->server()->port();

     $r->print("Ports: $port1, $port2, $port3 <br />\n");

     return Apache2::Const::OK;
}

Gives me:

Ports: 0, 8000, 0

I checked in httpd/server/core.c:ap_get_server_port() via gdb and yes,
it does return 8000.  So that verifies #2 works.

As far as I can tell 1, 3 don't come through this function.. but I can't for the life of me
figure out where the hell
they do go.  Any ideas?

I also can't see where $s->port() is tested in the test suite.  Only $r->get_server_port
is which works :)

I would assume the end up calling the same function though.




-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


Mime
View raw message