| author | fu |
| Thu Feb 23 02:21:54 2012 +0800 | |
| changeset 4315 | 34b3c4ba3afb |
| parent 656 | 6cc447870adb |
| permissions | -rw-r--r-- |
| mark@656 | 1 |
# |
| mark@656 | 2 |
# Use this hook to turn on SSL mode if a certain header is present. See the |
| mark@656 | 3 |
# SSL documentation for more information on usage. |
| mark@656 | 4 |
# |
| mark@656 | 5 |
# Authors: |
| mark@656 | 6 |
# Mark Smith <mark@dreamwidth.org> |
| mark@656 | 7 |
# |
| mark@656 | 8 |
# Copyright (c) 2009 by Dreamwidth Studios, LLC. |
| mark@656 | 9 |
# |
| mark@656 | 10 |
# This program is free software; you may redistribute it and/or modify it under |
| mark@656 | 11 |
# the same terms as Perl itself. For a copy of the license, please reference |
| mark@656 | 12 |
# 'perldoc perlartistic' or 'perldoc perlgpl'. |
| mark@656 | 13 |
# |
| mark@656 | 14 |
|
| mark@656 | 15 |
package DW::Hooks::SSL; |
| mark@656 | 16 |
|
| mark@656 | 17 |
use strict; |
| mark@2019 | 18 |
use LJ::Hooks; |
| mark@656 | 19 |
|
| mark@2019 | 20 |
LJ::Hooks::register_hook( 'ssl_check', sub {
|
| mark@656 | 21 |
my $r = $_[0]->{r}
|
| mark@656 | 22 |
or return 0; |
| mark@656 | 23 |
|
| mark@656 | 24 |
return 1 if $LJ::SSL_HEADER && |
| mark@656 | 25 |
$r->headers_in->{$LJ::SSL_HEADER} == 1;
|
| mark@656 | 26 |
return 0; |
| mark@656 | 27 |
} ); |
| mark@656 | 28 |
|
| mark@656 | 29 |
1; |