la mouton <[EMAIL PROTECTED]> writes:

> There seems to be an issue (maybe namespace?) with preloading
> Apache::URI(); and URI::URL(); using Apache's PerlRequire directive.
> 
> Commenting out the includes for those libraries in my conf/startup.pl
> fixed the problem.
> 
> Gisle - any idea why this is happening between the versions of libwww?

No.  This is the complete patch between 5.5397 and 5.60 (not including
the renaming of the LWP::Protocol::http* modules).  There is nothing
here that I think could explain your problem.  Do you see anything?

Index: Changes
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/Changes,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -u -r1.11 -r1.12
--- Changes     2001/09/20 00:30:02     1.11
+++ Changes     2001/10/26 23:24:02     1.12
@@ -1,3 +1,43 @@
+2001-10-26   Gisle Aas <[EMAIL PROTECTED]>
+
+    Release 5.60
+
+    Made HTTP/1.1 the default.  The old HTTP/1.0 module has been
+    renamed as LWP::Protocol::http10.  There is an environment
+    variable; PERL_LWP_USE_HTTP_10 that can be set to have LWP
+    still pick up the old handlers.
+
+    Deal with "100 continue" responses even when not requested by
+    and Expect header in the request.  MS IIS seems to eager to send
+    this kind of response.
+
+    For HTTP/1.1 over SSL there was a problem with the underlying
+    SSL libraries if the socket was configured to non-blocking mode.
+    Disable this for https.
+    Based on a patch from Michael Thompson <[EMAIL PROTECTED]>
+
+    Support the Range header for ftp:// requests.
+    Patch by David Coppit <[EMAIL PROTECTED]>.
+
+    Rearrange Bundle::LWP on request from Chris Nandor.
+
+    HTTP::Cookies: Allow a domain like .foo.com match host "foo.com".
+    Patch by Alexandre Duret-Lutz <[EMAIL PROTECTED]>
+
+    For redirects make sure Host header is not copied to the new
+    request.
+
+    The HTML::HeadParser is not loaded until actually needed.
+
+    Net::HTTP should now work with perl5.005 by a simple tweak
+    to 'require IO::Socket::INET'.
+
+    WWW::RobotRules::AnyDBM: Explicitly clear database on open.
+    Some DBM implementations doesn't support the O_TRUNC flag
+    properly.  Patch by Radu Greab <[EMAIL PROTECTED]>.
+
+
+
 2001-09-19   Gisle Aas <[EMAIL PROTECTED]>
 
     Release 5.53_97
Index: MANIFEST
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/MANIFEST,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -p -u -r1.83 -r1.84
--- MANIFEST    2001/08/28 04:12:58     1.83
+++ MANIFEST    2001/10/26 17:27:54     1.84
@@ -38,10 +38,10 @@ lib/LWP/Protocol/data.pm        Access t
 lib/LWP/Protocol/file.pm       Access local files
 lib/LWP/Protocol/ftp.pm                Access with the FTP protocol
 lib/LWP/Protocol/gopher.pm     Access with the Gopher protocol
-lib/LWP/Protocol/http.pm       Access with HTTP/1.0 protocol
-lib/LWP/Protocol/http11.pm     Access with HTTP/1.1 protocol
-lib/LWP/Protocol/https.pm      Access with HTTP/1.0 protocol over SSL
-lib/LWP/Protocol/https11.pm    Access with HTTP/1.1 protocol over SSL
+lib/LWP/Protocol/http.pm       Access with HTTP/1.1 protocol
+lib/LWP/Protocol/http10.pm     Access with HTTP/1.0 protocol
+lib/LWP/Protocol/https.pm      Access with HTTP/1.1 protocol over SSL
+lib/LWP/Protocol/https10.pm    Access with HTTP/1.0 protocol over SSL
 lib/LWP/Protocol/mailto.pm     Allows you to POST mail using sendmail
 lib/LWP/Protocol/nntp.pm       Handles access to news: and nntp: URLs
 lib/LWP/Protocol/nogo.pm       Denies all requests.
Index: Makefile.PL
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/Makefile.PL,v
retrieving revision 1.56
retrieving revision 1.59
diff -u -p -u -r1.56 -r1.59
--- Makefile.PL 2001/04/29 06:14:51     1.56
+++ Makefile.PL 2001/10/26 22:15:08     1.59
@@ -1,7 +1,7 @@
 # This -*- perl -*- script writes the Makefile for libwww-perl
-# $Id: Makefile.PL,v 1.56 2001/04/29 06:14:51 gisle Exp $
+# $Id: Makefile.PL,v 1.59 2001/10/26 22:15:08 gisle Exp $
 
-require 5.004;
+require 5.005;
 use strict;
 use ExtUtils::MakeMaker;
 use Config;
@@ -41,7 +41,7 @@ my $some_time_ago = sprintf "%04d-%02d-%
                             sub { ($_[5]+1900, $_[4]+1, $_[3])}->(localtime(time - 45 
* 24*60*60));
 if ($some_time_ago lt $release_date) {
     # Check if we have internet connection
-    require IO::Socket::INET;
+    require IO::Socket;
     my $s = IO::Socket::INET->new(PeerAddr => "www.google.com:80",
                                  Timeout  => 10,
                                 );
@@ -163,7 +163,7 @@ EOT
 print "Checking for Net::FTP......";
 eval {
     require Net::FTP;
-    Net::FTP->VERSION('2.00');
+    Net::FTP->VERSION('2.58');
 };
 if ($@) {
     print " failed\n";
@@ -218,7 +218,7 @@ WriteMakefile(
    EXE_FILES     => [ map {"bin/$_"} @programs_to_install ],
    PREREQ_PM     => { 'URI'              => "1.10",
                       'MIME::Base64'     => "2.1",
-                      'Net::FTP'         => "2.4",
+                      'Net::FTP'         => "2.58",
                       'HTML::HeadParser' => 0,
                       'Digest::MD5'      => 0,
                      },
Index: README
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/README,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -p -u -r1.52 -r1.53
--- README      2001/03/14 21:45:50     1.52
+++ README      2001/10/26 18:14:53     1.53
@@ -29,7 +29,7 @@ package is currently available from CPAN
 PREREQUISITES
 
 In order to install and use this package you will need Perl version
-5.004 or better.  Some modules within this package depend on other
+5.005 or better.  Some modules within this package depend on other
 packages that are distributed separately from Perl.  We recommend that
 you have the following packages installed before you install
 libwww-perl:
Index: TODO
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/TODO,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -p -u -r1.39 -r1.40
--- TODO        1999/03/20 07:37:35     1.39
+++ TODO        2001/10/26 23:05:23     1.40
@@ -1,11 +1,9 @@
-                                            $Date: 1999/03/20 07:37:35 $
+                                            $Date: 2001/10/26 23:05:23 $
 
 This is a list over things that we plan to implement in libwww-perl-5.
 The order of items does not reflect priority.
 
-  o  HTTP/1.1 support is on its way.  This also includes support of
-     multiple parallel connections.  Take a look at LWPng (aka
-     libwww-perl-6).
+  o  NTML Authentication http://www.innovation.ch/java/ntlm.html
 
   o  Provide initial credentials so that we don't always have to get a
      401 response first.  Both for Basic and Digest authentication.  This
Index: lib/LWP.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP.pm,v
retrieving revision 1.109
retrieving revision 1.112
diff -u -p -u -r1.109 -r1.112
--- lib/LWP.pm  2001/09/17 19:25:17     1.109
+++ lib/LWP.pm  2001/10/26 23:24:03     1.112
@@ -1,9 +1,9 @@
 #
-# $Id: LWP.pm,v 1.109 2001/09/17 19:25:17 gisle Exp $
+# $Id: LWP.pm,v 1.112 2001/10/26 23:24:03 gisle Exp $
 
 package LWP;
 
-$VERSION = "5.5397";
+$VERSION = "5.60";
 sub Version { $VERSION; }
 
 require 5.004;
@@ -402,7 +402,8 @@ encoded in the URL.  Failed logins retur
 for HTTP.
 
 The library supports ftp ASCII transfer mode by specifying the "type=a"
-parameter in the URL.
+parameter in the URL. It also supports transfer of ranges for FTP transfers
+using the "Range" header.
 
 Directory listings are by default returned unprocessed (as returned
 from the ftp server) with the content media type reported to be
Index: lib/Bundle/LWP.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/Bundle/LWP.pm,v
retrieving revision 1.7
retrieving revision 1.9
diff -u -p -u -r1.7 -r1.9
--- lib/Bundle/LWP.pm   2001/01/12 20:53:14     1.7
+++ lib/Bundle/LWP.pm   2001/10/26 22:15:09     1.9
@@ -1,6 +1,6 @@
 package Bundle::LWP;
 
-$VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/);
 
 1;
 
@@ -16,13 +16,13 @@ Bundle::LWP - A bundle to install all li
 
 =head1 CONTENTS
 
-URI 1.10           - There are URIs everywhere
-
-Net::FTP 2.00      - If you want ftp://-support
-
 MIME::Base64       - Used in authentication headers
 
 Digest::MD5        - Needed to do Digest authentication
+
+URI 1.10           - There are URIs everywhere
+
+Net::FTP 2.58      - If you want ftp://-support
 
 HTML::Tagset       - Needed by HTML::Parser
 
Index: lib/HTTP/Cookies.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/HTTP/Cookies.pm,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -u -r1.18 -r1.19
--- lib/HTTP/Cookies.pm 2001/09/06 19:51:11     1.18
+++ lib/HTTP/Cookies.pm 2001/10/26 22:45:28     1.19
@@ -9,7 +9,7 @@ use HTTP::Headers::Util qw(split_header_
 use LWP::Debug ();
 
 use vars qw($VERSION);
-$VERSION = sprintf("%d.%02d", q$Revision: 1.18 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.19 $ =~ /(\d+)\.(\d+)/);
 
 my $EPOCH_OFFSET = 0;  # difference from Unix epoch
 if ($^O eq "MacOS") {
@@ -331,7 +331,8 @@ sub extract_cookies
 
        # Check domain
        my $domain  = delete $hash{domain};
-       if (defined($domain) && $domain ne $req_host) {
+       if (defined($domain)
+           && $domain ne $req_host && $domain ne ".$req_host") {
            if ($domain !~ /\./ && $domain ne "local") {
                LWP::Debug::debug("Domain $domain contains no dot");
                next SET_COOKIE;
Index: lib/LWP/Protocol.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP/Protocol.pm,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -p -u -r1.38 -r1.39
--- lib/LWP/Protocol.pm 2001/04/21 03:56:03     1.38
+++ lib/LWP/Protocol.pm 2001/10/26 19:00:21     1.39
@@ -1,4 +1,4 @@
-# $Id: Protocol.pm,v 1.38 2001/04/21 03:56:03 gisle Exp $
+# $Id: Protocol.pm,v 1.39 2001/10/26 19:00:21 gisle Exp $
 
 package LWP::Protocol;
 
@@ -38,13 +38,12 @@ The following methods and functions are 
 
 require LWP::MemberMixin;
 @ISA = qw(LWP::MemberMixin);
-$VERSION = sprintf("%d.%02d", q$Revision: 1.38 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.39 $ =~ /(\d+)\.(\d+)/);
 
 use strict;
 use Carp ();
 use HTTP::Status ();
 use HTTP::Response;
-require HTML::HeadParser;
 
 my %ImplementedBy = (); # scheme => classname
 
@@ -193,6 +192,7 @@ sub collect
 
     my $parser;
     if ($parse_head && $response->content_type eq 'text/html') {
+       require HTML::HeadParser;
        $parser = HTML::HeadParser->new($response->{'_headers'});
     }
     my $content_size = 0;
Index: lib/LWP/UserAgent.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP/UserAgent.pm,v
retrieving revision 1.96
retrieving revision 1.99
diff -u -p -u -r1.96 -r1.99
--- lib/LWP/UserAgent.pm        2001/09/20 00:14:26     1.96
+++ lib/LWP/UserAgent.pm        2001/10/26 18:05:22     1.99
@@ -1,4 +1,4 @@
-# $Id: UserAgent.pm,v 1.96 2001/09/20 00:14:26 gisle Exp $
+# $Id: UserAgent.pm,v 1.99 2001/10/26 18:05:22 gisle Exp $
 
 package LWP::UserAgent;
 use strict;
@@ -103,7 +103,7 @@ use vars qw(@ISA $VERSION);
 
 require LWP::MemberMixin;
 @ISA = qw(LWP::MemberMixin);
-$VERSION = sprintf("%d.%02d", q$Revision: 1.96 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.99 $ =~ /(\d+)\.(\d+)/);
 
 use HTTP::Request ();
 use HTTP::Response ();
@@ -115,17 +115,12 @@ use LWP::Protocol ();
 
 use Carp ();
 
-unless ($ENV{LWP_USE_HTTP1}) {
-    # XXX Try to force the experimental HTTP/1.1 implementations as
-    # XXX the default for http and https.  This should give it more
-    # XXX test exposure I hope.  This block will go away in the
-    # XXX real release.
-
-    require LWP::Protocol::http11;
-    LWP::Protocol::implementor('http', 'LWP::Protocol::http11');
+if ($ENV{PERL_LWP_USE_HTTP_10}) {
+    require LWP::Protocol::http10;
+    LWP::Protocol::implementor('http', 'LWP::Protocol::http10');
     eval {
-        require LWP::Protocol::https11;
-        LWP::Protocol::implementor('https', 'LWP::Protocol::https11');
+        require LWP::Protocol::https10;
+        LWP::Protocol::implementor('https', 'LWP::Protocol::https10');
     };
 }
 
@@ -231,10 +226,6 @@ sub new
 
     if ($keep_alive) {
        $conn_cache ||= { total_capacity => $keep_alive };
-
-       # this will go-away when HTTP/1.1 becomes the default
-       require LWP::Protocol::http11;
-       LWP::Protocol::implementor('http', 'LWP::Protocol::http11');
     }
     $self->conn_cache($conn_cache) if $conn_cache;
 
@@ -472,6 +463,7 @@ sub request
        }
 
        $referral->url($referral_uri);
+       $referral->remove_header('Host');
 
        return $response unless $self->redirect_ok($referral);
 
Index: lib/LWP/Protocol/ftp.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/LWP/Protocol/ftp.pm,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -p -u -r1.30 -r1.31
--- lib/LWP/Protocol/ftp.pm     2001/08/06 23:47:42     1.30
+++ lib/LWP/Protocol/ftp.pm     2001/10/26 20:13:20     1.31
@@ -1,5 +1,5 @@
 #
-# $Id: ftp.pm,v 1.30 2001/08/06 23:47:42 gisle Exp $
+# $Id: ftp.pm,v 1.31 2001/10/26 20:13:20 gisle Exp $
 
 # Implementation of the ftp protocol (RFC 959). We let the Net::FTP
 # package do all the dirty work.
@@ -236,6 +236,36 @@ sub request
            }
        }
 
+       # We'll use this later to abort the transfer if necessary. 
+       # if $max_size is defined, we need to abort early. Otherwise, it's
+      # a normal transfer
+       my $max_size = undef;
+
+       # Set resume location, if the client requested it
+       if ($request->header('Range') && $ftp->supported('REST'))
+       {
+               my $range_info = $request->header('Range');
+
+               # Change bytes=2772992-6781209 to just 2772992
+               my ($start_byte,$end_byte) = $range_info =~ /.*=\s*(\d+)-(\d+)/;
+
+               if (!defined $start_byte || !defined $end_byte ||
+                 ($start_byte < 0) || ($start_byte > $end_byte) || ($end_byte < 0))
+               {
+                 return HTTP::Response->new(&HTTP::Status::RC_BAD_REQUEST,
+                    'Incorrect syntax for Range request');
+               }
+
+               $max_size = $end_byte-$start_byte;
+
+               $ftp->restart($start_byte);
+       }
+       elsif ($request->header('Range') && !$ftp->supported('REST'))
+       {
+               return HTTP::Response->new(&HTTP::Status::RC_NOT_IMPLEMENTED,
+                "Server does not support resume.");
+       }
+
        my $data;  # the data handle
        LWP::Debug::debug("retrieve file?");
        if (length($remote_file) and $data = $ftp->retr($remote_file)) {
@@ -255,6 +285,33 @@ sub request
                $response = $self->collect($arg, $response, sub {
                    my $content = '';
                    my $result = $data->read($content, $size);
+
+                    # Stop early if we need to.
+                    if (defined $max_size)
+                    {
+                      # We need an interface to Net::FTP::dataconn for getting
+                      # the number of bytes already read
+                      my $bytes_received = $data->bytes_read();
+
+                      # We were already over the limit. (Should only happen
+                      # once at the end.)
+                      if ($bytes_received - length($content) > $max_size)
+                      {
+                        $content = '';
+                      }
+                      # We just went over the limit
+                      elsif ($bytes_received  > $max_size)
+                      {
+                        # Trim content
+                        $content = substr($content, 0,
+                          $max_size - ($bytes_received - length($content)) );
+                      }
+                      # We're under the limit
+                      else
+                      {
+                      }
+                    }
+
                    return \$content;
                } );
            }
Index: lib/Net/HTTP.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/Net/HTTP.pm,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -p -u -r1.35 -r1.36
--- lib/Net/HTTP.pm     2001/08/28 04:08:33     1.35
+++ lib/Net/HTTP.pm     2001/10/26 18:06:26     1.36
@@ -1,14 +1,14 @@
 package Net::HTTP;
 
-# $Id: HTTP.pm,v 1.35 2001/08/28 04:08:33 gisle Exp $
+# $Id: HTTP.pm,v 1.36 2001/10/26 18:06:26 gisle Exp $
 
 require 5.005;  # 4-arg substr
 
 use strict;
 use vars qw($VERSION @ISA);
 
-$VERSION = "0.02";
-require IO::Socket::INET;
+$VERSION = "0.03";
+eval { require IO::Socket::INET } || require IO::Socket;
 @ISA=qw(IO::Socket::INET);
 
 my $CRLF = "\015\012";   # "\r\n" is not portable
Index: lib/WWW/RobotRules/AnyDBM_File.pm
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/lib/WWW/RobotRules/AnyDBM_File.pm,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -u -r1.9 -r1.10
--- lib/WWW/RobotRules/AnyDBM_File.pm   1998/01/06 10:07:00     1.9
+++ lib/WWW/RobotRules/AnyDBM_File.pm   2001/10/26 20:32:28     1.10
@@ -1,10 +1,10 @@
-# $Id: AnyDBM_File.pm,v 1.9 1998/01/06 10:07:00 aas Exp $
+# $Id: AnyDBM_File.pm,v 1.10 2001/10/26 20:32:28 gisle Exp $
 
 package WWW::RobotRules::AnyDBM_File;
 
 require  WWW::RobotRules;
 @ISA = qw(WWW::RobotRules);
-$VERSION = sprintf("%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/);
+$VERSION = sprintf("%d.%02d", q$Revision: 1.10 $ =~ /(\d+)\.(\d+)/);
 
 use Carp ();
 use AnyDBM_File;
@@ -71,6 +71,7 @@ sub agent {
            my $file = $self->{'filename'};
            untie %{$self->{'dbm'}};
            tie %{$self->{'dbm'}}, 'AnyDBM_File', $file, O_TRUNC|O_RDWR, 0640;
+           %{$self->{'dbm'}} = ();
            $self->{'dbm'}{"|ua-name|"} = $newname;
        }
     }
Index: t/live/google.t
===================================================================
RCS file: /cvsroot/libwww-perl/lwp5/t/live/google.t,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -u -r1.3 -r1.4
--- t/live/google.t     2001/08/28 03:01:20     1.3
+++ t/live/google.t     2001/10/26 18:03:21     1.4
@@ -9,8 +9,8 @@ my $ua = LWP::UserAgent->new(keep_alive 
 
 # Google is confused if we end up sendit it the "Connection: TE"
 # header and will close the connection.  This avoids it.
-push(@LWP::Protocol::http11::EXTRA_SOCK_OPTS, SendTE => 0);
-my @dummy = @LWP::Protocol::http11::EXTRA_SOCK_OPTS;  # avoid 'only once' warning
+push(@LWP::Protocol::http::EXTRA_SOCK_OPTS, SendTE => 0);
+my @dummy = @LWP::Protocol::http::EXTRA_SOCK_OPTS;  # avoid 'only once' warning
 
 my $req = HTTP::Request->new(GET => "http://www.google.com";);
 my $res = $ua->request($req);


Reply via email to