SSLLookup(3pm)
π SSLLookup(3pm) β Apache::SSLLookup π
User Contributed Perl Documentation β¨ bestie, this is the one that lets your Perl handlers peek at mod_ssl whenever they want, not just when mod_ssl feels like sharing. π¦ iykyk.
πΈ NAME πΈ
Apache::SSLLookup β hooks for various mod_ssl functions π
β¨ SYNOPSIS β¨
okay so first, in httpd.conf:
# pre-loading via PerlModule or startup.pl is REQUIRED!!!
PerlModule Apache::SSLLookup
and then in any handler, literally any of them:
sub handler {
my $r = Apache::SSLLookup->new(shift);
my $request_is_over_ssl = $r->is_https;
my $value = $r->lookup_var('SSL_CLIENT_VERIFY');
...
}
like. it's giving effortless. π
π DESCRIPTION π
Apache::SSLLookup is a glue layer between Perl handlers and the mod_ssl public API. β¨ translated: it's the lil bridge so your Perl code can talk to mod_ssl's C guts without you writing a single line of C.
under normal circumstances (the boring timeline), you'd use $r>subprocess_env() to glean information about mod_ssl. for example:
my $request_is_over_ssl = $r->subprocess_env('HTTPS');
however β and this is the tea π β that only works after mod_ssl runs its fixups. meaning: Perl handlers can only accurately check the subprocess_env table for mod_ssl information in the PerlResponsePhase or later. so if you're early in the request cycle you're just standing there with an empty table like π
this module lets you query mod_ssl directly via its public C API at any point in the request cycle. but without using C, of course. π§ no cap.
π METHODS π
there are only three methods you need to be concerned with. three. iconic behavior. π
new()
to use this class you create an Apache::SSLLookup object. Apache::SSLLookup is a subclass of Apache::RequestRec so you can simply call new() and get on with your business. π
my $r = Apache::SSLLookup->new($r);
is_https()
returns true if mod_ssl considers the request to be under SSL. β
my $request_is_over_ssl = $r->is_https;
you can call this function any time during the request β specifically before mod_ssl populates subprocess_env('HTTPS') in the fixup phase. that's the whole point bestie. π¦
β οΈ you must be using Apache 2.0.51 or greater for this method to accurately reflect the SSL status of the request. older than that and it's just lying to you fr fr π
lookup_var()
returns the value of various mod_ssl environment variables. π
my $value = $r->lookup_var('SSL_CLIENT_VERIFY');
you can call this function any time during the request β specifically before mod_ssl populates subprocess_env() in the fixup phase. same energy as above, go off. β¨
π NOTES π
- this module is for Apache 2.0 exclusively. it will not work with Apache 1.3. not even a little. π
- you MUST MUST MUST preload this module with
PerlModuleor from astartup.pl. π¨
what if you don't? the short answer is that this module will do nothing for you. π nothing!! zero!! the long answer is that unless you preload the module it will not be able to glean the optional function definitions from mod_ssl. I'm still trying to figure out why not... π ngl that last part is straight from the source, the author said it, not me.
π«Ά AUTHOR π«Ά
Geoffrey Young <geoff@modperlcookbook.org> π
π COPYRIGHT π
Copyright (c) 2004, Geoffrey Young
All rights reserved.
This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
and that's the whole page babes, go forth and query mod_ssl π
this lil rewrite came to you from perl v5.42.3, dated 2026-08-21, under the SSLLookup(3pm) name β slay, periodt. β¨ππ¦πΈ
π¦ where this page comes from
- ubuntu stonking: libapache-ssllookup-perl 2.00-04-4build6 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms