Assuing you are using apache and only ever run ssl over port 443 (which
is the standard) you could use the SERVER_PORT environment variable...

aka: 

  $secure = $ENV{'SERVER_PORT'} eq '443' ? 1 : 0;

  if ($secure) {
     # do secure stuff...
  }
  else {
   ... 
  }


On Thu, 2003-01-23 at 13:19, Dan wrote:
> Hello, here's one for you all.
> 
> What is the fastest way to find out what protocal a script is being 
> called from ?
> IE http, https, ftp ,etc
> 
> currently I  have to use :
> 
> sub set_prot {
> 
>     use CGI self_url;
>     $self_url_query = CGI::new();
>     $self_url = $self_url_query->self_url();
> 
>     if($self_url =~ m/^https\:\/\//i) { $http_prot = 'https'; }
>     else { $http_prot = 'http'; }
> 
>     return $http_prot;
> }
> I know there's got to be a better/faster/shorter way
> 
> Mainly interested in http and https so that generated html can be like 
> this :
> 
> <img src="$http_prot\://domain.com/images/pic.png">
> That way if the page is access via http
> <img src="http://domain.com/images/pic.png";>
> but if it's accessed via https it's
> <img src="https://domain.com/images/pic.png";>
> 
> And then you won't get the not so good "not all items on this page are 
> secure" bit.
> 
> Any ideas?
> 
> Thanks
> 
> Dan


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to