[dw-free] Purchase SSL certificate
[commit: http://hg.dwscoalition.org/dw-free/rev/6cc447870adb]
http://bugs.dwscoalition.org/show_bug.cgi?id=122
Add SSL hook. Basically, you define a header, if that header is set to 1,
then we turn on SSL mode. This assumes you use an SSL unwrapping engine like
pound/stunnel/perlbal capable of inserting headers and don't feed SSL
directly to Apache.
Patch by
mark.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=122
Add SSL hook. Basically, you define a header, if that header is set to 1,
then we turn on SSL mode. This assumes you use an SSL unwrapping engine like
pound/stunnel/perlbal capable of inserting headers and don't feed SSL
directly to Apache.
Patch by
![[staff profile]](https://www.dreamwidth.org/img/silk/identity/user_staff.png)
Files modified:
- cgi-bin/DW/Hooks/SSL.pm
-------------------------------------------------------------------------------- diff -r 53dd152590d8 -r 6cc447870adb cgi-bin/DW/Hooks/SSL.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/DW/Hooks/SSL.pm Fri Apr 10 08:41:35 2009 +0000 @@ -0,0 +1,28 @@ +# +# Use this hook to turn on SSL mode if a certain header is present. See the +# SSL documentation for more information on usage. +# +# Authors: +# Mark Smith <mark@dreamwidth.org> +# +# Copyright (c) 2009 by Dreamwidth Studios, LLC. +# +# This program is free software; you may redistribute it and/or modify it under +# the same terms as Perl itself. For a copy of the license, please reference +# 'perldoc perlartistic' or 'perldoc perlgpl'. +# + +package DW::Hooks::SSL; + +use strict; + +LJ::register_hook( 'ssl_check', sub { + my $r = $_[0]->{r} + or return 0; + + return 1 if $LJ::SSL_HEADER && + $r->headers_in->{$LJ::SSL_HEADER} == 1; + return 0; +} ); + +1; --------------------------------------------------------------------------------