Tests abort with "Could not parse chunk header" #19

Closed
moritz opened this Issue Sep 24, 2012 · 2 comments

Projects

None yet

3 participants

@moritz
Collaborator
moritz commented Sep 24, 2012

Several tests abort with

Could not parse chunk header
  in method parse_chunks at lib/LWP/Simple.pm:177
  in method make_request at lib/LWP/Simple.pm:215
  in method request_shell at lib/LWP/Simple.pm:63
  in method post at lib/LWP/Simple.pm:32
  in block  at t/custom-headers-and-content.t:10

on Rakudo 2012.09

@tadzik
Contributor
tadzik commented Dec 4, 2012

The reason for that is that parse_headers doesn't get the entire headers list, but only the first thing that came from read():

$ g diff | cat
diff --git a/lib/LWP/Simple.pm b/lib/LWP/Simple.pm
index 4e1963c..e0f9713 100644
--- a/lib/LWP/Simple.pm
+++ b/lib/LWP/Simple.pm
@@ -236,6 +236,8 @@ method make_request (

 method parse_response (Buf $resp) {

+    note "Parsing {$resp.decode}";
+
     my %header;

     my Int $header_end_pos = 0;

Result with the patch above:

$ perl6 -Ilib t/custom-headers-and-content.t
Parsing HTTP/1.1 500 Internal Server Error
Server: nginx
Date: Tue, 04 Dec 2012 17:30:47 GMT
Content-Type: text/html
Content-Length: 48247
Connection: close
Last-Modified: Tue, 21 Aug 2012 09:56:00 GMT
ETag: "10032ef3-bc77-4c7c3a2292c00"
Accept-Ranges: byt
could not parse headers
  in method parse_response at lib/LWP/Simple.pm:262
  in method make_request at lib/LWP/Simple.pm:200
  in method request_shell at lib/LWP/Simple.pm:64
  in method post at lib/LWP/Simple.pm:33
  in block  at t/custom-headers-and-content.t:10

Headers end with "byt" rather than CRLF, so parse_headers cries and dies.

@cosimo
Owner
cosimo commented Oct 22, 2015

Works with current master and perl6 2015.09

@cosimo cosimo closed this Oct 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment