Hello community, here is the log from the commit of package perl-HTTP-Message for openSUSE:Factory checked in at 2013-08-13 10:17:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-HTTP-Message (Old) and /work/SRC/openSUSE:Factory/.perl-HTTP-Message.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-HTTP-Message" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-HTTP-Message/perl-HTTP-Message.changes 2013-04-17 07:57:15.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-HTTP-Message.new/perl-HTTP-Message.changes 2013-08-13 10:17:48.000000000 +0200 @@ -1,0 +2,48 @@ +Mon Aug 5 09:02:46 UTC 2013 - coolo@suse.com + +- updated to 6.06 + Gisle Aas (2): + More forgiving test on croak message [RT#80302] + Added test for multipart parsing + + Mark Overmeer (1): + Multipart end boundary doesn't need match a complete line [RT#79239] + + 2012-10-20 HTTP-Message 6.05 + + Gisle Aas (5): + Updated ignores + No need to prevent visiting field values starting with '_' + Report the correct croak caller for delegated methods + Disallow empty field names or field names containing ':' + Make the extra std_case entries local to each header + + 2012-09-30 HTTP-Message 6.04 + + Gisle Aas (5): + Updated repository URL + Avoid undef warning for empty content + Teach $m->content_charset about JSON + Use the canonical charset name for UTF-16LE (and frieds) + Add option to override the "(no content)" marker of $m->dump + + Christopher J. Madsen (2): + Use IO::HTML for <meta> encoding sniffing + mime_name was introduced in Encode 2.21 + + Tom Hukins (1): + Remove an unneeded "require" + + Ville Skyttä (1): + Spelling fixes. + + chromatic (1): + Sanitized PERL_HTTP_URI_CLASS environment variable. + + Martin H. Sluka (1): + Add test from RT#77466 + + Father Chrysostomos (1): + Fix doc grammo [RT#75831] + +------------------------------------------------------------------- Old: ---- HTTP-Message-6.02.tar.gz New: ---- HTTP-Message-6.06.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-HTTP-Message.spec ++++++ --- /var/tmp/diff_new_pack.hEYenw/_old 2013-08-13 10:17:49.000000000 +0200 +++ /var/tmp/diff_new_pack.hEYenw/_new 2013-08-13 10:17:49.000000000 +0200 @@ -17,39 +17,60 @@ Name: perl-HTTP-Message -Version: 6.02 +Version: 6.06 Release: 0 %define cpan_name HTTP-Message Summary: HTTP style message (base class) -License: GPL-1.0+ or Artistic-1.0 +License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/HTTP-Message/ -Source: http://www.cpan.org/authors/id/G/GA/GAAS/HTTP-Message-%{version}.tar.gz +Source: http://www.cpan.org/authors/id/G/GA/GAAS/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros +BuildRequires: perl(Compress::Raw::Zlib) +BuildRequires: perl(Encode) >= 2.21 BuildRequires: perl(Encode::Locale) >= 1 -BuildRequires: perl(HTML::Parser) >= 3.33 BuildRequires: perl(HTTP::Date) >= 6 +BuildRequires: perl(IO::Compress::Bzip2) >= 2.021 +BuildRequires: perl(IO::Compress::Deflate) +BuildRequires: perl(IO::Compress::Gzip) +BuildRequires: perl(IO::HTML) +BuildRequires: perl(IO::Uncompress::Bunzip2) >= 2.021 +BuildRequires: perl(IO::Uncompress::Gunzip) +BuildRequires: perl(IO::Uncompress::Inflate) +BuildRequires: perl(IO::Uncompress::RawInflate) BuildRequires: perl(LWP::MediaTypes) >= 6 BuildRequires: perl(URI) >= 1.10 +#BuildRequires: perl(HTTP::Config) +#BuildRequires: perl(HTTP::Headers) +#BuildRequires: perl(HTTP::Headers::Auth) +#BuildRequires: perl(HTTP::Headers::ETag) +#BuildRequires: perl(HTTP::Headers::Util) +#BuildRequires: perl(HTTP::Message) +#BuildRequires: perl(HTTP::Request) +#BuildRequires: perl(HTTP::Request::Common) +#BuildRequires: perl(HTTP::Response) +#BuildRequires: perl(HTTP::Status) +Requires: perl(Compress::Raw::Zlib) +Requires: perl(Encode) >= 2.21 Requires: perl(Encode::Locale) >= 1 -Requires: perl(HTML::Parser) >= 3.33 Requires: perl(HTTP::Date) >= 6 +Requires: perl(IO::Compress::Bzip2) >= 2.021 +Requires: perl(IO::Compress::Deflate) +Requires: perl(IO::Compress::Gzip) +Requires: perl(IO::HTML) +Requires: perl(IO::Uncompress::Bunzip2) >= 2.021 +Requires: perl(IO::Uncompress::Gunzip) +Requires: perl(IO::Uncompress::Inflate) +Requires: perl(IO::Uncompress::RawInflate) Requires: perl(LWP::MediaTypes) >= 6 Requires: perl(URI) >= 1.10 %{perl_requires} %description -An 'HTTP::Message' object contains some headers and a content body. The -following methods are available: - -* $mess = HTTP::Message->new - -* $mess = HTTP::Message->new( $headers ) - -* $mess = HTTP::Message->new( $headers, $content ) +An 'HTTP::Message' object contains some headers and a content body. %prep %setup -q -n %{cpan_name}-%{version} @@ -66,11 +87,8 @@ %perl_process_packlist %perl_gen_filelist -%clean -%{__rm} -rf %{buildroot} - %files -f %{name}.files -%defattr(644,root,root,755) +%defattr(-,root,root,755) %doc Changes README %changelog ++++++ HTTP-Message-6.02.tar.gz -> HTTP-Message-6.06.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/Changes new/HTTP-Message-6.06/Changes --- old/HTTP-Message-6.02/Changes 2011-03-20 12:50:33.000000000 +0100 +++ new/HTTP-Message-6.06/Changes 2012-10-21 00:06:27.000000000 +0200 @@ -1,4 +1,73 @@ _______________________________________________________________________________ +2012-10-21 HTTP-Message 6.06 + +Gisle Aas (2): + More forgiving test on croak message [RT#80302] + Added test for multipart parsing + +Mark Overmeer (1): + Multipart end boundary doesn't need match a complete line [RT#79239] + + + +_______________________________________________________________________________ +2012-10-20 HTTP-Message 6.05 + +Gisle Aas (5): + Updated ignores + No need to prevent visiting field values starting with '_' + Report the correct croak caller for delegated methods + Disallow empty field names or field names containing ':' + Make the extra std_case entries local to each header + + + +_______________________________________________________________________________ +2012-09-30 HTTP-Message 6.04 + +Gisle Aas (5): + Updated repository URL + Avoid undef warning for empty content + Teach $m->content_charset about JSON + Use the canonical charset name for UTF-16LE (and frieds) + Add option to override the "(no content)" marker of $m->dump + +Christopher J. Madsen (2): + Use IO::HTML for <meta> encoding sniffing + mime_name was introduced in Encode 2.21 + +Tom Hukins (1): + Remove an unneeded "require" + +Ville Skyttä (1): + Spelling fixes. + +chromatic (1): + Sanitized PERL_HTTP_URI_CLASS environment variable. + +Martin H. Sluka (1): + Add test from RT#77466 + +Father Chrysostomos (1): + Fix doc grammo [RT#75831] + + + +_______________________________________________________________________________ +2012-02-16 HTTP-Message 6.03 + +Support 'bzip2' as alternative to Content-Encoding: x-bzip2. Some +servers seem to return it. + +Make newlines in forms be "\r\n" terminated. + +Added some more status codes. + +Restore perl-5.8.1 compatibility. + + + +_______________________________________________________________________________ 2011-03-20 HTTP-Message 6.02 Declare dependency on Bunzip2 v2.021 [RT#66593] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/META.yml new/HTTP-Message-6.06/META.yml --- old/HTTP-Message-6.02/META.yml 2011-03-20 13:10:22.000000000 +0100 +++ new/HTTP-Message-6.06/META.yml 2012-10-21 00:06:58.000000000 +0200 @@ -1,6 +1,6 @@ --- #YAML:1.0 name: HTTP-Message -version: 6.02 +version: 6.06 abstract: HTTP style messages author: - Gisle Aas <gisle@activestate.com> @@ -12,13 +12,13 @@ ExtUtils::MakeMaker: 0 requires: Compress::Raw::Zlib: 0 - Encode: 2.12 + Encode: 2.21 Encode::Locale: 1 - HTML::Parser: 3.33 HTTP::Date: 6 IO::Compress::Bzip2: 2.021 IO::Compress::Deflate: 0 IO::Compress::Gzip: 0 + IO::HTML: 0 IO::Uncompress::Bunzip2: 2.021 IO::Uncompress::Gunzip: 0 IO::Uncompress::Inflate: 0 @@ -26,16 +26,16 @@ LWP::MediaTypes: 6 MIME::Base64: 2.1 MIME::QuotedPrint: 0 - perl: 5.008008 + perl: 5.008001 URI: 1.10 resources: MailingList: mailto:libwww@perl.org - repository: http://github.com/gisle/libwww-perl/tree/HTTP-Message/master + repository: http://github.com/libwww-perl/http-message no_index: directory: - t - inc -generated_by: ExtUtils::MakeMaker version 6.56 +generated_by: ExtUtils::MakeMaker version 6.57_05 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/Makefile.PL new/HTTP-Message-6.06/Makefile.PL --- old/HTTP-Message-6.02/Makefile.PL 2011-03-20 12:30:47.000000000 +0100 +++ new/HTTP-Message-6.06/Makefile.PL 2012-05-27 13:38:08.000000000 +0200 @@ -1,6 +1,6 @@ #!perl -w -require 5.008008; +require 5.008001; use strict; use ExtUtils::MakeMaker; @@ -11,14 +11,14 @@ ABSTRACT => 'HTTP style messages', AUTHOR => 'Gisle Aas <gisle@activestate.com>', LICENSE => "perl", - MIN_PERL_VERSION => 5.008008, + MIN_PERL_VERSION => 5.008001, PREREQ_PM => { 'URI' => "1.10", 'HTTP::Date' => 6, 'MIME::Base64' => "2.1", 'MIME::QuotedPrint' => 0, - 'HTML::Parser' => "3.33", - 'Encode' => "2.12", + 'IO::HTML' => 0, + 'Encode' => "2.21", # need mime_name 'Encode::Locale' => 1, 'LWP::MediaTypes' => 6, 'Compress::Raw::Zlib' => 0, @@ -32,7 +32,7 @@ }, META_MERGE => { resources => { - repository => 'http://github.com/gisle/libwww-perl/tree/HTTP-Message/master', + repository => 'http://github.com/libwww-perl/http-message', MailingList => 'mailto:libwww@perl.org', } }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/lib/HTTP/Headers/Util.pm new/HTTP-Message-6.06/lib/HTTP/Headers/Util.pm --- old/HTTP-Message-6.02/lib/HTTP/Headers/Util.pm 2011-03-07 19:02:10.000000000 +0100 +++ new/HTTP-Message-6.06/lib/HTTP/Headers/Util.pm 2012-02-16 23:14:03.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use vars qw($VERSION @ISA @EXPORT_OK); -$VERSION = "6.00"; +$VERSION = "6.03"; require Exporter; @ISA=qw(Exporter); @@ -153,7 +153,7 @@ Each I<header> is represented by an anonymous array of key/value pairs. The keys will be all be forced to lower case. The value for a simple token (not part of a parameter) is C<undef>. -Syntactically incorrect headers will not necessary be parsed as you +Syntactically incorrect headers will not necessarily be parsed as you would want. This is easier to describe with some examples: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/lib/HTTP/Headers.pm new/HTTP-Message-6.06/lib/HTTP/Headers.pm --- old/HTTP-Message-6.02/lib/HTTP/Headers.pm 2011-03-07 19:02:10.000000000 +0100 +++ new/HTTP-Message-6.06/lib/HTTP/Headers.pm 2012-10-20 11:11:21.000000000 +0200 @@ -4,7 +4,7 @@ use Carp (); use vars qw($VERSION $TRANSLATE_UNDERSCORE); -$VERSION = "6.00"; +$VERSION = "6.05"; # The $TRANSLATE_UNDERSCORE variable controls whether '_' can be used # as a replacement for '-' in header field names. @@ -138,6 +138,9 @@ for my $f (grep $entity_header{$_} || /^content-/, keys %$self) { $c->{$f} = delete $self->{$f}; } + if (exists $self->{'::std_case'}) { + $c->{'::std_case'} = $self->{'::std_case'}; + } $c; } @@ -146,14 +149,17 @@ { my($self, $field, $val, $op) = @_; + Carp::croak("Illegal field name '$field'") + if rindex($field, ':') > 1 || !length($field); + unless ($field =~ /^:/) { $field =~ tr/_/-/ if $TRANSLATE_UNDERSCORE; my $old = $field; $field = lc $field; - unless(defined $standard_case{$field}) { - # generate a %standard_case entry for this field + unless($standard_case{$field} || $self->{'::std_case'}{$field}) { + # generate a %std_case entry for this field $old =~ s/\b(\w)/\u$1/g; - $standard_case{$field} = $old; + $self->{'::std_case'}{$field} = $old; } } @@ -202,15 +208,15 @@ return [ sort { ($header_order{$a} || 999) <=> ($header_order{$b} || 999) || $a cmp $b - } keys %$self ]; + } grep !/^::/, keys %$self ]; } sub header_field_names { my $self = shift; - return map $standard_case{$_} || $_, @{ $self->_sorted_field_names }, + return map $standard_case{$_} || $self->{'::std_case'}{$_} || $_, @{ $self->_sorted_field_names }, if wantarray; - return keys %$self; + return grep !/^::/, keys %$self; } @@ -219,16 +225,15 @@ my($self, $sub) = @_; my $key; for $key (@{ $self->_sorted_field_names }) { - next if substr($key, 0, 1) eq '_'; my $vals = $self->{$key}; if (ref($vals) eq 'ARRAY') { my $val; for $val (@$vals) { - $sub->($standard_case{$key} || $key, $val); + $sub->($standard_case{$key} || $self->{'::std_case'}{$key} || $key, $val); } } else { - $sub->($standard_case{$key} || $key, $vals); + $sub->($standard_case{$key} || $self->{'::std_case'}{$key} || $key, $vals); } } } @@ -245,7 +250,7 @@ my $vals = $self->{$key}; if ( ref($vals) eq 'ARRAY' ) { for my $val (@$vals) { - my $field = $standard_case{$key} || $key; + my $field = $standard_case{$key} || $self->{'::std_case'}{$key} || $key; $field =~ s/^://; if ( index($val, "\n") >= 0 ) { $val = _process_newline($val, $endl); @@ -254,7 +259,7 @@ } } else { - my $field = $standard_case{$key} || $key; + my $field = $standard_case{$key} || $self->{'::std_case'}{$key} || $key; $field =~ s/^://; if ( index($vals, "\n") >= 0 ) { $vals = _process_newline($vals, $endl); @@ -272,7 +277,7 @@ # must handle header values with embedded newlines with care s/\s+$//; # trailing newlines and space must go s/\n(\x0d?\n)+/\n/g; # no empty lines - s/\n([^\040\t])/\n $1/g; # intial space for continuation + s/\n([^\040\t])/\n $1/g; # initial space for continuation s/\n/$endl/g; # substitute with requested line ending $_; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/lib/HTTP/Message.pm new/HTTP-Message-6.06/lib/HTTP/Message.pm --- old/HTTP-Message-6.02/lib/HTTP/Message.pm 2011-03-20 12:49:32.000000000 +0100 +++ new/HTTP-Message-6.06/lib/HTTP/Message.pm 2012-10-21 00:05:34.000000000 +0200 @@ -2,13 +2,20 @@ use strict; use vars qw($VERSION $AUTOLOAD); -$VERSION = "6.02"; +$VERSION = "6.06"; require HTTP::Headers; require Carp; my $CRLF = "\015\012"; # "\r\n" is not portable -$HTTP::URI_CLASS ||= $ENV{PERL_HTTP_URI_CLASS} || "URI"; +unless ($HTTP::URI_CLASS) { + if ($ENV{PERL_HTTP_URI_CLASS} + && $ENV{PERL_HTTP_URI_CLASS} =~ /^([\w:]+)$/) { + $HTTP::URI_CLASS = $1; + } else { + $HTTP::URI_CLASS = "URI"; + } +} eval "require $HTTP::URI_CLASS"; die $@ if $@; *_utf8_downgrade = defined(&utf8::downgrade) ? @@ -207,10 +214,10 @@ # Unicode BOM for ($$cref) { return "UTF-8" if /^\xEF\xBB\xBF/; - return "UTF-32-LE" if /^\xFF\xFE\x00\x00/; - return "UTF-32-BE" if /^\x00\x00\xFE\xFF/; - return "UTF-16-LE" if /^\xFF\xFE/; - return "UTF-16-BE" if /^\xFE\xFF/; + return "UTF-32LE" if /^\xFF\xFE\x00\x00/; + return "UTF-32BE" if /^\x00\x00\xFE\xFF/; + return "UTF-16LE" if /^\xFF\xFE/; + return "UTF-16BE" if /^\xFE\xFF/; } if ($self->content_is_xml) { @@ -219,10 +226,10 @@ # in UTF-8 or UTF-16 encoding must begin with an XML encoding declaration, # in which the first characters must be '<?xml' for ($$cref) { - return "UTF-32-BE" if /^\x00\x00\x00</; - return "UTF-32-LE" if /^<\x00\x00\x00/; - return "UTF-16-BE" if /^(?:\x00\s)*\x00</; - return "UTF-16-LE" if /^(?:\s\x00)*<\x00/; + return "UTF-32BE" if /^\x00\x00\x00</; + return "UTF-32LE" if /^<\x00\x00\x00/; + return "UTF-16BE" if /^(?:\x00\s)*\x00</; + return "UTF-16LE" if /^(?:\s\x00)*<\x00/; if (/^\s*(<\?xml[^\x00]*?\?>)/) { if ($1 =~ /\sencoding\s*=\s*(["'])(.*?)\1/) { my $enc = $2; @@ -236,34 +243,21 @@ elsif ($self->content_is_html) { # look for <META charset="..."> or <META content="..."> # http://dev.w3.org/html5/spec/Overview.html#determining-the-character-encodin... - my $charset; - require HTML::Parser; - my $p = HTML::Parser->new( - start_h => [sub { - my($tag, $attr, $self) = @_; - $charset = $attr->{charset}; - unless ($charset) { - # look at $attr->{content} ... - if (my $c = $attr->{content}) { - require HTTP::Headers::Util; - my @v = HTTP::Headers::Util::split_header_words($c); - return unless @v; - my($ct, undef, %ct_param) = @{$v[0]}; - $charset = $ct_param{charset}; - } - return unless $charset; - } - if ($charset =~ /^utf-?16/i) { - # converted document, assume UTF-8 - $charset = "UTF-8"; - } - $self->eof; - }, "tagname, attr, self"], - report_tags => [qw(meta)], - utf8_mode => 1, - ); - $p->parse($$cref); - return $charset if $charset; + require IO::HTML; + # Use relaxed search to match previous versions of HTTP::Message: + my $encoding = IO::HTML::find_charset_in($$cref, { encoding => 1, + need_pragma => 0 }); + return $encoding->mime_name if $encoding; + } + elsif ($self->content_type eq "application/json") { + for ($$cref) { + # RFC 4627, ch 3 + return "UTF-32BE" if /^\x00\x00\x00./s; + return "UTF-32LE" if /^.\x00\x00\x00/s; + return "UTF-16BE" if /^\x00.\x00./s; + return "UTF-16LE" if /^.\x00.\x00/s; + return "UTF-8"; + } } if ($self->content_type =~ /^text\//) { for ($$cref) { @@ -307,7 +301,7 @@ $content_ref = \$output; $content_ref_iscopy++; } - elsif ($ce eq "x-bzip2") { + elsif ($ce eq "x-bzip2" or $ce eq "bzip2") { require IO::Uncompress::Bunzip2; my $output; IO::Uncompress::Bunzip2::bunzip2($content_ref, \$output, Transparent => 0) @@ -557,13 +551,14 @@ $content =~ s/(\n+)\n/("\\n" x length($1)) . "\n"/eg; $content =~ s/\n\z/\\n/; - my $no_content = "(no content)"; + my $no_content = $opt{no_content}; + $no_content = "(no content)" unless defined $no_content; if ($content eq $no_content) { # escape our $no_content marker $content =~ s/^(.)/sprintf('\\x%02X',ord($1))/eg; } elsif ($content eq "") { - $content = "(no content)"; + $content = $no_content; } } @@ -646,7 +641,7 @@ # We create the function here so that it will not need to be # autoloaded the next time. no strict 'refs'; - *$method = sub { shift->headers->$method(@_) }; + *$method = sub { local $Carp::Internal{+__PACKAGE__} = 1; shift->headers->$method(@_) }; goto &$method; } @@ -676,7 +671,7 @@ my %h = @{$h[0]}; if (defined(my $b = $h{boundary})) { my $str = $self->content; - $str =~ s/\r?\n--\Q$b\E--\r?\n.*//s; + $str =~ s/\r?\n--\Q$b\E--.*//s; if ($str =~ s/(^|.*?\r?\n)--\Q$b\E\r?\n//s) { $self->{_parts} = [map HTTP::Message->parse($_), split(/\r?\n--\Q$b\E\r?\n/, $str)] @@ -981,7 +976,7 @@ If the content type is C<message/http>, then the return value will be either an C<HTTP::Request> or an C<HTTP::Response> object. -If an @parts argument is given, then the content of the message will be +If a @parts argument is given, then the content of the message will be modified. The array reference form is provided so that an empty list can be provided. The @parts array should contain C<HTTP::Message> objects. The @parts objects are owned by $mess after this call and @@ -1057,6 +1052,10 @@ If the content is longer then the string is chopped at the limit and the string "...\n(### more bytes not shown)" appended. +=item no_content => $str + +Replaces the "(no content)" marker. + =item prefix => $str A string that will be prefixed to each line of the dump. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/lib/HTTP/Request/Common.pm new/HTTP-Message-6.06/lib/HTTP/Request/Common.pm --- old/HTTP-Message-6.02/lib/HTTP/Request/Common.pm 2011-03-07 19:02:10.000000000 +0100 +++ new/HTTP-Message-6.06/lib/HTTP/Request/Common.pm 2012-09-30 23:17:21.000000000 +0200 @@ -13,7 +13,7 @@ require HTTP::Request; use Carp(); -$VERSION = "6.00"; +$VERSION = "6.04"; my $CRLF = "\015\012"; # "\r\n" is not portable @@ -81,6 +81,9 @@ my $url = URI->new('http:'); $url->query_form(ref($content) eq "HASH" ? %$content : @$content); $content = $url->query; + + # HTML/4.01 says that line breaks are represented as "CR LF" pairs (i.e., `%0D%0A') + $content =~ s/(?<!%0D)%0A/%0D%0A/g if defined($content); } } @@ -389,7 +392,7 @@ The $form_ref argument can be used to pass key/value pairs for the form content. By default we will initialize a request using the C<application/x-www-form-urlencoded> content type. This means that -you can emulate a HTML E<lt>form> POSTing like this: +you can emulate an HTML E<lt>form> POSTing like this: POST 'http://www.perl.org/survey.cgi', [ name => 'Gisle Aas', @@ -399,7 +402,7 @@ perc => '3%', ]; -This will create a HTTP::Request object that looks like this: +This will create an HTTP::Request object that looks like this: POST http://www.perl.org/survey.cgi Content-Length: 66 @@ -445,7 +448,7 @@ init => ["$ENV{HOME}/.profile"], ] -This will create a HTTP::Request object that almost looks this (the +This will create an HTTP::Request object that almost looks this (the boundary and the content of your F<~/.profile> is likely to be different): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/lib/HTTP/Response.pm new/HTTP-Message-6.06/lib/HTTP/Response.pm --- old/HTTP-Message-6.02/lib/HTTP/Response.pm 2011-03-07 19:02:10.000000000 +0100 +++ new/HTTP-Message-6.06/lib/HTTP/Response.pm 2012-09-30 23:17:39.000000000 +0200 @@ -2,7 +2,7 @@ require HTTP::Message; @ISA = qw(HTTP::Message); -$VERSION = "6.01"; +$VERSION = "6.04"; use strict; use HTTP::Status (); @@ -181,7 +181,6 @@ sub as_string { - require HTTP::Status; my $self = shift; my($eol) = @_; $eol = "\n" unless defined $eol; @@ -380,7 +379,7 @@ response code $code and optional message $msg. The optional $header argument should be a reference to an C<HTTP::Headers> object or a plain array reference of key/value pairs. The optional $content -argument should be a string of bytes. The meaning these arguments are +argument should be a string of bytes. The meanings of these arguments are described below. =item $r = HTTP::Response->parse( $str ) @@ -392,7 +391,7 @@ =item $r->code( $code ) This is used to get/set the code attribute. The code is a 3 digit -number that encode the overall outcome of a HTTP response. The +number that encode the overall outcome of an HTTP response. The C<HTTP::Status> module provide constants that provide mnemonic names for the code attribute. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/lib/HTTP/Status.pm new/HTTP-Message-6.06/lib/HTTP/Status.pm --- old/HTTP-Message-6.02/lib/HTTP/Status.pm 2011-03-07 19:02:10.000000000 +0100 +++ new/HTTP-Message-6.06/lib/HTTP/Status.pm 2012-02-16 23:14:03.000000000 +0100 @@ -9,7 +9,7 @@ @ISA = qw(Exporter); @EXPORT = qw(is_info is_success is_redirect is_error status_message); @EXPORT_OK = qw(is_client_error is_server_error); -$VERSION = "6.00"; +$VERSION = "6.03"; # Note also addition of mnemonics to @EXPORT below @@ -28,6 +28,7 @@ 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-Status', # RFC 2518 (WebDAV) + 208 => 'Already Reported', # RFC 5842 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', @@ -53,11 +54,15 @@ 415 => 'Unsupported Media Type', 416 => 'Request Range Not Satisfiable', 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', # RFC 2324 422 => 'Unprocessable Entity', # RFC 2518 (WebDAV) 423 => 'Locked', # RFC 2518 (WebDAV) 424 => 'Failed Dependency', # RFC 2518 (WebDAV) 425 => 'No code', # WebDAV Advanced Collections 426 => 'Upgrade Required', # RFC 2817 + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', 449 => 'Retry with', # unofficial Microsoft 500 => 'Internal Server Error', 501 => 'Not Implemented', @@ -69,12 +74,14 @@ 507 => 'Insufficient Storage', # RFC 2518 (WebDAV) 509 => 'Bandwidth Limit Exceeded', # unofficial 510 => 'Not Extended', # RFC 2774 + 511 => 'Network Authentication Required', ); my $mnemonicCode = ''; my ($code, $message); while (($code, $message) = each %StatusCode) { # create mnemonic subroutines + $message =~ s/I'm/I am/; $message =~ tr/a-z \-/A-Z__/; $mnemonicCode .= "sub HTTP_$message () { $code }\n"; $mnemonicCode .= "*RC_$message = \\&HTTP_$message;\n"; # legacy @@ -128,7 +135,7 @@ I<HTTP::Status> is a library of routines for defining and classifying HTTP status codes for libwww-perl. Status codes are -used to encode the overall outcome of a HTTP response message. Codes +used to encode the overall outcome of an HTTP response message. Codes correspond to those defined in RFC 2616 and RFC 2518. =head1 CONSTANTS @@ -149,6 +156,7 @@ HTTP_RESET_CONTENT (205) HTTP_PARTIAL_CONTENT (206) HTTP_MULTI_STATUS (207) + HTTP_ALREADY_REPORTED (208) HTTP_MULTIPLE_CHOICES (300) HTTP_MOVED_PERMANENTLY (301) @@ -176,11 +184,15 @@ HTTP_UNSUPPORTED_MEDIA_TYPE (415) HTTP_REQUEST_RANGE_NOT_SATISFIABLE (416) HTTP_EXPECTATION_FAILED (417) + HTTP_I_AM_A_TEAPOT (418) HTTP_UNPROCESSABLE_ENTITY (422) HTTP_LOCKED (423) HTTP_FAILED_DEPENDENCY (424) HTTP_NO_CODE (425) HTTP_UPGRADE_REQUIRED (426) + HTTP_PRECONDITION_REQUIRED (428) + HTTP_TOO_MANY_REQUESTS (429) + HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE (431) HTTP_RETRY_WITH (449) HTTP_INTERNAL_SERVER_ERROR (500) @@ -193,6 +205,7 @@ HTTP_INSUFFICIENT_STORAGE (507) HTTP_BANDWIDTH_LIMIT_EXCEEDED (509) HTTP_NOT_EXTENDED (510) + HTTP_NETWORK_AUTHENTICATION_REQUIRED (511) =head1 FUNCTIONS @@ -227,11 +240,11 @@ =item is_error( $code ) Return TRUE if C<$code> is an I<Error> status code (4xx or 5xx). The function -return TRUE for both client error or a server error status codes. +returns TRUE for both client and server error status codes. =item is_client_error( $code ) -Return TRUE if C<$code> is an I<Client Error> status code (4xx). This class +Return TRUE if C<$code> is a I<Client Error> status code (4xx). This class of status code is intended for cases in which the client seems to have erred. @@ -239,7 +252,7 @@ =item is_server_error( $code ) -Return TRUE if C<$code> is an I<Server Error> status code (5xx). This class +Return TRUE if C<$code> is a I<Server Error> status code (5xx). This class of status codes is intended for cases in which the server is aware that it has erred or is incapable of performing the request. @@ -250,5 +263,5 @@ =head1 BUGS For legacy reasons all the C<HTTP_> constants are exported by default -with the prefix C<RC_>. It's recommended to use explict imports and +with the prefix C<RC_>. It's recommended to use explicit imports and the C<:constants> tag instead of relying on this. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/t/common-req.t new/HTTP-Message-6.06/t/common-req.t --- old/HTTP-Message-6.02/t/common-req.t 2011-03-07 19:02:10.000000000 +0100 +++ new/HTTP-Message-6.06/t/common-req.t 2012-05-27 12:47:31.000000000 +0200 @@ -1,7 +1,7 @@ #perl -w use Test; -plan tests => 52; +plan tests => 57; use HTTP::Request::Common; @@ -41,15 +41,24 @@ baz => [qw(a b c)], foo => 'zoo=&', "space " => " + ", + "nl" => "a\nb\r\nc\n", ], bar => 'foo'; print $r->as_string, "\n"; ok($r->method, "POST"); ok($r->content_type, "application/x-www-form-urlencoded"); -ok($r->content_length, 58); +ok($r->content_length, 83); ok($r->header("bar"), "foo"); -ok($r->content, "foo=bar%3Bbaz&baz=a&baz=b&baz=c&foo=zoo%3D%26&space+=+%2B+"); +ok($r->content, "foo=bar%3Bbaz&baz=a&baz=b&baz=c&foo=zoo%3D%26&space+=+%2B+&nl=a%0D%0Ab%0D%0Ac%0D%0A"); + +$r = POST "http://example.com"; +ok($r->content_length, 0); +ok($r->content, ""); + +$r = POST "http://example.com", []; +ok($r->content_length, 0); +ok($r->content, ""); $r = POST "mailto:gisle\@aas.no", Subject => "Heisan", @@ -62,6 +71,13 @@ ok($r->content, "Howdy\n"); ok($r->content_type, "text/plain"); +{ + my @warnings; + local $SIG{__WARN__} = sub { push @warnings, @_ }; + $r = POST 'http://unf.ug/', []; + ok( "@warnings", '', 'empty POST' ); +} + # # POST for File upload # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/t/headers.t new/HTTP-Message-6.06/t/headers.t --- old/HTTP-Message-6.02/t/headers.t 2011-03-07 19:02:11.000000000 +0100 +++ new/HTTP-Message-6.06/t/headers.t 2012-10-20 23:26:35.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use Test qw(plan ok); -plan tests => 164; +plan tests => 166; my($h, $h2); sub j { join("|", @_) } @@ -287,6 +287,19 @@ WWW-Authenticate: bar EOT +# Try some bad field names +my $file = __FILE__; +my $line; +$h = HTTP::Headers->new; +eval { + $line = __LINE__; $h->header('foo:', 1); +}; +ok($@, qr/^Illegal field name 'foo:' at \Q$file\E line $line/); +eval { + $line = __LINE__; $h->header('', 2); +}; +ok($@, qr/^Illegal field name '' at \Q$file\E line $line/); + #---- old tests below ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/t/message-charset.t new/HTTP-Message-6.06/t/message-charset.t --- old/HTTP-Message-6.02/t/message-charset.t 2011-03-07 19:02:11.000000000 +0100 +++ new/HTTP-Message-6.06/t/message-charset.t 2012-04-21 08:24:04.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use Test; -plan tests => 38; +plan tests => 43; use HTTP::Response; my $r = HTTP::Response->new(200, "OK"); @@ -54,7 +54,7 @@ ok($r->content_charset, "UTF-8"); require Encode; -for my $enc ("UTF-16-BE", "UTF-16-LE", "UTF-32-BE", "UTF-32-LE") { +for my $enc ("UTF-16BE", "UTF-16LE", "UTF-32BE", "UTF-32LE") { $r->content(Encode::encode($enc, "<foo>..</foo>")); ok($r->content_charset, $enc); } @@ -80,6 +80,12 @@ EOT ok($r->content_charset, "US-ASCII"); +$r->content_type("application/json"); +for my $enc ("UTF-8", "UTF-16BE", "UTF-16LE", "UTF-32BE", "UTF-32LE") { + $r->content(Encode::encode($enc, "{}")); + ok($r->content_charset, $enc); +} + { sub TIESCALAR{bless[]} tie $_, ""; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/t/message-parts.t new/HTTP-Message-6.06/t/message-parts.t --- old/HTTP-Message-6.02/t/message-parts.t 2011-03-07 19:02:11.000000000 +0100 +++ new/HTTP-Message-6.06/t/message-parts.t 2012-10-20 23:54:38.000000000 +0200 @@ -2,7 +2,7 @@ use strict; use Test qw(plan ok); -plan tests => 39; +plan tests => 47; use HTTP::Message; use HTTP::Request::Common qw(POST); @@ -97,7 +97,7 @@ ok($m->as_string, "Content-Type: message/http\n\nGET http://www.example.com\r\n\r\n"); $m = HTTP::Request->new("PUT", "http://www.example.com"); -$m->parts(HTTP::Message->new([Foo => 1], "abc\n")); +$m->parts(HTTP::Message->new([Foo => 1], "abc\n"), HTTP::Message->new([Bar => 2], "def")); ok($m->as_string, <<EOT); PUT http://www.example.com Content-Type: multipart/mixed; boundary=xYzZY @@ -107,7 +107,43 @@ \r abc \r +--xYzZY\r +Bar: 2\r +\r +def\r --xYzZY--\r EOT +$m->content(<<EOT); +--xYzZY +Content-Length: 4 + +abcd +--xYzZY-- +EOT + +@parts = $m->parts; +ok(@parts, 1); +ok($parts[0]->content_length, 4); +ok($parts[0]->content, "abcd"); + +$m->content(" + +--xYzZY +Content-Length: 4 + +efgh +--xYzZY +Content-Length: 3 + +ijk +--xYzZY--"); + +@parts = $m->parts; +ok(@parts, 2); +ok($parts[0]->content_length, 4); +ok($parts[0]->content, "efgh"); +ok($parts[1]->content_length, 3); +ok($parts[1]->content, "ijk"); + sub j { join(":", @_) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/t/message.t new/HTTP-Message-6.06/t/message.t --- old/HTTP-Message-6.02/t/message.t 2011-03-07 19:02:11.000000000 +0100 +++ new/HTTP-Message-6.06/t/message.t 2012-10-20 10:54:44.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use Test qw(plan ok skip); -plan tests => 125; +plan tests => 129; require HTTP::Message; use Config qw(%Config); @@ -27,6 +27,11 @@ ok($m->as_string, "Foo: 1\n\n"); ok($m2->as_string, "Bar: 2\nFoo: 1\n\n"); ok($m2->dump, "Bar: 2\nFoo: 1\n\n(no content)\n"); +ok($m2->dump(no_content => ""), "Bar: 2\nFoo: 1\n\n\n"); +ok($m2->dump(no_content => "-"), "Bar: 2\nFoo: 1\n\n-\n"); +$m2->content('0'); +ok($m2->dump(no_content => "-"), "Bar: 2\nFoo: 1\n\n0\n"); +ok($m2->dump(no_content => "0"), "Bar: 2\nFoo: 1\n\n\\x30\n"); $m2 = HTTP::Message->new($m->headers, "foo"); ok($m2->as_string, "Foo: 1\n\nfoo\n"); @@ -68,7 +73,7 @@ Bar: 1 Baz: 1 -Foo: 1 +FOO: 1 2 3 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/HTTP-Message-6.02/t/status.t new/HTTP-Message-6.06/t/status.t --- old/HTTP-Message-6.02/t/status.t 2011-03-07 19:02:11.000000000 +0100 +++ new/HTTP-Message-6.06/t/status.t 2012-02-16 23:14:03.000000000 +0100 @@ -1,7 +1,7 @@ #!perl -w use Test; -plan tests => 8; +plan tests => 9; use HTTP::Status qw(:constants :is status_message); @@ -10,6 +10,7 @@ ok(is_info(HTTP_CONTINUE)); ok(is_success(HTTP_ACCEPTED)); ok(is_error(HTTP_BAD_REQUEST)); +ok(is_client_error(HTTP_I_AM_A_TEAPOT)); ok(is_redirect(HTTP_MOVED_PERMANENTLY)); ok(!is_success(HTTP_NOT_FOUND)); -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org