I'm doing a 45 minute seminar at UAB tomorrow on mod_perl, and would be
very grateful if anyone would point out holes in this code before I try
to show it to a roomful of attendees:
========================================

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# module for Apache/mod_perl PerlPostReadRequestHandler to redirect
#  users on the nonsecure port over to SSL (hopefully saving bookmarks)
#______________________________________________________________________
 
package Apache::PortCorrect;              # define the package space

use strict;                               # pragma for clean code
use Apache::Constants qw( :response );    # installed with mod_perl
 
sub handler {                                    # default methodname
    my($r) = @_;                                 # the request object
    return OK if 443 == $r->get_server_port;     # ok if already SSL
    my $uri = "https://myserver.com";             # DNS literal *
            . (split /\s+/, $r->the_request)[1]; # requested "page"
    $r->custom_response(MOVED,$uri);             # for re-request
    return MOVED;                                # page moved!
}
1; # guarantee return code for load

================================================================
and
================================================================

PerlPostReadRequestHandler +Apache::PortCorrect

================================================================

If someone is interested in seeing the rest of the presentation, I've
posted it at http://thesilentbard.com/ACM%20Seminar.ppt -- if you'd
care to post it online anywhere else, please let me know first, but
that's cool, too. Any corrections are welcome.

I know it isn't clean (I tried to make sure it fit on one slide and
didn't get too complicated for the topic, hence such non-portable
features as the DNS literal, etc), but suggestions are still very
welcome.

Thanks all,
Paul

__________________________________________________
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

Reply via email to