Skip to content

Commit

Permalink
v6.37
Browse files Browse the repository at this point in the history
    - Improve ->add_handler documentation (GH #272) (Julien Fiegehenn)
    - Alter our rule set to allow IPv6 proxy hosts beginning with [. (GH #237)
    - Add a jigsaw test for 307 redirects (GH#285) (Nik LaBelle)
  • Loading branch information
oalders committed Mar 6, 2019
1 parent 94ae520 commit 34f12e6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Change history for libwww-perl

{{$NEXT}}
6.37 2019-03-06 20:49:26Z
- Improve ->add_handler documentation (GH #272) (Julien Fiegehenn)
- Alter our rule set to allow IPv6 proxy hosts beginning with [. (GH #237)
- Add a jigsaw test for 307 redirects (GH#285) (Nik LaBelle)
Expand Down
93 changes: 50 additions & 43 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,96 +108,96 @@
"provides" : {
"LWP" : {
"file" : "lib/LWP.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Authen::Basic" : {
"file" : "lib/LWP/Authen/Basic.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Authen::Digest" : {
"file" : "lib/LWP/Authen/Digest.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Authen::Ntlm" : {
"file" : "lib/LWP/Authen/Ntlm.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::ConnCache" : {
"file" : "lib/LWP/ConnCache.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Debug" : {
"file" : "lib/LWP/Debug.pm",
"version" : "6.36",
"version" : "6.37",
"x_deprecated" : 1
},
"LWP::Debug::TraceHTTP" : {
"file" : "lib/LWP/Debug/TraceHTTP.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::DebugFile" : {
"file" : "lib/LWP/DebugFile.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::MemberMixin" : {
"file" : "lib/LWP/MemberMixin.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol" : {
"file" : "lib/LWP/Protocol.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::cpan" : {
"file" : "lib/LWP/Protocol/cpan.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::data" : {
"file" : "lib/LWP/Protocol/data.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::file" : {
"file" : "lib/LWP/Protocol/file.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::ftp" : {
"file" : "lib/LWP/Protocol/ftp.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::gopher" : {
"file" : "lib/LWP/Protocol/gopher.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::http" : {
"file" : "lib/LWP/Protocol/http.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::loopback" : {
"file" : "lib/LWP/Protocol/loopback.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::mailto" : {
"file" : "lib/LWP/Protocol/mailto.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::nntp" : {
"file" : "lib/LWP/Protocol/nntp.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Protocol::nogo" : {
"file" : "lib/LWP/Protocol/nogo.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::RobotUA" : {
"file" : "lib/LWP/RobotUA.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::Simple" : {
"file" : "lib/LWP/Simple.pm",
"version" : "6.36"
"version" : "6.37"
},
"LWP::UserAgent" : {
"file" : "lib/LWP/UserAgent.pm",
"version" : "6.36"
"version" : "6.37"
}
},
"release_status" : "stable",
Expand All @@ -214,10 +214,10 @@
"x_IRC" : "irc://irc.perl.org/#lwp",
"x_MailingList" : "mailto:libwww@perl.org"
},
"version" : "6.36",
"version" : "6.37",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.029003"
"version" : "5.026001"
},
"plugins" : [
{
Expand Down Expand Up @@ -268,8 +268,8 @@
"meta_noindex" : 1
},
"Dist::Zilla::Role::ModuleMetadata" : {
"Module::Metadata" : "1.000034",
"version" : "0.006"
"Module::Metadata" : "1.000033",
"version" : "0.004"
}
},
"name" : "MetaProvides::Package",
Expand Down Expand Up @@ -312,7 +312,7 @@
"class" : "Dist::Zilla::Plugin::Git::Contributors",
"config" : {
"Dist::Zilla::Plugin::Git::Contributors" : {
"git_version" : "2.18.0",
"git_version" : "2.20.1",
"include_authors" : 0,
"include_releaser" : 1,
"order_by" : "name",
Expand Down Expand Up @@ -345,7 +345,7 @@
{
"class" : "Dist::Zilla::Plugin::InstallGuide",
"name" : "InstallGuide",
"version" : "1.200011"
"version" : "1.200012"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
Expand All @@ -361,8 +361,8 @@
"class" : "Dist::Zilla::Plugin::DynamicPrereqs",
"config" : {
"Dist::Zilla::Role::ModuleMetadata" : {
"Module::Metadata" : "1.000034",
"version" : "0.006"
"Module::Metadata" : "1.000033",
"version" : "0.004"
}
},
"name" : "DynamicPrereqs",
Expand All @@ -381,7 +381,7 @@
}
},
"name" : "MakeMaker::Awesome",
"version" : "0.47"
"version" : "0.41"
},
{
"class" : "Dist::Zilla::Plugin::MojibakeTests",
Expand Down Expand Up @@ -421,6 +421,11 @@
"name" : "Test::Compile",
"version" : "2.058"
},
{
"class" : "Dist::Zilla::Plugin::Substitute",
"name" : "00-compile.t",
"version" : "0.006"
},
{
"class" : "Dist::Zilla::Plugin::Test::Portability",
"config" : {
Expand Down Expand Up @@ -454,7 +459,7 @@
},
{
"class" : "Dist::Zilla::Plugin::Substitute",
"name" : "Substitute",
"name" : "changes_has_content.t",
"version" : "0.006"
},
{
Expand Down Expand Up @@ -616,7 +621,7 @@
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.18.0",
"git_version" : "2.20.1",
"repo_root" : "."
}
},
Expand Down Expand Up @@ -680,7 +685,7 @@
}
},
"name" : "CopyFilesFromRelease",
"version" : "0.007"
"version" : "0.006"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
Expand Down Expand Up @@ -726,7 +731,7 @@
}
},
"name" : "@Git::VersionManager/CopyFilesFromRelease",
"version" : "0.007"
"version" : "0.006"
},
{
"class" : "Dist::Zilla::Plugin::Git::Commit",
Expand All @@ -746,7 +751,7 @@
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.18.0",
"git_version" : "2.20.1",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
Expand All @@ -763,12 +768,12 @@
"branch" : null,
"changelog" : "Changes",
"signed" : 0,
"tag" : "v6.36",
"tag" : "v6.37",
"tag_format" : "v%v",
"tag_message" : "v%v"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.18.0",
"git_version" : "2.20.1",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
Expand Down Expand Up @@ -818,7 +823,7 @@
"changelog" : "Changes"
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.18.0",
"git_version" : "2.20.1",
"repo_root" : "."
},
"Dist::Zilla::Role::Git::StringFormatter" : {
Expand All @@ -838,7 +843,7 @@
"remotes_must_exist" : 1
},
"Dist::Zilla::Role::Git::Repo" : {
"git_version" : "2.18.0",
"git_version" : "2.20.1",
"repo_root" : "."
}
},
Expand Down Expand Up @@ -973,6 +978,7 @@
"murphy <murphy@genome.chop.edu>",
"Naveed Massjouni <naveedm9@gmail.com>",
"Nigel Gregoire <nigelgregoire@gmail.com>",
"Nik LaBelle <nalabelle@gmail.com>",
"Olaf Alders <olaf@wundersolutions.com>",
"Ondrej Hanak <ondrej.hanak@ubs.com>",
"Patrik Lundin <patrik.lundin@su.se>",
Expand All @@ -986,6 +992,7 @@
"Sean M. Burke <sburke@cpan.org>",
"Sergey Romanov <sromanov-dev@yandex.ru>",
"Shoichi Kaji <skaji@cpan.org>",
"simbabque <simbabque@cpan.org>",
"Slaven Rezic <slaven@rezic.de>",
"Spiros Denaxas <s.denaxas@gmail.com>",
"Steffen Ullrich <Steffen_Ullrich@genua.de>",
Expand All @@ -1006,7 +1013,7 @@
"Yury Zavarin <yury.zavarin@gmail.com>",
"Zefram <zefram@fysh.org>"
],
"x_generated_by_perl" : "v5.29.3",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.06"
"x_generated_by_perl" : "v5.26.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.04"
}

31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,67 +460,70 @@ specify `%matchspec` see ["Matching" in HTTP::Config](https://metacpan.org/pod/H

The possible values `$phase` and the corresponding callback signatures are:

- response\_data => sub { my($response, $ua, $h, $data) = @\_; ... }
- response\_data => sub { my($response, $ua, $handler, $data) = @\_; ... }

This handler is called for each chunk of data received for the
response. The handler might croak to abort the request.

This handler needs to return a TRUE value to be called again for
subsequent chunks for the same request.

- response\_done => sub { my($response, $ua, $h) = @\_; ... }
- response\_done => sub { my($response, $ua, $handler) = @\_; ... }

The handler is called after the response has been fully received, but
before any redirect handling is attempted. The handler can be used to
extract information or modify the response.

- response\_header => sub { my($response, $ua, $h) = @\_; ... }
- response\_header => sub { my($response, $ua, $handler) = @\_; ... }

This handler is called right after the response headers have been
received, but before any content data. The handler might set up
handlers for data and might croak to abort the request.

The handler might set the $response->{default\_add\_content} value to
The handler might set the `$response->{default_add_content}` value to
control if any received data should be added to the response object
directly. This will initially be false if the $ua->request() method
was called with a $content\_file or $content\_cb argument; otherwise true.
directly. This will initially be false if the `$ua->request()` method
was called with a `$content_file` or `$content_cb argument`; otherwise true.

- request\_prepare => sub { my($request, $ua, $h) = @\_; ... }
- request\_prepare => sub { my($request, $ua, $handler) = @\_; ... }

The handler is called before the request is sent and can modify the
request any way it see fit. This can for instance be used to add
certain headers to specific requests.

The method can assign a new request object to $\_\[0\] to replace the
The method can assign a new request object to `$_[0]` to replace the
request that is sent fully.

The return value from the callback is ignored. If an exception is
raised it will abort the request and make the request method return a
"400 Bad request" response.

- request\_preprepare => sub { my($request, $ua, $h) = @\_; ... }
- request\_preprepare => sub { my($request, $ua, $handler) = @\_; ... }

The handler is called before the `request_prepare` and other standard
initialization of the request. This can be used to set up headers
and attributes that the `request_prepare` handler depends on. Proxy
initialization should take place here; but in general don't register
handlers for this phase.

- request\_send => sub { my($request, $ua, $h) = @\_; ... }
- request\_send => sub { my($request, $ua, $handler) = @\_; ... }

This handler gets a chance of handling requests before they're sent to the
protocol handlers. It should return an HTTP::Response object if it
protocol handlers. It should return an [HTTP::Response](https://metacpan.org/pod/HTTP::Response) object if it
wishes to terminate the processing; otherwise it should return nothing.

The `response_header` and `response_data` handlers will not be
invoked for this response, but the `response_done` will be.

- response\_redirect => sub { my($response, $ua, $h) = @\_; ... }
- response\_redirect => sub { my($response, $ua, $handler) = @\_; ... }

The handler is called in $ua->request after `response_done`. If the
handler returns an HTTP::Request object we'll start over with processing
The handler is called in `$ua->request` after `response_done`. If the
handler returns an [HTTP::Request](https://metacpan.org/pod/HTTP::Request) object we'll start over with processing
this request instead.

For all of these, `$handler` is a code reference to the handler that
is currently being run.

## get\_my\_handler

$ua->get_my_handler( $phase, %matchspec );
Expand Down

0 comments on commit 34f12e6

Please sign in to comment.