r52044 - in /branches/upstream/libpoe-component-client-http-perl/current: ./ lib/POE/Component/Client/ lib/POE/Component/Client/HTTP/ lib/POE/Filter/ t/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Tue Feb 2 16:59:13 UTC 2010
Author: jawnsy-guest
Date: Tue Feb 2 16:59:05 2010
New Revision: 52044
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52044
Log:
[svn-upgrade] Integrating new upstream version, libpoe-component-client-http-perl (0.894)
Modified:
branches/upstream/libpoe-component-client-http-perl/current/CHANGES
branches/upstream/libpoe-component-client-http-perl/current/META.yml
branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm
branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm
branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/RequestFactory.pm
branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Filter/HTTPHead.pm
branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t
branches/upstream/libpoe-component-client-http-perl/current/t/53_response_parser.t
branches/upstream/libpoe-component-client-http-perl/current/t/57_pravus_progress.t
Modified: branches/upstream/libpoe-component-client-http-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/CHANGES?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/CHANGES (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/CHANGES Tue Feb 2 16:59:05 2010
@@ -1,3 +1,14 @@
+================================
+2010-01-31 03:28:51 -0500 v0_894
+================================
+
+ commit 25fdd2daebbfef43e310955cae152d49a3769074
+ Author: Rocco Caputo <rcaputo at cpan.org>
+ Date: Sun Jan 31 03:28:51 2010 -0500
+
+ Add X-PCCH-Peer header containing the socket peer address:port.
+ Feature requested by Doreen Grey on POE's mailing list.
+
================================
2009-12-04 11:42:26 -0800 v0_893
================================
@@ -192,74 +203,6 @@
Doc fix. Client::DNS is used by Client::Keepalive and is currently
not optional.
-===============================
-2008-12-09 06:17:03 +0000 v0_87
-===============================
-
- commit d51dd403126b295aa58b3c7c3332dcd865575768
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Tue Dec 9 06:17:03 2008 +0000
-
- Time for a new release. Bump the version and fix dependencies.
-
- commit 5ddae5506ef1174129cf4c7b9c9db5ba79d2f6ff
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Tue Dec 9 06:10:50 2008 +0000
-
- Switch a post() to call() to avoid dispatch timing errors that caused
- some machines to fail this test. I think it's the test's fault for
- being intolerant, and I'm not entirely sure the fix will work
- everywhere.
-
- commit e3d77da02785ce3fb5f17034b561aae783247faa
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Tue Dec 9 05:44:46 2008 +0000
-
- Fix a spurious test failure. Not all systems implement (or even
- enable) Nagle's algorithm the same way. This change makes
- t/01_request.t not as susceptible to packet transmission timing.
- Previously the test would fail of packets were combined (but succeed
- if, like on my development system, they were sent separately).
-
- commit ae7693ce96c7d9d925a22ef4c966c820000febf4
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Tue Dec 9 05:29:27 2008 +0000
-
- Don't set a content length if the content is a reference. The content
- length would be the reference's stringified length rather than the
- length of any actual content. In the case of CODE references, content
- will be generated in chunks anyway.
-
- commit 011588707f19d28abf1051f74cc99359fb301113
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Mon Dec 8 07:54:03 2008 +0000
-
- Clean up the leaky ext_request_to_int_id in more places. Apocalypse
- suggested using the requesting HTTP::Request reference directly as
- the internal ID rather than mapping it. That bears some
- investigation.
-
- commit 21df5cc25646c80fad3530caf3d469e1d84c7129
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Mon Dec 8 07:36:19 2008 +0000
-
- New version. RequestFactory doesn not like underscores in version
- numbers.
-
- commit 8bb874ea03923e9b3f4a1d2f5f23a26eeb8ce543
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Mon Dec 8 07:27:14 2008 +0000
-
- Internal development release.
-
- commit d48a99e0b3d46808082788c5eb6dac4f01ba1566
- Author: Rocco Caputo <rcaputo at cpan.org>
- Date: Mon Dec 8 07:23:22 2008 +0000
-
- Move data cleanup for request_to_id outside wheel check blocks. The
- ID being cleaned up isn't a wheel's ID. Also renamed the data member
- for future clarity, as well as REQ_REQUEST (related).
-
==============
End of Excerpt
==============
Modified: branches/upstream/libpoe-component-client-http-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/META.yml?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/META.yml (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/META.yml Tue Feb 2 16:59:05 2010
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: POE-Component-Client-HTTP
-version: 0.893
+version: 0.894
abstract: Non-blocking/concurrent HTTP queries with POE
author:
- Rocco Caputo <rcaputo at cpan.org>
Modified: branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP.pm Tue Feb 2 16:59:05 2010
@@ -9,11 +9,12 @@
use constant DEBUG_DATA => 0;
use vars qw($VERSION);
-$VERSION = '0.893';
+$VERSION = '0.894';
use Carp qw(croak);
use HTTP::Response;
use Net::HTTP::Methods;
+use Socket qw(sockaddr_in inet_ntoa);
use POE::Component::Client::HTTP::RequestFactory;
use POE::Component::Client::HTTP::Request qw(:states :fields);
@@ -339,6 +340,16 @@
$heap->{wheel_to_request}->{ $new_wheel->ID() } = $request_id;
$request->[REQ_CONNECTION] = $connection;
+
+ my $peer_addr = getpeername($new_wheel->get_input_handle());
+ if (defined $peer_addr) {
+ my ($port, $iaddr) = sockaddr_in($peer_addr);
+ $request->[REQ_PEERNAME] = inet_ntoa($iaddr) . "." . $port;
+ }
+ else {
+ $request->[REQ_PEERNAME] = "error:$!";
+ }
+
$request->create_timer($heap->{factory}->timeout);
$request->send_to_wheel;
}
@@ -545,7 +556,10 @@
"Generating HTTP response for HTTP/0.9 response without LF."
);
$request->[REQ_RESPONSE] = HTTP::Response->new(
- 200, 'OK', [ 'Content-Type' => 'text/html' ], $text
+ 200, 'OK', [
+ 'Content-Type' => 'text/html',
+ 'X-PCCH-Peer' => $request->[REQ_PEERNAME],
+ ], $text
);
$request->[REQ_RESPONSE]->protocol('HTTP/0.9');
$request->[REQ_RESPONSE]->request($request->[REQ_HTTP_REQUEST]);
@@ -625,6 +639,7 @@
# FIXME: This happens when the response is HTTP/0.9 and doesn't
# include a status line. See t/53_response_parser.t.
$request->[REQ_RESPONSE] = $input;
+ $input->header("X-PCCH-Peer", $request->[REQ_PEERNAME]);
# Some responses are without content by definition
# FIXME: #12363
@@ -1446,6 +1461,26 @@
L<http://www.perlmonks.org/?node_id=683833> and
L<http://rt.cpan.org/Ticket/Display.html?id=35538>
+=head1 CLIENT HEADERS
+
+POE::Component::Client::HTTP sets its own response headers with
+additional information. All of its headers begin with "X-PCCH".
+
+=head2 X-PCCH-Peer
+
+X-PCCH-Peer contains the remote IPv4 address and port, separated by a
+period. For example, "127.0.0.1.8675" represents port 8675 on
+localhost.
+
+Proxying will render X-PCCH-Peer nearly useless, since the socket will
+be connected to a proxy rather than the server itself.
+
+This feature was added at Doreen Grey's request. Doreen wanted a
+means to find the remote server's address without having to make an
+additional request.
+
+Patches for IPv6 support are welcome.
+
=head1 ENVIRONMENT
POE::Component::Client::HTTP uses two standard environment variables:
Modified: branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/Request.pm Tue Feb 2 16:59:05 2010
@@ -1,4 +1,6 @@
package POE::Component::Client::HTTP::Request;
+# vim: ts=2 sw=2 expandtab
+
use strict;
use warnings;
@@ -39,6 +41,7 @@
use constant REQ_START_TIME => 15;
use constant REQ_FACTORY => 16;
use constant REQ_CONN_ID => 17;
+use constant REQ_PEERNAME => 18;
use constant RS_CONNECT => 0x01; # establishing a connection
use constant RS_SENDING => 0x02; # sending request to server
@@ -60,7 +63,7 @@
REQ_ID REQ_POSTBACK REQ_CONNECTION REQ_HTTP_REQUEST REQ_STATE
REQ_RESPONSE REQ_BUFFER REQ_OCTETS_GOT REQ_TIMER
REQ_PROG_POSTBACK REQ_USING_PROXY REQ_HOST REQ_PORT
- REQ_HISTORY REQ_START_TIME REQ_CONN_ID
+ REQ_HISTORY REQ_START_TIME REQ_CONN_ID REQ_PEERNAME
)
) {
no strict 'refs';
@@ -155,6 +158,7 @@
time(), # REQ_START_TIME
$factory, # REQ_FACTORY
undef, # REQ_CONN_ID
+ undef, # REQ_PEERNAME
];
return bless $self, $class;
}
Modified: branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/RequestFactory.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/RequestFactory.pm?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/RequestFactory.pm (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Component/Client/HTTP/RequestFactory.pm Tue Feb 2 16:59:05 2010
@@ -19,7 +19,7 @@
use constant DEBUG => 0;
use constant DEFAULT_BLOCK_SIZE => 4096;
-our $VERSION = "0.893";
+our $VERSION = "0.894";
=head1 CONSTRUCTOR
Modified: branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Filter/HTTPHead.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Filter/HTTPHead.pm?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Filter/HTTPHead.pm (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/lib/POE/Filter/HTTPHead.pm Tue Feb 2 16:59:05 2010
@@ -137,7 +137,7 @@
=cut
use vars qw($VERSION);
-$VERSION = '0.893';
+$VERSION = '0.894';
use base qw(POE::Filter::Stackable);
use POE::Filter::Line;
Modified: branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/t/14_gzipped_content.t Tue Feb 2 16:59:05 2010
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# vim: filetype=perl
+# vim: filetype=perl ts=2 sw=2 expandtab
# Test gzip'd content encoding.
@@ -22,10 +22,10 @@
use Net::HTTP::Methods;
if (
- eval { Net::HTTP::Methods::zlib_ok() } or
- eval { Net::HTTP::Methods::gunzip_ok() }
+ eval { Net::HTTP::Methods::zlib_ok() } or
+ eval { Net::HTTP::Methods::gunzip_ok() }
) {
- plan tests => 1;
+ plan tests => 1;
}
else {
plan skip_all => 'Compress::Zlib no present';
Modified: branches/upstream/libpoe-component-client-http-perl/current/t/53_response_parser.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/t/53_response_parser.t?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/t/53_response_parser.t (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/t/53_response_parser.t Tue Feb 2 16:59:05 2010
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# vim: filetype=perl
+# vim: filetype=perl ts=2 sw=2 expandtab
# Generic response parser testing, especially for cases where
# POE::Component::Client::HTTP generates the wrong response.
@@ -14,7 +14,7 @@
sub DEBUG () { 0 }
# The number of tests must match scalar(@tests).
-use Test::More tests => 4;
+use Test::More tests => 5;
use POE;
use POE::Component::Client::HTTP;
@@ -42,6 +42,12 @@
),
sub {
my $response = shift;
+
+ ok(
+ $response->header("X-PCCH-Peer") =~ /^127\.0\.0\.1.\d+$/,
+ "peer address header"
+ );
+
ok(
$response->code() == 200 &&
$response->header("Transfer-Encoding") eq "poit, narf",
Modified: branches/upstream/libpoe-component-client-http-perl/current/t/57_pravus_progress.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libpoe-component-client-http-perl/current/t/57_pravus_progress.t?rev=52044&op=diff
==============================================================================
--- branches/upstream/libpoe-component-client-http-perl/current/t/57_pravus_progress.t (original)
+++ branches/upstream/libpoe-component-client-http-perl/current/t/57_pravus_progress.t Tue Feb 2 16:59:05 2010
@@ -1,4 +1,5 @@
# See rt.cpan.org ticket 36627.
+# vim: filetype=perl ts=2 sw=2 expandtab
use warnings;
use strict;
@@ -18,11 +19,11 @@
POE::Session->create(
package_states => [
main => [
- qw(
- _start http_response http_progress _stop
- testd_registered testd_client_input idle_timeout
- )
- ],
+ qw(
+ _start http_response http_progress _stop
+ testd_registered testd_client_input idle_timeout
+ )
+ ],
],
);
@@ -30,17 +31,17 @@
exit 0;
sub _start {
- $_[HEAP]{testd} = Test::POE::Server::TCP->spawn(
- filter => POE::Filter::Stream->new(),
- address => 'localhost',
- );
+ $_[HEAP]{testd} = Test::POE::Server::TCP->spawn(
+ filter => POE::Filter::Stream->new(),
+ address => 'localhost',
+ );
$_[HEAP]{got_response} = 0;
$_[HEAP]{got_progress} = 0;
}
sub testd_registered {
- my $port = $_[HEAP]{testd}->port();
+ my $port = $_[HEAP]{testd}->port();
$_[KERNEL]->post(
ua => request => 'http_response',
GET("http://localhost:$port/"), 'id', 'http_progress'
@@ -50,29 +51,29 @@
sub testd_client_input {
my ($kernel, $heap, $id, $input) = @_[KERNEL, HEAP, ARG0, ARG1];
- $heap->{testd}->send_to_client(
- $id,
- "HTTP/1.0 200 OK\x0d\x0a" .
- "Content-Length: 100000\x0d\x0a" .
- "Content-Type: text/html\x0d\x0a" .
- "\x0d\x0a" .
- "!" x 100_000
- );
+ $heap->{testd}->send_to_client(
+ $id,
+ "HTTP/1.0 200 OK\x0d\x0a" .
+ "Content-Length: 100000\x0d\x0a" .
+ "Content-Type: text/html\x0d\x0a" .
+ "\x0d\x0a" .
+ "!" x 100_000
+ );
}
sub http_response {
$_[HEAP]{got_response}++;
- $_[KERNEL]->delay(idle_timeout => 1);
+ $_[KERNEL]->delay(idle_timeout => 1);
}
sub http_progress {
$_[HEAP]{got_progress}++;
- $_[KERNEL]->delay(idle_timeout => 1);
+ $_[KERNEL]->delay(idle_timeout => 1);
}
sub idle_timeout {
- $_[HEAP]{testd}->shutdown();
- $_[KERNEL]->post(ua => "shutdown");
+ $_[HEAP]{testd}->shutdown();
+ $_[KERNEL]->post(ua => "shutdown");
}
sub _stop {
More information about the Pkg-perl-cvs-commits
mailing list