| 1 |
NAME |
| 2 |
|
| 3 |
Apache::SSLLookup - hooks for various mod_ssl functions |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
|
| 7 |
in httpd.conf: |
| 8 |
|
| 9 |
# pre-loading via PerlModule or startup.pl is REQUIRED!!! |
| 10 |
PerlModule Apache::SSLLookup |
| 11 |
|
| 12 |
in any handler: |
| 13 |
|
| 14 |
sub handler { |
| 15 |
my $r = Apache::SSLLookup->new(shift); |
| 16 |
|
| 17 |
my $request_is_over_ssl = $r->is_https; |
| 18 |
|
| 19 |
my $value = $r->lookup_var('SSL_CLIENT_VERIFY'); |
| 20 |
|
| 21 |
... |
| 22 |
} |
| 23 |
|
| 24 |
DESCRIPTION |
| 25 |
|
| 26 |
Apache::SSLLookup is a glue layer between Perl handlers |
| 27 |
and the mod_ssl public API. under normal circumstances, you would |
| 28 |
use C<$rE<gt>subprocess_env()> to glean information about mod_ssl. |
| 29 |
for example, |
| 30 |
|
| 31 |
my $request_is_over_ssl = $r->subprocess_env('HTTPS'); |
| 32 |
|
| 33 |
however, this is only possible after mod_ssl runs its fixups - |
| 34 |
that is, Perl handlers can only accurately check the |
| 35 |
C<subprocess_env> table for mod_ssl information in the |
| 36 |
PerlResponsePhase or later. |
| 37 |
|
| 38 |
this module allows you to query mod_ssl directly via its public |
| 39 |
C API at any point in the request cycle. but without using C, |
| 40 |
of course. |
| 41 |
|
| 42 |
METHODS |
| 43 |
|
| 44 |
there are only three methods you need to be concerned with. |
| 45 |
|
| 46 |
new() |
| 47 |
|
| 48 |
to use this class you create an C<Apache::SSLLookup> object. |
| 49 |
C<Apache::SSLLookup> is a subclass of C<Apache::RequestRec> |
| 50 |
so you can simply call C<new()> and get on with your business. |
| 51 |
|
| 52 |
my $r = Apache::SSLLookup->new($r); |
| 53 |
|
| 54 |
is_https() |
| 55 |
|
| 56 |
returns true if mod_ssl considers the request to be under SSL. |
| 57 |
|
| 58 |
my $ssl = $r->is_https; |
| 59 |
|
| 60 |
you can call this function any time during the request, specifically |
| 61 |
before mod_ssl populates C<subprocess_env('HTTPS')> in the fixup |
| 62 |
phase. |
| 63 |
|
| 64 |
you must be using Apache 2.0.51 or greater for this method to |
| 65 |
accurately reflect the SSL status of the request. |
| 66 |
|
| 67 |
lookup_var() |
| 68 |
|
| 69 |
returns the value of various mod_ssl environment variables. |
| 70 |
|
| 71 |
my $value = $r->lookup_var('SSL_CLIENT_VERIFY'); |
| 72 |
|
| 73 |
you can call this function any time during the request, specifically |
| 74 |
before mod_ssl populates C<subprocess_env()> in the fixup phase. |
| 75 |
|
| 76 |
NOTES |
| 77 |
|
| 78 |
this module is for Apache 2.0 exclusively. it will not work with |
| 79 |
Apache 1.3. |
| 80 |
|
| 81 |
you MUST MUST MUST preload this module with PerlModule or from |
| 82 |
a startup.pl. what if you don't? the short answer is that this |
| 83 |
module will do nothing for you. the long answer is that unless |
| 84 |
you preload the module it will not be able to glean the optional |
| 85 |
function definitions from mod_ssl. I'm still trying to figure |
| 86 |
out why not... |
| 87 |
|
| 88 |
AUTHOR |
| 89 |
|
| 90 |
Geoffrey Young E<lt>[email protected]<gt> |
| 91 |
|
| 92 |
COPYRIGHT |
| 93 |
|
| 94 |
Copyright (c) 2004, Geoffrey Young |
| 95 |
|
| 96 |
All rights reserved. |
| 97 |
|
| 98 |
This module is free software. It may be used, redistributed |
| 99 |
and/or modified under the same terms as Perl itself. |