From: DongHun Kwak Date: Thu, 21 Jul 2022 02:28:22 +0000 (+0900) Subject: Imported Upstream version 6.22 X-Git-Tag: upstream/6.22^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94b2b5778a84987617f001c00859005ac8bd8db5;p=platform%2Fupstream%2Fperl-libwww-perl.git Imported Upstream version 6.22 --- diff --git a/Changes b/Changes index 353f3ad..70c35f7 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Change history for libwww-perl +6.22 2017-03-01 + - Update Travis-CI to test on minimum versions of prereqs. (GH PR #109) + - Fix tests that depended on a newer version of HTTP::Message (GH PR #119) + - Update documentation to reflect behavior difference in ->put() depending + on the version of HTTP::Message installed. (GH PR #120) + 6.21 2017-02-21 - Ensure that LWP::Simple re-exports some HTTP::Status functions diff --git a/META.json b/META.json index 24d5cce..40d3f11 100644 --- a/META.json +++ b/META.json @@ -108,111 +108,111 @@ "provides" : { "LWP" : { "file" : "lib/LWP.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Authen::Basic" : { "file" : "lib/LWP/Authen/Basic.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Authen::Digest" : { "file" : "lib/LWP/Authen/Digest.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Authen::Ntlm" : { "file" : "lib/LWP/Authen/Ntlm.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::ConnCache" : { "file" : "lib/LWP/ConnCache.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Debug" : { "file" : "lib/LWP/Debug.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Debug::TraceHTTP" : { "file" : "lib/LWP/Debug/TraceHTTP.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Debug::TraceHTTP::Socket" : { "file" : "lib/LWP/Debug/TraceHTTP.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::DebugFile" : { "file" : "lib/LWP/DebugFile.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::MemberMixin" : { "file" : "lib/LWP/MemberMixin.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol" : { "file" : "lib/LWP/Protocol.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::MyFTP" : { "file" : "lib/LWP/Protocol/ftp.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::cpan" : { "file" : "lib/LWP/Protocol/cpan.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::data" : { "file" : "lib/LWP/Protocol/data.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::file" : { "file" : "lib/LWP/Protocol/file.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::ftp" : { "file" : "lib/LWP/Protocol/ftp.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::gopher" : { "file" : "lib/LWP/Protocol/gopher.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::http" : { "file" : "lib/LWP/Protocol/http.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::http::Socket" : { "file" : "lib/LWP/Protocol/http.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::http::SocketMethods" : { "file" : "lib/LWP/Protocol/http.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::loopback" : { "file" : "lib/LWP/Protocol/loopback.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::mailto" : { "file" : "lib/LWP/Protocol/mailto.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::nntp" : { "file" : "lib/LWP/Protocol/nntp.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Protocol::nogo" : { "file" : "lib/LWP/Protocol/nogo.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::RobotUA" : { "file" : "lib/LWP/RobotUA.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::Simple" : { "file" : "lib/LWP/Simple.pm", - "version" : "6.21" + "version" : "6.22" }, "LWP::UserAgent" : { "file" : "lib/LWP/UserAgent.pm", - "version" : "6.21" + "version" : "6.22" } }, "release_status" : "stable", @@ -230,7 +230,7 @@ "x_IRC" : "irc://irc.perl.org/#lwp", "x_MailingList" : "mailto:libwww@perl.org" }, - "version" : "6.21", + "version" : "6.22", "x_Dist_Zilla" : { "perl" : { "version" : "5.024000" @@ -372,7 +372,7 @@ "branch" : null, "changelog" : "Changes", "signed" : 0, - "tag" : "v6.21", + "tag" : "v6.22", "tag_format" : "v%v", "tag_message" : "v%v" }, diff --git a/META.yml b/META.yml index 1126363..0de2955 100644 --- a/META.yml +++ b/META.yml @@ -27,85 +27,85 @@ no_index: provides: LWP: file: lib/LWP.pm - version: '6.21' + version: '6.22' LWP::Authen::Basic: file: lib/LWP/Authen/Basic.pm - version: '6.21' + version: '6.22' LWP::Authen::Digest: file: lib/LWP/Authen/Digest.pm - version: '6.21' + version: '6.22' LWP::Authen::Ntlm: file: lib/LWP/Authen/Ntlm.pm - version: '6.21' + version: '6.22' LWP::ConnCache: file: lib/LWP/ConnCache.pm - version: '6.21' + version: '6.22' LWP::Debug: file: lib/LWP/Debug.pm - version: '6.21' + version: '6.22' LWP::Debug::TraceHTTP: file: lib/LWP/Debug/TraceHTTP.pm - version: '6.21' + version: '6.22' LWP::Debug::TraceHTTP::Socket: file: lib/LWP/Debug/TraceHTTP.pm - version: '6.21' + version: '6.22' LWP::DebugFile: file: lib/LWP/DebugFile.pm - version: '6.21' + version: '6.22' LWP::MemberMixin: file: lib/LWP/MemberMixin.pm - version: '6.21' + version: '6.22' LWP::Protocol: file: lib/LWP/Protocol.pm - version: '6.21' + version: '6.22' LWP::Protocol::MyFTP: file: lib/LWP/Protocol/ftp.pm - version: '6.21' + version: '6.22' LWP::Protocol::cpan: file: lib/LWP/Protocol/cpan.pm - version: '6.21' + version: '6.22' LWP::Protocol::data: file: lib/LWP/Protocol/data.pm - version: '6.21' + version: '6.22' LWP::Protocol::file: file: lib/LWP/Protocol/file.pm - version: '6.21' + version: '6.22' LWP::Protocol::ftp: file: lib/LWP/Protocol/ftp.pm - version: '6.21' + version: '6.22' LWP::Protocol::gopher: file: lib/LWP/Protocol/gopher.pm - version: '6.21' + version: '6.22' LWP::Protocol::http: file: lib/LWP/Protocol/http.pm - version: '6.21' + version: '6.22' LWP::Protocol::http::Socket: file: lib/LWP/Protocol/http.pm - version: '6.21' + version: '6.22' LWP::Protocol::http::SocketMethods: file: lib/LWP/Protocol/http.pm - version: '6.21' + version: '6.22' LWP::Protocol::loopback: file: lib/LWP/Protocol/loopback.pm - version: '6.21' + version: '6.22' LWP::Protocol::mailto: file: lib/LWP/Protocol/mailto.pm - version: '6.21' + version: '6.22' LWP::Protocol::nntp: file: lib/LWP/Protocol/nntp.pm - version: '6.21' + version: '6.22' LWP::Protocol::nogo: file: lib/LWP/Protocol/nogo.pm - version: '6.21' + version: '6.22' LWP::RobotUA: file: lib/LWP/RobotUA.pm - version: '6.21' + version: '6.22' LWP::Simple: file: lib/LWP/Simple.pm - version: '6.21' + version: '6.22' LWP::UserAgent: file: lib/LWP/UserAgent.pm - version: '6.21' + version: '6.22' requires: Digest::MD5: '0' Encode: '2.12' @@ -142,7 +142,7 @@ resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=libwww-perl homepage: https://github.com/libwww-perl/libwww-perl repository: https://github.com/libwww-perl/libwww-perl.git -version: '6.21' +version: '6.22' x_Dist_Zilla: perl: version: '5.024000' @@ -252,7 +252,7 @@ x_Dist_Zilla: branch: ~ changelog: Changes signed: 0 - tag: v6.21 + tag: v6.22 tag_format: v%v tag_message: v%v Dist::Zilla::Role::Git::Repo: diff --git a/Makefile.PL b/Makefile.PL index cfef352..1e21c21 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -83,7 +83,7 @@ my %WriteMakefileArgs = ( "Test::More" => 0, "Test::RequiresInternet" => 0 }, - "VERSION" => "6.21", + "VERSION" => "6.22", "test" => { "TESTS" => "t/*.t t/base/*.t t/local/*.t t/robot/*.t" } diff --git a/bin/lwp-request b/bin/lwp-request index 4c2125a..cde0972 100755 --- a/bin/lwp-request +++ b/bin/lwp-request @@ -217,7 +217,7 @@ use HTTP::Date qw(time2str str2time); # user/password if document is protected. { package RequestAgent; -$RequestAgent::VERSION = '6.21'; +$RequestAgent::VERSION = '6.22'; use base qw(LWP::UserAgent); sub new diff --git a/dist.ini b/dist.ini index d8f7d80..920bdb6 100644 --- a/dist.ini +++ b/dist.ini @@ -4,7 +4,7 @@ license = Perl_5 copyright_holder = Gisle Aas copyright_year = 1995 -version = 6.21 +version = 6.22 ; Gather stuff in [Git::GatherDir] diff --git a/lib/LWP.pm b/lib/LWP.pm index 841c7cf..52b3844 100644 --- a/lib/LWP.pm +++ b/lib/LWP.pm @@ -1,6 +1,6 @@ package LWP; -our $VERSION = '6.21'; +our $VERSION = '6.22'; require 5.008; require LWP::UserAgent; # this should load everything you need diff --git a/lib/LWP/Authen/Basic.pm b/lib/LWP/Authen/Basic.pm index 6685c74..b266563 100644 --- a/lib/LWP/Authen/Basic.pm +++ b/lib/LWP/Authen/Basic.pm @@ -1,5 +1,5 @@ package LWP::Authen::Basic; -$LWP::Authen::Basic::VERSION = '6.21'; +$LWP::Authen::Basic::VERSION = '6.22'; use strict; require MIME::Base64; diff --git a/lib/LWP/Authen/Digest.pm b/lib/LWP/Authen/Digest.pm index 57501d6..5d9f123 100644 --- a/lib/LWP/Authen/Digest.pm +++ b/lib/LWP/Authen/Digest.pm @@ -1,5 +1,5 @@ package LWP::Authen::Digest; -$LWP::Authen::Digest::VERSION = '6.21'; +$LWP::Authen::Digest::VERSION = '6.22'; use strict; use base 'LWP::Authen::Basic'; diff --git a/lib/LWP/Authen/Ntlm.pm b/lib/LWP/Authen/Ntlm.pm index b151f57..28a2f4d 100644 --- a/lib/LWP/Authen/Ntlm.pm +++ b/lib/LWP/Authen/Ntlm.pm @@ -2,7 +2,7 @@ package LWP::Authen::Ntlm; use strict; -our $VERSION = '6.21'; +our $VERSION = '6.22'; use Authen::NTLM "1.02"; use MIME::Base64 "2.12"; diff --git a/lib/LWP/ConnCache.pm b/lib/LWP/ConnCache.pm index c057468..f9be7b1 100644 --- a/lib/LWP/ConnCache.pm +++ b/lib/LWP/ConnCache.pm @@ -2,7 +2,7 @@ package LWP::ConnCache; use strict; -our $VERSION = '6.21'; +our $VERSION = '6.22'; our $DEBUG; sub new { diff --git a/lib/LWP/Debug.pm b/lib/LWP/Debug.pm index 8049188..d059b2b 100644 --- a/lib/LWP/Debug.pm +++ b/lib/LWP/Debug.pm @@ -1,5 +1,5 @@ package LWP::Debug; # legacy -$LWP::Debug::VERSION = '6.21'; +$LWP::Debug::VERSION = '6.22'; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(level trace debug conns); diff --git a/lib/LWP/Debug/TraceHTTP.pm b/lib/LWP/Debug/TraceHTTP.pm index 3fd6cad..57ef84a 100644 --- a/lib/LWP/Debug/TraceHTTP.pm +++ b/lib/LWP/Debug/TraceHTTP.pm @@ -1,5 +1,5 @@ package LWP::Debug::TraceHTTP; -$LWP::Debug::TraceHTTP::VERSION = '6.21'; +$LWP::Debug::TraceHTTP::VERSION = '6.22'; # Just call: # # require LWP::Debug::TraceHTTP; @@ -12,7 +12,7 @@ use strict; use base 'LWP::Protocol::http'; package LWP::Debug::TraceHTTP::Socket; -$LWP::Debug::TraceHTTP::Socket::VERSION = '6.21'; +$LWP::Debug::TraceHTTP::Socket::VERSION = '6.22'; use Data::Dump 1.13; use Data::Dump::Trace qw(autowrap mcall); diff --git a/lib/LWP/DebugFile.pm b/lib/LWP/DebugFile.pm index 7ca5fb3..66c8a7a 100644 --- a/lib/LWP/DebugFile.pm +++ b/lib/LWP/DebugFile.pm @@ -1,5 +1,5 @@ package LWP::DebugFile; -$LWP::DebugFile::VERSION = '6.21'; +$LWP::DebugFile::VERSION = '6.22'; # legacy stub 1; diff --git a/lib/LWP/MemberMixin.pm b/lib/LWP/MemberMixin.pm index a35bedc..32e6795 100644 --- a/lib/LWP/MemberMixin.pm +++ b/lib/LWP/MemberMixin.pm @@ -1,5 +1,5 @@ package LWP::MemberMixin; -$LWP::MemberMixin::VERSION = '6.21'; +$LWP::MemberMixin::VERSION = '6.22'; sub _elem { my $self = shift; my $elem = shift; diff --git a/lib/LWP/Protocol.pm b/lib/LWP/Protocol.pm index 846ec6a..076855e 100644 --- a/lib/LWP/Protocol.pm +++ b/lib/LWP/Protocol.pm @@ -2,7 +2,7 @@ package LWP::Protocol; use base 'LWP::MemberMixin'; -our $VERSION = '6.21'; +our $VERSION = '6.22'; use strict; use Carp (); diff --git a/lib/LWP/Protocol/cpan.pm b/lib/LWP/Protocol/cpan.pm index 8383170..c39dc4f 100644 --- a/lib/LWP/Protocol/cpan.pm +++ b/lib/LWP/Protocol/cpan.pm @@ -1,5 +1,5 @@ package LWP::Protocol::cpan; -$LWP::Protocol::cpan::VERSION = '6.21'; +$LWP::Protocol::cpan::VERSION = '6.22'; use strict; use base qw(LWP::Protocol); diff --git a/lib/LWP/Protocol/data.pm b/lib/LWP/Protocol/data.pm index 21a59b2..bd55511 100644 --- a/lib/LWP/Protocol/data.pm +++ b/lib/LWP/Protocol/data.pm @@ -1,5 +1,5 @@ package LWP::Protocol::data; -$LWP::Protocol::data::VERSION = '6.21'; +$LWP::Protocol::data::VERSION = '6.22'; # Implements access to data:-URLs as specified in RFC 2397 use strict; diff --git a/lib/LWP/Protocol/file.pm b/lib/LWP/Protocol/file.pm index 9d7b90d..b674076 100644 --- a/lib/LWP/Protocol/file.pm +++ b/lib/LWP/Protocol/file.pm @@ -1,5 +1,5 @@ package LWP::Protocol::file; -$LWP::Protocol::file::VERSION = '6.21'; +$LWP::Protocol::file::VERSION = '6.22'; use base qw(LWP::Protocol); use strict; diff --git a/lib/LWP/Protocol/ftp.pm b/lib/LWP/Protocol/ftp.pm index cb4c4e0..c4d4af1 100644 --- a/lib/LWP/Protocol/ftp.pm +++ b/lib/LWP/Protocol/ftp.pm @@ -1,5 +1,5 @@ package LWP::Protocol::ftp; -$LWP::Protocol::ftp::VERSION = '6.21'; +$LWP::Protocol::ftp::VERSION = '6.22'; # Implementation of the ftp protocol (RFC 959). We let the Net::FTP # package do all the dirty work. @@ -16,7 +16,7 @@ use base qw(LWP::Protocol); use strict; eval { package LWP::Protocol::MyFTP; -$LWP::Protocol::MyFTP::VERSION = '6.21'; +$LWP::Protocol::MyFTP::VERSION = '6.22'; require Net::FTP; Net::FTP->require_version(2.00); diff --git a/lib/LWP/Protocol/gopher.pm b/lib/LWP/Protocol/gopher.pm index 939381f..18a4433 100644 --- a/lib/LWP/Protocol/gopher.pm +++ b/lib/LWP/Protocol/gopher.pm @@ -1,5 +1,5 @@ package LWP::Protocol::gopher; -$LWP::Protocol::gopher::VERSION = '6.21'; +$LWP::Protocol::gopher::VERSION = '6.22'; # Implementation of the gopher protocol (RFC 1436) # # This code is based on 'wwwgopher.pl,v 0.10 1994/10/17 18:12:34 shelden' diff --git a/lib/LWP/Protocol/http.pm b/lib/LWP/Protocol/http.pm index 457d239..4c45279 100644 --- a/lib/LWP/Protocol/http.pm +++ b/lib/LWP/Protocol/http.pm @@ -1,5 +1,5 @@ package LWP::Protocol::http; -$LWP::Protocol::http::VERSION = '6.21'; +$LWP::Protocol::http::VERSION = '6.22'; use strict; require HTTP::Response; @@ -498,7 +498,7 @@ sub request #----------------------------------------------------------- package LWP::Protocol::http::SocketMethods; -$LWP::Protocol::http::SocketMethods::VERSION = '6.21'; +$LWP::Protocol::http::SocketMethods::VERSION = '6.22'; sub ping { my $self = shift; !$self->can_read(0); @@ -511,7 +511,7 @@ sub increment_response_count { #----------------------------------------------------------- package LWP::Protocol::http::Socket; -$LWP::Protocol::http::Socket::VERSION = '6.21'; +$LWP::Protocol::http::Socket::VERSION = '6.22'; use base qw(LWP::Protocol::http::SocketMethods Net::HTTP); 1; diff --git a/lib/LWP/Protocol/loopback.pm b/lib/LWP/Protocol/loopback.pm index 61489dc..a0e4242 100644 --- a/lib/LWP/Protocol/loopback.pm +++ b/lib/LWP/Protocol/loopback.pm @@ -1,5 +1,5 @@ package LWP::Protocol::loopback; -$LWP::Protocol::loopback::VERSION = '6.21'; +$LWP::Protocol::loopback::VERSION = '6.22'; use strict; require HTTP::Response; diff --git a/lib/LWP/Protocol/mailto.pm b/lib/LWP/Protocol/mailto.pm index c47ef21..99aa455 100644 --- a/lib/LWP/Protocol/mailto.pm +++ b/lib/LWP/Protocol/mailto.pm @@ -1,5 +1,5 @@ package LWP::Protocol::mailto; -$LWP::Protocol::mailto::VERSION = '6.21'; +$LWP::Protocol::mailto::VERSION = '6.22'; # This module implements the mailto protocol. It is just a simple # frontend to the Unix sendmail program except on MacOS, where it uses # Mail::Internet. diff --git a/lib/LWP/Protocol/nntp.pm b/lib/LWP/Protocol/nntp.pm index 186ccbc..5a81d4d 100644 --- a/lib/LWP/Protocol/nntp.pm +++ b/lib/LWP/Protocol/nntp.pm @@ -1,5 +1,5 @@ package LWP::Protocol::nntp; -$LWP::Protocol::nntp::VERSION = '6.21'; +$LWP::Protocol::nntp::VERSION = '6.22'; # Implementation of the Network News Transfer Protocol (RFC 977) use base qw(LWP::Protocol); diff --git a/lib/LWP/Protocol/nogo.pm b/lib/LWP/Protocol/nogo.pm index 8d6a051..0590e9c 100644 --- a/lib/LWP/Protocol/nogo.pm +++ b/lib/LWP/Protocol/nogo.pm @@ -4,7 +4,7 @@ package LWP::Protocol::nogo; # LWP::Protocol::implementor(that_scheme, 'LWP::Protocol::nogo'); # For then on, attempts to access URLs with that scheme will generate # a 500 error. -$LWP::Protocol::nogo::VERSION = '6.21'; +$LWP::Protocol::nogo::VERSION = '6.22'; use strict; require HTTP::Response; diff --git a/lib/LWP/RobotUA.pm b/lib/LWP/RobotUA.pm index d3700cc..5deb6b2 100644 --- a/lib/LWP/RobotUA.pm +++ b/lib/LWP/RobotUA.pm @@ -2,7 +2,7 @@ package LWP::RobotUA; use base qw(LWP::UserAgent); -our $VERSION = '6.21'; +our $VERSION = '6.22'; require WWW::RobotRules; require HTTP::Request; diff --git a/lib/LWP/Simple.pm b/lib/LWP/Simple.pm index 7221fc9..8176dbb 100644 --- a/lib/LWP/Simple.pm +++ b/lib/LWP/Simple.pm @@ -2,7 +2,7 @@ package LWP::Simple; use strict; -our $VERSION = '6.21'; +our $VERSION = '6.22'; require Exporter; diff --git a/lib/LWP/UserAgent.pm b/lib/LWP/UserAgent.pm index 46bc57c..f15b855 100644 --- a/lib/LWP/UserAgent.pm +++ b/lib/LWP/UserAgent.pm @@ -15,7 +15,7 @@ use LWP::Protocol (); use Scalar::Util qw(blessed); use Try::Tiny qw(try catch); -our $VERSION = '6.21'; +our $VERSION = '6.22'; sub new { @@ -1643,13 +1643,12 @@ the given processing phase. The methods described in this section are used to dispatch requests via the user agent. The following request methods are provided: -=over - -=item $ua->get( $url ) +=head2 get -=item $ua->get( $url , $field_name => $value, ... ) + my $res = $ua->get( $url ); + my $res = $ua->get( $url , $field_name => $value, ... ); -This method will dispatch a C request on the given $url. Further +This method will dispatch a C request on the given URL. Further arguments can be given to initialize the headers of the request. These are given as separate name/value pairs. The return value is a response object. See L for a description of the @@ -1698,103 +1697,112 @@ object. The callback can abort the request by invoking die(). The exception message will show up as the "X-Died" header field in the response returned by the get() function. -=item $ua->head( $url ) - -=item $ua->head( $url , $field_name => $value, ... ) - -This method will dispatch a C request on the given $url. -Otherwise it works like the get() method described above. - -=item $ua->post( $url, \%form ) - -=item $ua->post( $url, \@form ) +=head2 head -=item $ua->post( $url, \%form, $field_name => $value, ... ) + my $res = $ua->head( $url ); + my $res = $ua->head( $url , $field_name => $value, ... ); -=item $ua->post( $url, $field_name => $value,... Content => \%form ) +This method will dispatch a C request on the given URL. +Otherwise it works like the L method described above. -=item $ua->post( $url, $field_name => $value,... Content => \@form ) +=head2 post -=item $ua->post( $url, $field_name => $value,... Content => $content ) + my $res = $ua->post( $url, \%form ); + my $res = $ua->post( $url, \@form ); + my $res = $ua->post( $url, \%form, $field_name => $value, ... ); + my $res = $ua->post( $url, $field_name => $value, Content => \%form ); + my $res = $ua->post( $url, $field_name => $value, Content => \@form ); + my $res = $ua->post( $url, $field_name => $value, Content => $content ); -This method will dispatch a C request on the given $url, with -%form or @form providing the key/value pairs for the fill-in form +This method will dispatch a C request on the given URL, with +C<%form> or C<@form> providing the key/value pairs for the fill-in form content. Additional headers and content options are the same as for -the get() method. +the L method. -This method will use the POST() function from L +This method will use the C function from L to build the request. See L for a details on how to pass form content and other advanced features. -=item $ua->put( $url, \%form ) +=head2 put -=item $ua->put( $url, \@form ) + # Any version of HTTP::Message works with this form: + my $res = $ua->put( $url, $field_name => $value, Content => $content ); -=item $ua->put( $url, \%form, $field_name => $value, ... ) + # Using hash or array references requires HTTP::Message >= 6.07 + use HTTP::Request 6.07; + my $res = $ua->put( $url, \%form ); + my $res = $ua->put( $url, \@form ); + my $res = $ua->put( $url, \%form, $field_name => $value, ... ); + my $res = $ua->put( $url, $field_name => $value, Content => \%form ); + my $res = $ua->put( $url, $field_name => $value, Content => \@form ); -=item $ua->put( $url, $field_name => $value,... Content => \%form ) - -=item $ua->put( $url, $field_name => $value,... Content => \@form ) +This method will dispatch a C request on the given URL, with +C<%form> or C<@form> providing the key/value pairs for the fill-in form +content. Additional headers and content options are the same as for +the L method. -=item $ua->put( $url, $field_name => $value,... Content => $content ) +CAVEAT: -This method will dispatch a C request on the given $url, with -%form or @form providing the key/value pairs for the fill-in form -content. Additional headers and content options are the same as for -the get() method. +This method can only accept content that is in key-value pairs when using +L prior to version C<6.07>. Any use of hash or array +references will result in an error prior to version C<6.07>. -This method will use the PUT() function from L +This method will use the C function from L to build the request. See L for a details on how to pass form content and other advanced features. -=item $ua->delete( $url ) +=head2 delete -=item $ua->delete( $url, $field_name => $value, ... ) + my $res = $ua->delete( $url ); + my $res = $ua->delete( $url, $field_name => $value, ... ); -This method will dispatch a C request on the given $url. Additional -headers and content options are the same as for the get() method. +This method will dispatch a C request on the given URL. Additional +headers and content options are the same as for the L +method. This method will use the DELETE() function from L to build the request. See L for a details on how to pass form content and other advanced features. -=item $ua->mirror( $url, $filename ) +=head2 mirror -This method will get the document identified by $url and store it in -file called $filename. If the file already exists, then the request -will contain an "If-Modified-Since" header matching the modification + my $res = $ua->mirror( $url, $filename ); + +This method will get the document identified by URL and store it in +file called C<$filename>. If the file already exists, then the request +will contain an C header matching the modification time of the file. If the document on the server has not changed since this time, then nothing happens. If the document has been updated, it will be downloaded again. The modification time of the file will be forced to match that of the server. -The return value is the response object. - -=item $ua->request( $request ) - -=item $ua->request( $request, $content_file ) +The return value is an L object. -=item $ua->request( $request, $content_cb ) +=head2 request -=item $ua->request( $request, $content_cb, $read_size_hint ) + my $res = $ua->request( $request ); + my $res = $ua->request( $request, $content_file ); + my $res = $ua->request( $request, $content_cb ); + my $res = $ua->request( $request, $content_cb, $read_size_hint ); -This method will dispatch the given $request object. Normally this +This method will dispatch the given C<$request> object. Normally this will be an instance of the L class, but any object with -a similar interface will do. The return value is a response object. +a similar interface will do. The return value is an L object. See L and L for a description of the interface provided by these classes. -The request() method will process redirects and authentication +The C method will process redirects and authentication responses transparently. This means that it may actually send several -simple requests via the simple_request() method described below. +simple requests via the L method described below. -The request methods described above; get(), head(), post() and -mirror(), will all dispatch the request they build via this method. -They are convenience methods that simply hides the creation of the +The request methods described above; L, L, +L and L will all dispatch the request +they build via this method. +They are convenience methods that simply hide the creation of the request object for you. -The $content_file, $content_cb and $read_size_hint all correspond to -options described with the get() method above. Note that errors +The C<$content_file>, C<$content_cb> and C<$read_size_hint> all correspond to +options described with the L method above. Note that errors writing to the content file (for example due to permission denied or the filesystem being full) will be reported via the C or C response headers, and not the C method. @@ -1805,78 +1813,89 @@ when called. The content can be returned in chunks. The content function will be invoked repeatedly until it return an empty string to signal that there is no more content. -=item $ua->simple_request( $request ) +=head2 simple_request -=item $ua->simple_request( $request, $content_file ) + my $request = HTTP::Request->new( ... ); + my $res = $ua->simple_request( $request ); + my $res = $ua->simple_request( $request, $content_file ); + my $res = $ua->simple_request( $request, $content_cb ); + my $res = $ua->simple_request( $request, $content_cb, $read_size_hint ); -=item $ua->simple_request( $request, $content_cb ) +This method dispatches a single request and returns the response +received. Arguments are the same as for the L described above. -=item $ua->simple_request( $request, $content_cb, $read_size_hint ) +The difference from L is that C will not try to +handle redirects or authentication responses. The L method +will, in fact, invoke this method for each simple request it sends. -This method dispatches a single request and returns the response -received. Arguments are the same as for request() described above. +=head2 is_online + + my $bool = $ua->is_online; -The difference from request() is that simple_request() will not try to -handle redirects or authentication responses. The request() method -will in fact invoke this method for each simple request it sends. +Tries to determine if you have access to the Internet. Returns C<1> (true) +if the built-in heuristics determine that the user agent is +able to access the Internet (over HTTP) or C<0> (false). -=item $ua->is_online +See also L. -Tries to determine if you have access to the Internet. Returns -TRUE if the built-in heuristics determine that the user agent is -able to access the Internet (over HTTP). See also L. +=head2 is_protocol_supported -=item $ua->is_protocol_supported( $scheme ) + my $bool = $ua->is_protocol_supported( $scheme ); You can use this method to test whether this user agent object supports the -specified C. (The C might be a string (like 'http' or -'ftp') or it might be an URI object reference.) +specified C. (The C might be a string (like C or +C) or it might be an L object reference.) -Whether a scheme is supported, is determined by the user agent's +Whether a scheme is supported is determined by the user agent's C or C lists (if any), and by -the capabilities of LWP. I.e., this will return TRUE only if LWP +the capabilities of LWP. I.e., this will return true only if LWP supports this protocol I it's permitted for this particular object. -=back - -=head2 Callback methods +=head1 Callback methods The following methods will be invoked as requests are processed. These methods are documented here because subclasses of L might want to override their behaviour. -=over +=head2 prepare_request -=item $ua->prepare_request( $request ) + $request = $ua->prepare_request( $request ); -This method is invoked by simple_request(). Its task is to modify the -given $request object by setting up various headers based on the -attributes of the user agent. The return value should normally be the -$request object passed in. If a different request object is returned +This method is invoked by L. Its task is +to modify the given C<$request> object by setting up various headers based +on the attributes of the user agent. The return value should normally be the +C<$request> object passed in. If a different request object is returned it will be the one actually processed. -The headers affected by the base implementation are; "User-Agent", -"From", "Range" and "Cookie". +The headers affected by the base implementation are; C, +C, C and C. -=item $ua->redirect_ok( $prospective_request, $response ) +=head2 redirect_ok -This method is called by request() before it tries to follow a -redirection to the request in $response. This should return a TRUE -value if this redirection is permissible. The $prospective_request -will be the request to be sent if this method returns TRUE. + my $bool = $ua->redirect_ok( $prospective_request, $response ); -The base implementation will return FALSE unless the method +This method is called by L before it tries to follow a +redirection to the request in C<$response>. This should return a true +value if this redirection is permissible. The C<$prospective_request> +will be the request to be sent if this method returns true. + +The base implementation will return false unless the method is in the object's C list, -FALSE if the proposed redirection is to a "file://..." -URL, and TRUE otherwise. +false if the proposed redirection is to a C +URL, and true otherwise. + +=head2 get_basic_credentials -=item $ua->get_basic_credentials( $realm, $uri, $isproxy ) + # This checks wantarray and can either return an array: + my ($user, $pass) = $ua->get_basic_credentials( $realm, $uri, $isproxy ); + # or a string that looks like "user:pass" + my $creds = $ua->get_basic_credentials($realm, $uri, $isproxy); -This is called by request() to retrieve credentials for documents +This is called by L to retrieve credentials for documents protected by Basic or Digest Authentication. The arguments passed in -is the $realm provided by the server, the $uri requested and a boolean -flag to indicate if this is authentication against a proxy server. +is the C<$realm> provided by the server, the C<$uri> requested and a +C to indicate if this is authentication against a proxy server. The method should return a username and password. It should return an empty list to abort the authentication resolution attempt. Subclasses @@ -1885,21 +1904,21 @@ example of this can be found in C program distributed with this library. The base implementation simply checks a set of pre-stored member -variables, set up with the credentials() method. +variables, set up with the L method. + +=head2 progress -=item $ua->progress( $status, $request_or_response ) + my $prog = $ua->progress( $status, $request_or_response ); This is called frequently as the response is received regardless of -how the content is processed. The method is called with $status -"begin" at the start of processing the request and with $state "end" -before the request method returns. In between these $status will be +how the content is processed. The method is called with C<$status> +"begin" at the start of processing the request and with C<$state> "end" +before the request method returns. In between these C<$status> will be the fraction of the response currently received or the string "tick" if the fraction can't be calculated. -When $status is "begin" the second argument is the request object, -otherwise it is the response object. - -=back +When C<$status> is "begin" the second argument is the L object, +otherwise it is the L object. =head1 SEE ALSO @@ -1914,7 +1933,7 @@ and L for other ways to build request objects. See L and L for examples of more specialized user agents based on L. -=head1 COPYRIGHT +=head1 COPYRIGHT AND LICENSE Copyright 1995-2009 Gisle Aas. diff --git a/t/base/default_content_type.t b/t/base/default_content_type.t index b12cc94..d7c9789 100644 --- a/t/base/default_content_type.t +++ b/t/base/default_content_type.t @@ -3,7 +3,8 @@ use warnings; use Test::More; use LWP::UserAgent; -plan tests => 10; +use HTTP::Request (); +plan tests => 4; # Prevent environment from interfering with test: delete $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME}; @@ -13,40 +14,63 @@ delete $ENV{PERL_LWP_SSL_CA_FILE}; delete $ENV{PERL_LWP_SSL_CA_PATH}; delete $ENV{PERL_LWP_ENV_PROXY}; -my $ua = LWP::UserAgent->new; +# we can only use HTTP::Request >= 6.07 +my $ver = $HTTP::Request::VERSION || '6.00'; +my $ver_ok = eval {HTTP::Request->VERSION("6.07");}; +diag "Some tests for the PUT method can only be run on "; +diag "HTTP::Request version 6.07 or higher."; +diag "If your version isn't good enough, we'll skip those."; +diag "Your version is $ver and that's ". ($ver_ok ? '' : 'not '). 'good enough'; # default_header 'Content-Type' should be honored in POST/PUT # if the "Content => 'string'" form is used. Otherwise, x-www-form-urlencoded # will be used - +my $url = "http://www.example.com"; +my $ua = LWP::UserAgent->new; $ua->default_header('Content-Type' => 'application/json'); - $ua->proxy(http => "loopback:"); $ua->agent("foo/0.1"); -my $url = "http://www.example.com"; - # These forms will all be x-www-form-urlencoded -for my $call (qw(post put)) { +subtest 'PUT x-www-form-urlencoded' => sub { + plan skip_all => "HTTP::Request version not high enough" unless $ver_ok; + plan tests => 4; for my $arg ( [ { cat => 'dog' } ], [ [ cat => 'dog' ] ], [ Content => { cat => 'dog' }, ], [ Content => [ cat => 'dog' ], ], ) { - my $ucall = uc $call; - - is ($ua->$call($url, @$arg)->content, <<"EOT", "$call @$arg"); -$ucall http://www.example.com + is ($ua->put($url, @$arg)->content, <<"EOT", "put @$arg"); +PUT http://www.example.com User-Agent: foo/0.1 Content-Length: 7 Content-Type: application/x-www-form-urlencoded cat=dog EOT + } +}; + +# These forms will all be x-www-form-urlencoded +subtest 'POST x-www-form-urlencoded' => sub { + plan tests => 4; + for my $arg ( + [ { cat => 'dog' } ], + [ [ cat => 'dog' ] ], + [ Content => { cat => 'dog' }, ], + [ Content => [ cat => 'dog' ], ], + ) { + is ($ua->post($url, @$arg)->content, <<"EOT", "post @$arg"); +POST http://www.example.com +User-Agent: foo/0.1 +Content-Length: 7 +Content-Type: application/x-www-form-urlencoded +cat=dog +EOT } -} +}; # These should all use the default for my $call (qw(post put)) { @@ -64,4 +88,3 @@ Content-Type: application/json EOT } - diff --git a/xt/author/pod-coverage.t b/xt/author/pod-coverage.t index fdd5db2..dd1a5a7 100644 --- a/xt/author/pod-coverage.t +++ b/xt/author/pod-coverage.t @@ -26,21 +26,21 @@ plan skip_all => 'All the modules we found were excluded from POD coverage test. plan tests => scalar @modules; my %trustme = ( - 'LWP::Protocol::http' => [ - qr/^(?:hlist_remove|socket_class|socket_type)$/ - ], - 'LWP::Protocol::gopher' => [ - qr/^(?:gopher2url|menu2html)$/ - ], + 'LWP::RobotUA' => [ + qr/^host_count$/ + ], 'LWP::UserAgent' => [ qr/^(?:run_handlers|send_request|use_alarm|use_eval)$/ ], 'LWP::Protocol' => [ qr/^(?:max_size|timeout)$/ ], - 'LWP::RobotUA' => [ - qr/^host_count$/ - ] + 'LWP::Protocol::http' => [ + qr/^(?:hlist_remove|socket_class|socket_type)$/ + ], + 'LWP::Protocol::gopher' => [ + qr/^(?:gopher2url|menu2html)$/ + ] ); my @also_private; diff --git a/xt/release/changes_has_content.t b/xt/release/changes_has_content.t index c7049df..a6a6e90 100644 --- a/xt/release/changes_has_content.t +++ b/xt/release/changes_has_content.t @@ -4,7 +4,7 @@ use Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; -my $newver = '6.21'; +my $newver = '6.22'; my $trial_token = '-TRIAL'; SKIP: {