Determine http or https in CGI perl

Determine http or https in CGI perl

am 04.10.2011 08:04:16 von Ramprasad Prasad

--bcaec52163238b750c04ae72dce2
Content-Type: text/plain; charset=ISO-8859-1

In my cgi program .. I want to know if the user is accessing via HTTP or
HTTPS.

How can I do this ?

--
Thanks
Ram





n

--bcaec52163238b750c04ae72dce2--

Re: Determine http or https in CGI perl

am 04.10.2011 08:36:24 von Shlomi Fish

Hi Ram,

On Tue, 4 Oct 2011 11:34:16 +0530
Ramprasad Prasad wrote:

> In my cgi program .. I want to know if the user is accessing via HTTP or
> HTTPS.
>=20
> How can I do this ?
>=20

A quick Google search yielded this link:

http://stackoverflow.com/questions/5223341/how-do-i-identify -the-protocol-h=
ttp-vs-https-using-perls-cgi-pm

Here's a shorter link:

http://stackoverflow.com/questions/5223341

Reading from there, one option would be:

my $is_secure =3D $cgi->request_uri =3D~ m{^https://};

And a better one is:

[QUOTE]
CGI.pm has an https() method that, according to the documentation:

operates on the HTTPS environment variables present when the SSL protoc=
ol is in effect. Can be used to determine whether SSL is turned on.

This is probably what you're looking for. Without parameters, it returns a =
list of HTTPS environment variables.
[/QUOTE]

Regards,

Shlomi Fish

--=20
------------------------------------------------------------ -----
Shlomi Fish http://www.shlomifish.org/
What does "Zionism" mean? - http://shlom.in/def-zionism

â€=9CI simply hate, detest, loathe, despise, and abhor redundancy.=E2=
€
â€=94 http://uncyclopedia.org/wiki/Redundancy

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/