r70087 - in /trunk/libanyevent-http-perl: Changes HTTP.pm MANIFEST META.json META.yml README debian/changelog debian/control debian/copyright
periapt-guest at users.alioth.debian.org
periapt-guest at users.alioth.debian.org
Mon Feb 28 17:31:11 UTC 2011
Author: periapt-guest
Date: Mon Feb 28 17:30:56 2011
New Revision: 70087
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=70087
Log:
New upstream release
Added:
trunk/libanyevent-http-perl/META.json
- copied unchanged from r70084, branches/upstream/libanyevent-http-perl/current/META.json
Removed:
trunk/libanyevent-http-perl/META.yml
Modified:
trunk/libanyevent-http-perl/Changes
trunk/libanyevent-http-perl/HTTP.pm
trunk/libanyevent-http-perl/MANIFEST
trunk/libanyevent-http-perl/README
trunk/libanyevent-http-perl/debian/changelog
trunk/libanyevent-http-perl/debian/control
trunk/libanyevent-http-perl/debian/copyright
Modified: trunk/libanyevent-http-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/Changes?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/Changes (original)
+++ trunk/libanyevent-http-perl/Changes Mon Feb 28 17:30:56 2011
@@ -1,6 +1,22 @@
Revision history for AnyEvent::HTTP
TODO: provide lwp_request function that takes an lwp http requets and returns a http response.
+TODO: httpbis: $location = URI->new_abs($location, "$scheme://$host:$port$path_query")->as_string;
+
+2.1 Thu Feb 24 13:11:51 CET 2011
+ - the keepalive and persistent parameters were actually named
+ differently in the code - they now work as documented.
+ - fix a bug where callbacks would sometimes never be called when
+ the request timeout is near or below the persistent conenction
+ timeout (testcase by Cindy Wang).
+ - destroying the guard would have no effect when a request was
+ recursing or being retired.
+
+2.04 Sat Feb 19 07:45:24 CET 2011
+ - "proxy => undef" now overrides any global proxy when specified.
+ - require scheme in urls, also use a stricter match to match urls,
+ leading or trailing garbage is no longer tolerated.
+ - EXPERIMENTAL: allow '=' in cookie values.
2.03 Tue Jan 18 18:49:35 CET 2011
- dummy reupload, file gone from cpan somehow.
Modified: trunk/libanyevent-http-perl/HTTP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/HTTP.pm?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/HTTP.pm (original)
+++ trunk/libanyevent-http-perl/HTTP.pm Mon Feb 28 17:30:56 2011
@@ -48,7 +48,7 @@
use base Exporter::;
-our $VERSION = '2.03';
+our $VERSION = '2.1';
our @EXPORT = qw(http_get http_post http_head http_request);
@@ -181,10 +181,13 @@
=item proxy => [$host, $port[, $scheme]] or undef
-Use the given http proxy for all requests. If not specified, then the
-default proxy (as specified by C<$ENV{http_proxy}>) is used.
+Use the given http proxy for all requests, or no proxy if C<undef> is
+used.
C<$scheme> must be either missing or must be C<http> for HTTP.
+
+If not specified, then the default proxy is used (see
+C<AnyEvent::HTTP::set_proxy>).
=item body => $string
@@ -531,7 +534,7 @@
\G\s*
(?:
expires \s*=\s* ([A-Z][a-z][a-z]+,\ [^,;]+)
- | ([^=;,[:space:]]+) (?: \s*=\s* (?: "((?:[^\\"]+|\\.)*)" | ([^=;,[:space:]]*) ) )?
+ | ([^=;,[:space:]]+) (?: \s*=\s* (?: "((?:[^\\"]+|\\.)*)" | ([^;,[:space:]]*) ) )?
)
}gcxsi
) {
@@ -711,11 +714,11 @@
return $cb->(undef, { @pseudo, Status => 599, Reason => "Too many redirections" })
if $recurse < 0;
- my $proxy = $arg{proxy} || $PROXY;
+ my $proxy = exists $arg{proxy} ? $arg{proxy} : $PROXY;
my $timeout = $arg{timeout} || $TIMEOUT;
my ($uscheme, $uauthority, $upath, $query, undef) = # ignore fragment
- $url =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:(\?[^#]*))?(?:#(.*))?|;
+ $url =~ m|^([^:]+):(?://([^/?#]*))?([^?#]*)(?:(\?[^#]*))?(?:#(.*))?$|;
$uscheme = lc $uscheme;
@@ -772,14 +775,14 @@
my $idempotent = $method =~ /^(?:GET|HEAD|PUT|DELETE|OPTIONS|TRACE)$/;
# default value for keepalive is true iff the request is for an idempotent method
- my $keepalive = exists $arg{keepalive} ? !!$arg{keepalive} : $idempotent;
- my $keepalive10 = exists $arg{keepalive10} ? $arg{keepalive10} : !$proxy;
- my $keptalive; # true if this is actually a recycled connection
+ my $persistent = exists $arg{persistent} ? !!$arg{persistent} : $idempotent;
+ my $keepalive = exists $arg{keepalive} ? !!$arg{keepalive} : !$proxy;
+ my $was_persistent; # true if this is actually a recycled connection
# the key to use in the keepalive cache
my $ka_key = "$uhost\x00$arg{sessionid}";
- $hdr{connection} = ($keepalive ? $keepalive10 ? "keep-alive " : "" : "close ") . "Te"; #1.1
+ $hdr{connection} = ($persistent ? $keepalive ? "keep-alive " : "" : "close ") . "Te"; #1.1
$hdr{te} = "trailers" unless exists $hdr{te}; #1.1
my %state = (connect_guard => 1);
@@ -873,11 +876,11 @@
}
}
- my $finish = sub { # ($data, $err_status, $err_reason[, $keepalive])
+ my $finish = sub { # ($data, $err_status, $err_reason[, $persistent])
if ($state{handle}) {
# handle keepalive
if (
- $keepalive
+ $persistent
&& $_[3]
&& ($hdr{HTTPVersion} < 1.1
? $hdr{connection} =~ /\bkeep-?alive\b/i
@@ -906,13 +909,17 @@
# we ignore any errors, as it is very common to receive
# Content-Length != 0 but no actual body
# we also access %hdr, as $_[1] might be an erro
- http_request (
- $method => $hdr{location},
- %arg,
- recurse => $recurse - 1,
- Redirect => [$_[0], \%hdr],
- $cb
- );
+ $state{recurse} =
+ http_request (
+ $method => $hdr{location},
+ %arg,
+ recurse => $recurse - 1,
+ Redirect => [$_[0], \%hdr],
+ sub {
+ %state = ();
+ &$cb
+ },
+ );
} else {
$cb->($_[0], \%hdr);
}
@@ -1034,17 +1041,22 @@
# if keepalive is enabled, then the server closing the connection
# before a response can happen legally - we retry on idempotent methods.
- if ($keptalive && $idempotent) {
+ if ($was_persistent && $idempotent) {
my $old_eof = $hdl->{on_eof};
$hdl->{on_eof} = sub {
_destroy_state %state;
- http_request (
- $method => $url,
- %arg,
- keepalive => 0,
- $cb
- );
+ %state = ();
+ $state{recurse} =
+ http_request (
+ $method => $url,
+ %arg,
+ keepalive => 0,
+ sub {
+ %state = ();
+ &$cb
+ }
+ );
};
$hdl->on_read (sub {
return unless %state;
@@ -1062,13 +1074,14 @@
my $prepare_handle = sub {
my ($hdl) = $state{handle};
- $hdl->timeout ($timeout);
$hdl->on_error (sub {
_error %state, $cb, { @pseudo, Status => $ae_error, Reason => $_[2] };
});
$hdl->on_eof (sub {
_error %state, $cb, { @pseudo, Status => $ae_error, Reason => "Unexpected end-of-file" };
});
+ $hdl->timeout_reset;
+ $hdl->timeout ($timeout);
};
# connected to proxy (or origin server)
@@ -1119,11 +1132,18 @@
# try to use an existing keepalive connection, but only if we, ourselves, plan
# on a keepalive request (in theory, this should be a separate config option).
- if ($keepalive && $KA_CACHE{$ka_key}) {
- $keptalive = 1;
+ if ($persistent && $KA_CACHE{$ka_key}) {
+ $was_persistent = 1;
+
$state{handle} = ka_fetch $ka_key;
+ $state{handle}->destroyed
+ and die "got a destructed habndle. pah\n";#d#
$prepare_handle->();
+ $state{handle}->destroyed
+ and die "got a destructed habndle. pa2\n";#d#
$handle_actual_request->();
+ $state{handle}->destroyed
+ and die "got a destructed habndle. pa3\n";#d#
} else {
my $tcp_connect = $arg{tcp_connect}
@@ -1173,6 +1193,10 @@
string of the form C<http://host:port>, croaks otherwise.
To clear an already-set proxy, use C<undef>.
+
+When AnyEvent::HTTP is laoded for the first time it will query the
+default proxy from the operating system, currently by looking at
+C<$ENV{http_proxy>}.
=item AnyEvent::HTTP::cookie_jar_expire $jar[, $session_end]
@@ -1335,7 +1359,7 @@
=head2 HTTP/1.1 FILE DOWNLOAD
Downloading files with HTTP can be quite tricky, especially when something
-goes wrong and you want tor esume.
+goes wrong and you want to resume.
Here is a function that initiates and resumes a download. It uses the
last modified time to check for file content changes, and works with many
Modified: trunk/libanyevent-http-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/MANIFEST?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/MANIFEST (original)
+++ trunk/libanyevent-http-perl/MANIFEST Mon Feb 28 17:30:56 2011
@@ -6,4 +6,4 @@
HTTP.pm
t/00_load.t
t/01_basic.t
-META.yml Module meta-data (added by MakeMaker)
+META.json Module meta-data (added by MakeMaker)
Modified: trunk/libanyevent-http-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/README?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/README (original)
+++ trunk/libanyevent-http-perl/README Mon Feb 28 17:30:56 2011
@@ -131,11 +131,13 @@
Default timeout is 5 minutes.
proxy => [$host, $port[, $scheme]] or undef
- Use the given http proxy for all requests. If not specified,
- then the default proxy (as specified by $ENV{http_proxy}) is
- used.
+ Use the given http proxy for all requests, or no proxy if
+ "undef" is used.
$scheme must be either missing or must be "http" for HTTP.
+
+ If not specified, then the default proxy is used (see
+ "AnyEvent::HTTP::set_proxy").
body => $string
The request body, usually empty. Will be sent as-is (future
@@ -367,6 +369,10 @@
a string of the form "http://host:port", croaks otherwise.
To clear an already-set proxy, use "undef".
+
+ When AnyEvent::HTTP is laoded for the first time it will query the
+ default proxy from the operating system, currently by looking at
+ "$ENV{http_proxy"}.
AnyEvent::HTTP::cookie_jar_expire $jar[, $session_end]
Remove all cookies from the cookie jar that have been expired. If
@@ -459,7 +465,7 @@
HTTP/1.1 FILE DOWNLOAD
Downloading files with HTTP can be quite tricky, especially when
- something goes wrong and you want tor esume.
+ something goes wrong and you want to resume.
Here is a function that initiates and resumes a download. It uses the
last modified time to check for file content changes, and works with
Modified: trunk/libanyevent-http-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/debian/changelog?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/debian/changelog (original)
+++ trunk/libanyevent-http-perl/debian/changelog Mon Feb 28 17:30:56 2011
@@ -1,5 +1,9 @@
-libanyevent-http-perl (2.03-1) UNRELEASED; urgency=low
+libanyevent-http-perl (2.10-1) UNRELEASED; urgency=low
+ [ Jonathan Yu ]
* Initial Release (Closes: #608567)
- -- Jonathan Yu <jawnsy at cpan.org> Fri, 31 Dec 2010 21:47:13 -0500
+ [ Nicholas Bamber ]
+ * New upstream release
+
+ -- Nicholas Bamber <nicholas at periapt.co.uk> Mon, 28 Feb 2011 17:27:37 +0000
Modified: trunk/libanyevent-http-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/debian/control?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/debian/control (original)
+++ trunk/libanyevent-http-perl/debian/control Mon Feb 28 17:30:56 2011
@@ -6,7 +6,8 @@
libcommon-sense-perl,
libanyevent-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Jonathan Yu <jawnsy at cpan.org>
+Uploaders: Jonathan Yu <jawnsy at cpan.org>,
+ Nicholas Bamber <nicholas at periapt.co.uk>
Standards-Version: 3.9.1
Homepage: http://search.cpan.org/dist/AnyEvent-HTTP/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libanyevent-http-perl/
Modified: trunk/libanyevent-http-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libanyevent-http-perl/debian/copyright?rev=70087&op=diff
==============================================================================
--- trunk/libanyevent-http-perl/debian/copyright (original)
+++ trunk/libanyevent-http-perl/debian/copyright Mon Feb 28 17:30:56 2011
@@ -8,7 +8,9 @@
License: Artistic or GPL-1+
Files: debian/*
-Copyright: 2010, Jonathan Yu <jawnsy at cpan.org>
+Copyright:
+ 2010, Jonathan Yu <jawnsy at cpan.org>
+ 2011, Nicholas Bamber <nicholas at periapt.co.uk>
License: Artistic or GPL-1+
License: Artistic
More information about the Pkg-perl-cvs-commits
mailing list