1
0
OBS User unknown 2009-01-09 00:46:04 +00:00 committed by Git OBS Bridge
parent 0d930f24c6
commit 2f1f1359d7
5 changed files with 60 additions and 110 deletions

View File

@ -1,101 +0,0 @@
From af111a4327d4dfc4750e022c1a20adc803a75fbf Mon Sep 17 00:00:00 2001
From: Gisle Aas <gisle@aas.no>
Date: Mon, 20 Oct 2008 13:14:48 +0200
Subject: [PATCH] Wrong content handlers would sometimes be skipped [RT#40187]
The handler filtering in LWP::Protocol::collect depends on stable
handler hashes, but we did not provide that for handlers associated
directly with the response object. The result was that handlers
was skipped randomly based on memory allocation patterns.
---
lib/LWP/Protocol.pm | 36 ++++++++++++++++++++++--------------
lib/LWP/UserAgent.pm | 12 +++++++-----
2 files changed, 29 insertions(+), 19 deletions(-)
Index: libwww-perl-5.816/lib/LWP/Protocol.pm
===================================================================
--- libwww-perl-5.816.orig/lib/LWP/Protocol.pm
+++ libwww-perl-5.816/lib/LWP/Protocol.pm
@@ -103,19 +103,25 @@ sub collect
elsif (!ref($arg) && length($arg)) {
open(my $fh, ">", $arg) || die "Can't write to '$arg': $!";
binmode($fh);
- push(@{$response->{handlers}{response_data}}, sub {
- print $fh $_[3] || die "Can't write to '$arg': $!";
- 1;
- });
- push(@{$response->{handlers}{response_done}}, sub {
- close($fh) || die "Can't write to '$arg': $!";
- undef($fh);
+ push(@{$response->{handlers}{response_data}}, {
+ callback => sub {
+ print $fh $_[3] || die "Can't write to '$arg': $!";
+ 1;
+ },
});
+ push(@{$response->{handlers}{response_done}}, {
+ callback => sub {
+ close($fh) || die "Can't write to '$arg': $!";
+ undef($fh);
+ },
+ });
}
elsif (ref($arg) eq 'CODE') {
- push(@{$response->{handlers}{response_data}}, sub {
- &$arg($_[3], $_[0], $self);
- 1;
+ push(@{$response->{handlers}{response_data}}, {
+ callback => sub {
+ &$arg($_[3], $_[0], $self);
+ 1;
+ },
});
}
else {
@@ -125,10 +131,12 @@ sub collect
$ua->run_handlers("response_header", $response);
if (delete $response->{default_add_content}) {
- push(@{$response->{handlers}{response_data}}, sub {
- $_[0]->add_content($_[3]);
- 1;
- });
+ push(@{$response->{handlers}{response_data}}, {
+ callback => sub {
+ $_[0]->add_content($_[3]);
+ 1;
+ },
+ });
}
Index: libwww-perl-5.816/lib/LWP/UserAgent.pm
===================================================================
--- libwww-perl-5.816.orig/lib/LWP/UserAgent.pm
+++ libwww-perl-5.816/lib/LWP/UserAgent.pm
@@ -613,10 +613,12 @@ sub parse_head {
$parser->xml_mode(1) if $response->content_is_xhtml;
$parser->utf8_mode(1) if $] >= 5.008 && $HTML::Parser::VERSION >= 3.40;
- push(@{$response->{handlers}{response_data}}, sub {
- return unless $parser;
- $parser->parse($_[3]) or undef($parser);
- });
+ push(@{$response->{handlers}{response_data}}, {
+ callback => sub {
+ return unless $parser;
+ $parser->parse($_[3]) or undef($parser);
+ },
+ });
} : undef,
m_media_type => "html",
@@ -765,7 +767,7 @@ sub handlers {
my($self, $phase, $o) = @_;
my @h;
if ($o->{handlers} && $o->{handlers}{$phase}) {
- push(@h, map +{ callback => $_ }, @{$o->{handlers}{$phase}});
+ push(@h, @{$o->{handlers}{$phase}});
}
if (my $conf = $self->{handlers}{$phase}) {
push(@h, $conf->matching($o));

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fcfdf291d55ebd0c0dd6c5cf0ccd67582f0472f9c267e1e73511a6164ded6b1e
size 196546

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2648885e89e26083a929cd1ab686d734ae44dae92c13f2f1abddb90807612670
size 197690

View File

@ -1,3 +1,31 @@
-------------------------------------------------------------------
Sat Dec 20 07:00:37 CET 2008 - coolo@suse.de
- update to 5.822
Various bug fixes
Should store "wire" headers field names with _ without translation.
Test HTTP::Request->parse().
Rename the HTTP::Status constants to have HTTP_ prefix
Add strict mode to HTML::Form
Add content_is_xml method
Make split_header_words() lower case returned tokens/keys
Add decode() method to HTTP::Message
Add encode() method to HTTP::Message
Allow multiple fields to be set with push_header().
Faster push_header()
Add dump method to HTTP::Message.
Add support for x-bzip2 encoding; fix bzip2 decoding.
Add send_header method to HTTP::Daemon
Make the lwp-request User-Agent string include the LWP version.
Calculation of current_age with missing Client-Date.
More correct matching of 'max-age' in freshness_lifetime method
The freshness_lifetime method now support options to control its heuristics
The Content-Length and Content-MD5 headers are no longer valid after encode/decode
Skip LWP test when fork() is unimplemented
A more modern user_agent example.
Make it possible to unset the proxy settings again
Deprecate LWP::Debug
-------------------------------------------------------------------
Mon Nov 17 11:25:31 CET 2008 - lnussel@suse.de

View File

@ -1,7 +1,7 @@
#
# spec file for package perl-libwww-perl (Version 5.816)
# spec file for package perl-libwww-perl (Version 5.822)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -20,8 +20,8 @@
Name: perl-libwww-perl
BuildRequires: perl-Compress-Zlib perl-HTML-Parser perl-URI
Version: 5.816
Release: 2
Version: 5.822
Release: 1
Provides: libwww-perl
Provides: perl_lw3
Obsoletes: perl_lw3
@ -34,7 +34,6 @@ License: Artistic License
Url: http://www.cpan.org/modules/by-module/WWW/
Summary: Modules Providing a World Wide Web API
Source: libwww-perl-%{version}.tar.bz2
Patch: libwww-perl-5.816-lostchars.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@ -51,7 +50,6 @@ Authors:
%prep
%setup -q -n libwww-perl-%{version}
%patch -p1
%build
perl Makefile.PL
@ -91,6 +89,31 @@ rm -rf $RPM_BUILD_ROOT
/var/adm/perl-modules/%{name}
%changelog
* Sat Dec 20 2008 coolo@suse.de
- update to 5.822
Various bug fixes
Should store "wire" headers field names with _ without translation.
Test HTTP::Request->parse().
Rename the HTTP::Status constants to have HTTP_ prefix
Add strict mode to HTML::Form
Add content_is_xml method
Make split_header_words() lower case returned tokens/keys
Add decode() method to HTTP::Message
Add encode() method to HTTP::Message
Allow multiple fields to be set with push_header().
Faster push_header()
Add dump method to HTTP::Message.
Add support for x-bzip2 encoding; fix bzip2 decoding.
Add send_header method to HTTP::Daemon
Make the lwp-request User-Agent string include the LWP version.
Calculation of current_age with missing Client-Date.
More correct matching of 'max-age' in freshness_lifetime method
The freshness_lifetime method now support options to control its heuristics
The Content-Length and Content-MD5 headers are no longer valid after encode/decode
Skip LWP test when fork() is unimplemented
A more modern user_agent example.
Make it possible to unset the proxy settings again
Deprecate LWP::Debug
* Mon Nov 17 2008 lnussel@suse.de
- fix https losing characters (bnc#445601,
http://rt.cpan.org/Public/Bug/Display.html?id=40187)