Permalink
Browse files

clean up Capture/item confusion

  • Loading branch information...
1 parent 29d25c3 commit 0e1a7a575eddc5d3f7ca0f810aab3020e7e46dc4 @moritz moritz committed Mar 30, 2012
Showing with 4 additions and 6 deletions.
  1. +2 −2 lib/LWP/Simple.pm
  2. +2 −4 t/chunked-transfers.t
View
@@ -111,7 +111,7 @@ method decode_chunked (@content) {
# Chunk length is hex and could contain
# chunk-extensions (RFC2616, 3.6.1). Ex.: '5f32; xxx=...'
if $length ~~ m/^ \w+ / {
- $length = :16(~$length);
+ $length = :16(~$/);
} else {
last;
}
@@ -179,7 +179,7 @@ method parse_response (Str $resp) {
@content = self.decode_chunked(@content);
}
- return $status_line, \%header, \@content;
+ return $status_line, %header.item, @content.item;
}
method getprint (Str $url) {
View
@@ -22,8 +22,7 @@ since there is no "Transfer-Encoding: chunked" header
my ($status, $headers, $content) = $lwp.parse_response($testcase-no-chunked);
is($status, q<HTTP/1.1 200 OK>, 'Status parsed correctly');
-# Only way to dereference I have found
-my %headers = $headers;
+my %headers = $headers.hash;
is(%headers<Server>, 'random/3.14', 'Server header parsed correctly');
is(%headers<Content-type>, 'text/plain', 'Content-type header parsed correctly');
ok(! %headers.exists('Transfer-Encoding'), 'Transfer-Encoding header not found');
@@ -57,8 +56,7 @@ another 15 here
($status, $headers, $content) = $lwp.parse_response($testcase-chunked);
is($status, q<HTTP/1.0 200 OK>, 'Status parsed correctly');
-# Only way to dereference I have found
-%headers = $headers;
+%headers = $headers.hash;
is(%headers<Server>, 'Apache/2.2.9', 'Server header parsed correctly');
is(%headers<Content-type>, 'text/plain', 'Content-type header parsed correctly');

0 comments on commit 0e1a7a5

Please sign in to comment.