Gisle Aas <[EMAIL PROTECTED]> writes:

> > +package LWP::Protocol::https11;
> > +
> > +use vars qw(@ISA);
> > +
> > +require LWP::Protocol::http11;
> > +require LWP::Protocol::https;
> > +
> > +@ISA = qw(LWP::Protocol::http11);
> > +my $SSL_CLASS = $LWP::Protocol::https::SSL_CLASS;
> > +
> > +#used to avoid calling IO::Socket::INET::configure twice
> > +sub LWP::Protocol::https11::Noop::configure {$_[0]};
> > +
> > +#we need this to setup a proper @ISA tree
> > +{
> > +    package LWP::Protocol::MyHTTPS;
> > +    use vars qw(@ISA);
> > +    @ISA = ($SSL_CLASS, 'LWP::Protocol::MyHTTP');
> > +
> > +    #we need to call both Net::SSL::configure and Net::HTTP::configure
> > +    #however both call SUPER::configure (which is IO::Socket::INET)
> > +    #to avoid calling that twice we trick Net::HTTP into calling
> > +    #Noop::configure
> > +
> > +    sub configure {
> > +        my $self = shift;
> > +        local @Net::HTTP::ISA = qw(LWP::Protocol::https11::Noop);
> 
> This blows away the perl method cache each time we connect to an https
> server.  There must be a better way?

I'm thinking of changing Net::HTTP::configure into calling
$self->_http_socket_configure() instead of $self->SUPER::configure()
directly.  The default _http_socket_configure then just calls
SUPER::configure, i.e:

sub Net::HTTP::_http_socket_configure {
     my $self = shift;
     $self->SUPER::configure(@_);
}

This allow LWP::Protocol::MyHTTPS to simply override this method to be
a noop.  How does that sound to you?

Any better ideas for this?

> 
> > +        for my $class (@ISA) {
> > +            my $cfg = $class->can('configure');
> > +            $cfg->($self, @_);
> > +        }
> > +        $self;
> > +    }
> > +}

Reply via email to