Doug MacEachern <[EMAIL PROTECTED]> writes:
> started using the new http/1.1 support for testing apache-2.0 (in the
> httpd-test project). things are working great except https is not
> supported with http/1.1. it works with the patch below but requires the
> following code:
>
> require LWP::Protocol::https11;
> LWP::Protocol::implementor('https', 'LWP::Protocol::https11');
Very cool. Some comments below...
> would be great if 5.54 supports http/1.1 + https.
>
> --- ./lib/LWP/Protocol/http11.pm~ Sun Aug 26 14:44:04 2001
> +++ ./lib/LWP/Protocol/http11.pm Sun Aug 26 18:21:43 2001
> @@ -340,7 +342,7 @@
>
> my $complete;
> $response = $self->collect($arg, $response, sub {
> - my $buf;
> + my $buf = ""; #prevent use of uninitialized value
> my $n;
>READ:
> {
Where did this 'use of uninitialized value' happen??
> --- ./lib/Net/HTTP.pm~Thu Aug 2 16:30:44 2001
> +++ ./lib/Net/HTTP.pm Sun Aug 26 18:21:49 2001
> @@ -194,7 +194,7 @@
> }
>
> sub xread {
> -sysread($_[0], $_[1], $_[2], $_[3] || 0);
> +$_[0]->sysread($_[1], $_[2], $_[3] || 0);
> }
I think I'll switch lib/Net/HTTP.pm info calling the sysread instead
of xread directly. This is just too much indirection :-(
> --- /dev/null Thu Aug 24 02:00:32 2000
> +++ lib/LWP/Protocol/https11.pm Sun Aug 26 18:16:15 2001
> @@ -0,0 +1,57 @@
> +#
> +# $Id: https.pm,v 1.8 1999/09/20 12:48:37 gisle Exp $
> +
> +use strict;
> +
> +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?
> +for my $class (@ISA) {
> +my $cfg = $class->can('configure');
> +$cfg->($self, @_);
> +}
> +$self;
> +}
> +}
> +
> +sub _new_socket
> +{
> +#needs to be blessed into our pseudo class
> +local $LWP::Protocol::MyHTTP::Class = 'LWP::Protocol::MyHTTPS';
> +shift->SUPER::_new_socket(@_);
> +}
> +
> +{
> +#if we inherit from LWP::Protocol::https we inherit from
> +#LWP::Protocol::http, so just setup aliases for these two
> +no strict 'refs';
> +for (qw(_check_sock _get_sock_info)) {
> +*{"$_"} = \&{"LWP::Protocol::https::$_"};
> +}
> +}
> +
> +1;