Re: [PATCH] backward compat for 5.005_03 (Re: libwww-perl-5.61)

2001-11-20 Thread Gisle Aas

Gisle Aas <[EMAIL PROTECTED]> writes:

> Still need to figure out why connect fails for me on this test with
> perl5.005 ...

With this patch is seems to work fine on perl5.005:

Index: lib/Net/HTTP/Methods.pm
===
RCS file: /cvsroot/libwww-perl/lwp5/lib/Net/HTTP/Methods.pm,v
retrieving revision 1.3
diff -u -p -u -r1.3 Methods.pm
--- lib/Net/HTTP/Methods.pm 2001/11/20 19:48:40 1.3
+++ lib/Net/HTTP/Methods.pm 2001/11/20 20:43:38
@@ -25,13 +25,14 @@ sub http_configure {
 my $host = delete $cnf->{Host};
 my $peer = $cnf->{PeerAddr} || $cnf->{PeerHost};
 if ($host) {
-   $cnf->{PeerHost} = $host unless $peer;
+   $cnf->{PeerAddr} = $host unless $peer;
 }
 else {
$host = $peer;
$host =~ s/:.*//;
 }
 $cnf->{PeerPort} = $self->http_default_port unless $cnf->{PeerPort};
+$cnf->{Proto} = 'tcp';
 
 my $keep_alive = delete $cnf->{KeepAlive};
 my $http_version = delete $cnf->{HTTPVersion};
@@ -163,7 +164,7 @@ sub format_request {
 
 sub write_request {
 my $self = shift;
-$self->syswrite($self->format_request(@_));
+$self->print($self->format_request(@_));
 }
 
 sub format_chunk {
@@ -175,7 +176,7 @@ sub format_chunk {
 sub write_chunk {
 my $self = shift;
 return 1 unless defined($_[0]) && length($_[0]);
-$self->syswrite(hex(length($_[0])) . $CRLF . $_[0] . $CRLF);
+$self->print(hex(length($_[0])) . $CRLF . $_[0] . $CRLF);
 }
 
 sub format_chunk_eof {
@@ -189,7 +190,7 @@ sub format_chunk_eof {
 
 sub write_chunk_eof {
 my $self = shift;
-$self->syswrite($self->format_chunk_eof(@_));
+$self->print($self->format_chunk_eof(@_));
 }
 
 



Re: [PATCH] backward compat for 5.005_03 (Re: libwww-perl-5.61)

2001-11-20 Thread Gisle Aas

Tatsuhiko Miyagawa <[EMAIL PROTECTED]> writes:

> t/live/acrivestate.t fails in 5.005_03.
> 
> --- libwww-perl-5.61.orig/lib/Net/HTTP/Methods.pm Sat Nov 17 14:24:58 2001
> +++ libwww-perl-5.61/lib/Net/HTTP/Methods.pm  Sat Nov 17 14:32:31 2001
> @@ -163,7 +163,7 @@
>  
>  sub write_request {
>  my $self = shift;
> -$self->syswrite($self->format_request(@_));
> +syswrite $self, $self->format_request(@_);
>  }

For me it fails in the connect() call.  Why should this patch make a
difference?

The IO::Handle that comes with perl5.005_03 has a syswrite method that
require you to send the length as the second argument.  That means we
might have to do something like:

sub write_request {
 my $self = shift;
 my $req_data = $self->format_request(@_);
 $self->syswrite($req_data, length($req_data));
}

but then it should probably test the outcome of the syswrite call as well.
I think it might be better to simply make it:

sub write_request {
 my $self = shift;
 $self->print($self->format_request(@_));
}

Still need to figure out why connect fails for me on this test with
perl5.005 ...

Regards,
Gisle



Re: libwww-perl-5.61

2001-11-20 Thread Gisle Aas

Bill Moseley <[EMAIL PROTECTED]> writes:

> no $ua->keep_alive(1)?  :-( 
> 
> Maybe next time?

It would just be a shorthand for:

   $ua->conn_cache( { total_capacity => 1 } );

but perhaps we want it to return something else.  Is it worth it?
Perhaps we instead simply can get rid of it from the constructor
options?

Regards,
Gisle



Re: libwww-perl-5.61

2001-11-20 Thread Gisle Aas

Blair Zajac <[EMAIL PROTECTED]> writes:

> Are you going use the patches I submitted regarding the usage of the
> connection cache in LWP::UserAgent passing in undef?
> 
>   http:[EMAIL PROTECTED]/msg03066.html
>   http:[EMAIL PROTECTED]/msg03067.html

They are on my list over things to consider.  In principle I see
nothing wrong with that patch.

But why do you want to set up unlimited capacity?  It means that your
program will start to fail once it reach the OS limit on the number of
live sockets or file descriptors allowed.  Is it useful to have more
than 2-4 live connections going at any time?

Regards,
Gisle