Bugzilla – Bug 2995
Allow AsynchHTTP / SimpleAsynchHTTP to get response headers as array
Last modified: 2009-09-08 09:17:32 UTC
The slim AsynchHTTP.pm module gets and returns HTTP response header values through a hash reference, keyed by header name. The SimpleAsynchHTTP.pm module propagates this behavior. This is a problem because an HTTP response header can contain multiple instances of the Set-Cookie header. Some applications (like the XMRadio plugin) need to get at each of the Set-Cookie headers to collect up multiple cookies, which is impossible with the hash. As a result, I have needed to build alternate implementations for these modules. I believe that this state of affairs may be the result of a long-standing error in the perl documentaiton for the base class Net::HTTP::NB -- the documentation asserts that the header return type is a hash, but in fact the base perl library code for this package is returning an array, which gets rolled into a hash as a run-time conversion. It would be great if AsynchHTTP/SimpleAsynchHTTP interrogated the ref type of their caller's header data value, and returned the headers as an array if called with an array, or a hash if called with a hash. This should be fully downward compatible with any code that is relying on a hash today.
Andy, is this appropriate for 6.3?
Probably, I didn't know about this request, but I will take a look at it.
If the headers were actually an HTTP::Headers object, would this work for you? It seems like the most logical thing to do here. It handles duplicate key names by using array references.
Fixed in trunk and 6.3 branch.
This bug fix is now part of a released version, and so has been marked closed. If you are still experiencing this problem, please reopen the bug.