Skip Menu |

This queue is for tickets about the Net-Async-HTTP CPAN distribution.

Report information
The Basics
Id: 98278
Status: resolved
Priority: 0/
Queue: Net-Async-HTTP

People
Owner: Nobody in particular
Requestors: TEAM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.35
Fixed in: 0.36



Subject: on_header callback return value
Doesn't appear to be documented at the moment, but it seems that on_header needs to return the initial header response when it's called for the last time. on_header => sub { my ($response) = @_; sub { return $response unless @_; ... } } Not sure whether this is intentional (allowing the header data to be changed, perhaps?) or just an oversight, but presumably it's missing docs rather than a bug. cheers, Tom
On Sat Aug 23 05:46:20 2014, TEAM wrote: Show quoted text
> Not sure whether this is intentional (allowing the header data to be > changed, perhaps?) or just an oversight, but presumably it's missing > docs rather than a bug.
It's intentional in that, for large streaming body requests, you don't necessarily want to be accumulating the body content. Whatever the on_body_chunk handler returns for the last time is used as the result of the overall Future. Docs now clarified. -- Paul Evans
Subject: rt98278.patch
=== modified file 'lib/Net/Async/HTTP.pm' --- lib/Net/Async/HTTP.pm 2014-10-14 10:50:34 +0000 +++ lib/Net/Async/HTTP.pm 2014-10-14 10:53:39 +0000 @@ -586,12 +586,13 @@ Alternative to C<on_response>. A callback that is invoked when the header of a response has been received. It is expected to return a C<CODE> reference for handling chunks of body content. This C<CODE> reference will be invoked with -no arguments once the end of the request has been reached. +no arguments once the end of the request has been reached, and whatever it +returns will be used as the result of the returned C<Future>, if there is one. $on_body_chunk = $on_header->( $header ) $on_body_chunk->( $data ) - $on_body_chunk->() + $response = $on_body_chunk->() =item on_error => CODE
Released -- Paul Evans