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:
Aleric Inglewood
2012-10-21 17:45:46 +02:00
parent f7626699da
commit 937a60c8f9
9 changed files with 152 additions and 44 deletions

View File

@@ -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);