Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

How to recognize you're an HTTPS process - improved versions.

  • Loading branch information...
commit 73e1264b1053d6eb3f0c5789966fe43e7c0cdb7d 1 parent 1044234
@jamiemccarthy jamiemccarthy authored
View
5 Slash/Apache/Apache.pm
@@ -261,8 +261,9 @@ sub ConnectionIsSSL {
# That probably didn't work so let's get that data the hard way.
my $r = Apache->request;
my $subr = $r->lookup_uri($r->uri);
- my $sess_id = $subr->subprocess_env('SSL_SESSION_ID');
- return 1 if $sess_id;
+ my $https_on = ($subr && $subr->subprocess_env('HTTPS') eq 'on')
+ ? 1 : 0;
+ return 1 if $https_on;
# Nope, it's not SSL.
return 0;
View
7 Slash/Utility/Environment/Environment.pm
@@ -1044,6 +1044,13 @@ sub setCookie {
# Brian advises port() is the best way, yes it's icky -Jamie
# This doesn't work yet! I think I want $r->connection->local_addr
# (and then unpack it and look at the port) - Jamie
+# OK, this works:
+ if ($constants->{cookiesecure}) {
+ my $subr = $r->lookup_uri($r->uri);
+ if ($subr && $subr->subprocess_env('HTTPS') eq 'on') {
+ $cookiehash{-secure} = 1;
+ }
+ }
# if ($constants->{cookiesecure} && $r->port == 443) {
# $cookiehash{-secure} = 1;
# }
Please sign in to comment.
Something went wrong with that request. Please try again.