Bug 2995 - Allow AsynchHTTP / SimpleAsynchHTTP to get response headers as array
: Allow AsynchHTTP / SimpleAsynchHTTP to get response headers as array
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Streaming To SlimServer
: 6.5b1
: All All
: P2 enhancement (vote)
: ---
Assigned To: Andy Grundman
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-13 16:47 UTC by Phil Fernandez
Modified: 2009-09-08 09:17 UTC (History)
0 users

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Fernandez 2006-02-13 16:47:34 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.
Comment 1 Blackketter Dean 2006-04-22 19:43:43 UTC
Andy, is this appropriate for 6.3?
Comment 2 Andy Grundman 2006-04-22 19:46:15 UTC
Probably, I didn't know about this request, but I will take a look at it.
Comment 3 Andy Grundman 2006-05-05 15:01:01 UTC
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.
Comment 4 Andy Grundman 2006-05-05 18:09:50 UTC
Fixed in trunk and 6.3 branch.
Comment 5 Chris Owens 2006-06-27 14:22:08 UTC
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.