File: fix_chunked_decoding_674788.diff

package info (click to toggle)
libnet-http-perl 6.03-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 152 kB
  • sloc: perl: 930; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 1,231 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
Description: Fix a problem with chunked decoding
 If the first read after a chunk header returns EAGAIN or EINTR, the
 chunked state stored in the client object doesn't get updated, so the
 next call to ->read_entity_body tries to read the chunk header again,
 and gives a "Missing newline after chunk data" error.
 .
 This fixes it by updating ${*$self}{'http_chunked'} immediately after
 the chunk header has been read, so that the state persist to the next
 call.
Origin: other, https://rt.cpan.org/Public/Bug/Display.html?id=74431#txn-1076013
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=74431
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674788
Forwarded: yes
From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Last-Update: 2012-06-02

---
 lib/Net/HTTP/Methods.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

--- a/lib/Net/HTTP/Methods.pm
+++ b/lib/Net/HTTP/Methods.pm
@@ -488,7 +488,7 @@
 	    unless ($chunk_len =~ /^([\da-fA-F]+)\s*$/) {
 		die "Bad chunk-size in HTTP response: $line";
 	    }
-	    $chunked = hex($1);
+	    ${*$self}{'http_chunked'} = $chunked = hex($1);
 	    if ($chunked == 0) {
 		${*$self}{'http_trailers'} = [$self->_read_header_lines];
 		$$buf_ref = "";