You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Joao Pedro Gonçalves <jo...@ptm.pt> on 2000/07/25 12:15:06 UTC

How do i know for certain i am using SSL?

Hi, is there any method that will work through all the different
apache ssl implementations?
Currently what i do (with openssl) is:

my $s = $r->lookup_uri($r->uri);
my $ssl = $s->subprocess_env('HTTPS'); 

$ssl becomes 'on' , but i don't know if this is compatible with other
ssl implementations.
Maybe this HTTPS env could be mapped to mod_perl %ENV, or using
something similar for each ssl
implementation so that a developer could trust on one place to know
whether the request is using ssl or not.

Thank your for you attention,
Joao Pedro

Re: How do i know for certain i am using SSL?

Posted by Vivek Khera <kh...@kciLink.com>.
>>>>> "j" == joaop  <Joao> writes:

j> Following your suggestion,
j> use Apache::URI ();
j> $r->parsed_uri->scheme; 

j> returns http or https.

The "s" in https says use SSL.  The port number is irrelevent, just as
the port number in http is irrelevent to using the HTTP protocol.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
GPG & MIME spoken here            http://www.khera.org/~vivek/

Re: How do i know for certain i am using SSL?

Posted by Joao Pedro Gonçalves <jo...@ptm.pt>.
Following your suggestion,

use Apache::URI ();
$r->parsed_uri->scheme; 

returns http or https.

However this value comes from apache's util_uri
where https is mapped to DEFAULT_HTTPS_PORT.

src/include/httpd.h:#define DEFAULT_HTTPS_PORT        443 

However with OpenSSL and mod_ssl, this still works because somewhere at
ssl_engine_ext.c
DEFAULT_HTTPS_PORT is overwritten and the schema returns https on other
port when ssl is engaged.
So, the question is, can i trust this?

Thanks, 
João Pedro

Kenneth Lee wrote:
> 
> how about the scheme of the request URL? hmm.. but that needs
> parsing the URL...
> 
> Joao Pedro Gonçalves wrote:
> >
> > Hi, is there any method that will work through all the different
> > apache ssl implementations?
> > Currently what i do (with openssl) is:
> >
> > my $s = $r->lookup_uri($r->uri);
> > my $ssl = $s->subprocess_env('HTTPS');
> >
> > $ssl becomes 'on' , but i don't know if this is compatible with other
> > ssl implementations.
> > Maybe this HTTPS env could be mapped to mod_perl %ENV, or using
> > something similar for each ssl
> > implementation so that a developer could trust on one place to know
> > whether the request is using ssl or not.
> >
> > Thank your for you attention,
> > Joao Pedro

Re: How do i know for certain i am using SSL?

Posted by Vivek Khera <kh...@kciLink.com>.
>>>>> "KL" == Kenneth Lee <ke...@alfacomtech.com> writes:

KL> how about the scheme of the request URL? hmm.. but that needs 
KL> parsing the URL...

Huh? Just look at the first five characters if they are "https".  No
more parsing than that is necessary, or am I totally missing
something?  That's what I'd use if I needed to do this.

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
GPG & MIME spoken here            http://www.khera.org/~vivek/

Re: How do i know for certain i am using SSL?

Posted by Kenneth Lee <ke...@alfacomtech.com>.
how about the scheme of the request URL? hmm.. but that needs 
parsing the URL...


Joao Pedro Gonçalves wrote:
> 
> Hi, is there any method that will work through all the different
> apache ssl implementations?
> Currently what i do (with openssl) is:
> 
> my $s = $r->lookup_uri($r->uri);
> my $ssl = $s->subprocess_env('HTTPS');
> 
> $ssl becomes 'on' , but i don't know if this is compatible with other
> ssl implementations.
> Maybe this HTTPS env could be mapped to mod_perl %ENV, or using
> something similar for each ssl
> implementation so that a developer could trust on one place to know
> whether the request is using ssl or not.
> 
> Thank your for you attention,
> Joao Pedro