Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: devel

Re: [8451] * Added `Bric::Util::ApacheReq->url` and put it to use in various

 

 

Bricolage devel RSS feed   Index | Next | Previous | View Threaded


adrian at gossamer-threads

Mar 6, 2009, 12:15 PM

Post #1 of 5 (1155 views)
Permalink
Re: [8451] * Added `Bric::Util::ApacheReq->url` and put it to use in various

> + if ( SSL_ENABLE && (ALWAYS_USE_SSL || $p{ssl}) ) {
> + $http .= 's';
> + $port = SSL_PORT eq '*' || SSL_PORT == 443 ? '' : ':' . SSL_PORT;
> + } else {
> + $port = LISTEN_PORT eq '*' || LISTEN_PORT == 80 ? '' : ':' . LISTEN_PORT;
> + }

Those =='s need to be eq's if *_PORT are '*' (warnings), so here's a patch:

--- lib/Bric/Util/ApacheReq.pm (revision 8457)
+++ lib/Bric/Util/ApacheReq.pm (working copy)
@@ -143,9 +143,9 @@
my $port;
if ( SSL_ENABLE && (ALWAYS_USE_SSL || $p{ssl}) ) {
$http .= 's';
- $port = SSL_PORT eq '*' || SSL_PORT == 443 ? '' : ':' . SSL_PORT;
+ $port = SSL_PORT eq '*' || SSL_PORT eq '443' ? '' : ':' .
SSL_PORT;
} else {
- $port = LISTEN_PORT eq '*' || LISTEN_PORT == 80 ? '' : ':' .
LISTEN_PORT;
+ $port = LISTEN_PORT eq '*' || LISTEN_PORT eq '80' ? '' : ':' .
LISTEN_PORT;
}
return "$http://" . $req->hostname . $port . (defined $p{uri} ?
$p{uri} : '/');
}


david at kineticode

Mar 6, 2009, 12:20 PM

Post #2 of 5 (1055 views)
Permalink
Re: [8451] * Added `Bric::Util::ApacheReq->url` and put it to use in various [In reply to]

On Mar 6, 2009, at 12:15 PM, Adrian Yee wrote:

> Those =='s need to be eq's if *_PORT are '*' (warnings), so here's a
> patch:

Have you seen warning? The || should short-circuit, so if the ports
are '', the == will never evaluate.

Best,

David


adrian at gossamer-threads

Mar 6, 2009, 3:24 PM

Post #3 of 5 (1046 views)
Permalink
Re: [8451] * Added `Bric::Util::ApacheReq->url` and put it to use in various [In reply to]

>> Those =='s need to be eq's if *_PORT are '*' (warnings), so here's a
>> patch:
>
> Have you seen warning? The || should short-circuit, so if the ports are
> '', the == will never evaluate.

Yep, I'm getting:

Argument "*" isn't numeric in numeric eq (==) at
/home/worldhealth/dev-bricolage/lib/Bric/Util/ApacheReq.pm line 151.

when mod_perl starts up. Alex believes it's Perl optimizing the *_PORT
constants on compile time (it only happens on start up).

Adrian


david at kineticode

Mar 6, 2009, 3:44 PM

Post #4 of 5 (1052 views)
Permalink
Re: [8451] * Added `Bric::Util::ApacheReq->url` and put it to use in various [In reply to]

On Mar 6, 2009, at 3:24 PM, Adrian Yee wrote:

>> Yep, I'm getting:
>
> Argument "*" isn't numeric in numeric eq (==) at /home/worldhealth/
> dev-bricolage/lib/Bric/Util/ApacheReq.pm line 151.
>
> when mod_perl starts up. Alex believes it's Perl optimizing the
> *_PORT constants on compile time (it only happens on start up).

Oh. Right. Okay, fixed in r8459.

Best,

David


alex at gossamer-threads

Mar 6, 2009, 3:46 PM

Post #5 of 5 (1051 views)
Permalink
Re: [8451] * Added `Bric::Util::ApacheReq->url` and put it to use in various [In reply to]

Hi,

On Fri Mar 06 03:24:19, Adrian Yee wrote:

> >> Those =='s need to be eq's if *_PORT are '*' (warnings), so here's a
> >> patch:
> >
> > Have you seen warning? The || should short-circuit, so if the ports are
> > '', the == will never evaluate.
>
> Yep, I'm getting:
>
> Argument "*" isn't numeric in numeric eq (==) at
> /home/worldhealth/dev-bricolage/lib/Bric/Util/ApacheReq.pm line 151.
>
> when mod_perl starts up. Alex believes it's Perl optimizing the *_PORT
> constants on compile time (it only happens on start up).

Yup, it's a compile time warning, not runtime:

alex [at] ale ~ $ perl -wle 'use constant FOO => "*"; exit; (FOO == 80)'
Argument "*" isn't numeric in numeric eq (==) at -e line 1.
alex [at] ale ~ $

Cheers,

Alex

--
Alex Krohn <alex [at] gossamer-threads>

Bricolage devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.