File: lwp5827.patch

package info (click to toggle)
libhttp-response-encoding-perl 0.05-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 100 kB
  • ctags: 4
  • sloc: perl: 120; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,247 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Bugs-Debian: #536648
Bugs-CPAN: RT#47033
Patch-Origin: https://rt.cpan.org/Ticket/Attachment/620300/315414/lwp5827.patch
Description: adjust to libwww-perl >= 5.827
Reviewed-By: gregor herrmann <gregoa@debian.org>

--- a/Makefile.PL
+++ b/Makefile.PL
@@ -12,6 +12,7 @@
     PREREQ_PM => {
         'Encode'         => 2.00,
         'Test::More'     => 0,
+	'HTTP::Message'  => 5.827,
         'HTTP::Response' => 0,
       },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
--- a/lib/HTTP/Response/Encoding.pm
+++ b/lib/HTTP/Response/Encoding.pm
@@ -5,11 +5,7 @@
 
 sub HTTP::Response::charset {
     my $self = shift;
-    return $self->{__charset} if exists $self->{__charset};
-    my $content_type = $self->headers->header('Content-Type');
-    return unless $content_type;
-    $content_type =~ /charset=([A-Za-z0-9_\-]+)/io;
-    $self->{__charset} = $1 || undef;
+    return $self->content_charset;
 }
 
 sub HTTP::Response::encoder {
--- a/t/01-file.t
+++ b/t/01-file.t
@@ -55,4 +55,4 @@
 $uri->path(File::Spec->catfile($cwd, "t", "t-null.html"));
 my $res = $ua->get($uri);
 die unless $res->is_success;
-is $res->encoding, undef, "res->encoding eq undef";
+is $res->encoding, "ascii", "res->encoding is ascii";