Add AIHTTPReceivedHeaders
This fixes the problem that existed with received headers:
The server sends some headers ("set-cookie") more than once
in the same reply, which cannot be stored in std::map.
The old code just ignored the additional cookies, while
curlthreading3 (since the introduction of AIHTTPHeaders)
caused an assertion.
AIHTTPReceivedHeaders is written around a std::multimap
and allows to retrieve multiple headers with the same key.
Also, it is case insensitive so that if a server sends
"Content-Type" it will still find it (the viewer looks for
"content-type").
This commit is contained in:
@@ -64,10 +64,10 @@ public:
|
||||
|
||||
virtual bool needsHeaders(void) const { return true; }
|
||||
|
||||
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPHeaders const& headers)
|
||||
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
|
||||
{
|
||||
std::string media_type;
|
||||
bool content_type_found = headers.getValue("content-type", media_type);
|
||||
bool content_type_found = headers.getFirstValue("content-type", media_type);
|
||||
llassert_always(content_type_found);
|
||||
std::string::size_type idx1 = media_type.find_first_of(";");
|
||||
std::string mime_type = media_type.substr(0, idx1);
|
||||
|
||||
Reference in New Issue
Block a user