I'm editing a Perl CGI application that does special processing when run under HTTPS.
Right now, I'm trying to detect it by manually looking for 'https://' in the request URI:
my $is_secure = $cgi->request_uri =~ m{^https://};
Is there a slightly cleaner way of doing this?
CGI.pm has an https()
method that, according to the documentation:
operates on the HTTPS environment variables present when the SSL protocol 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With