AnyEvent::HTTP; incorrect on_body callback call
Marc Lehmann
schmorp at schmorp.de
Sat Nov 26 04:45:34 CET 2016
Hi, assuming you two didn't just incidentally report this at the same
time, I hope you won't mind the group reply :)
On Wed, Nov 23, 2016 at 05:49:47PM +0300, Ruslan Zakirov <ruslan.zakirov at gmail.com> wrote:
> Hello,
>
> If ::HTTP instructed to follow redirects then on redirect 'on_header'
> callback is not called, but 'on_body' is. Can this become more consistent
> and/or documented? I would love to see on_body ignored in this situation as
> well.
On Wed, Nov 23, 2016 at 02:29:50PM +0300, Антон Онуфриев <anufant at gmail.com> wrote:
> I use perl module AnyEvent::HTTP, version 2.23.
> And got some strange behavior on redirects;
>
> I set on_body and on_header callbacks for my request;
> I try to get some url, which return location header and return not empty
> body the same time.
> As result, I got on_body call for body of first request, which goes before
> call of on_headers callback
>
> Is it a bug or is it a deliberate behavior?
A bug - it is clearly intended not to invoke those on internal redirects.
I am currently a bit busy, and only made a fix without testing it it in CVS.
I think only two cases were affected - on_body with chunked and with
non-chunked encoding, and both should now ignore on_body on redirects.
It would be great if you could test the CVS version, in which case I could
immediately release it:
http://software.schmorp.de/pkg/AnyEvent-HTTP.html
Thanks a lot for your report!
--
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
-=====/_/_//_/\_,_/ /_/\_\
More information about the anyevent
mailing list