fix handling of HTTP headers case (patch 763760)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@21853 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -90,7 +90,7 @@ void wxHTTP::SetHeader(const wxString& header, const wxString& h_data)
|
|||||||
wxNode *node = m_headers.Find(header);
|
wxNode *node = m_headers.Find(header);
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
m_headers.Append(header.Upper(), (wxObject *)(new wxString(h_data)));
|
m_headers.Append(header, (wxObject *)(new wxString(h_data)));
|
||||||
else {
|
else {
|
||||||
wxString *str = (wxString *)node->Data();
|
wxString *str = (wxString *)node->Data();
|
||||||
(*str) = h_data;
|
(*str) = h_data;
|
||||||
@@ -99,16 +99,17 @@ void wxHTTP::SetHeader(const wxString& header, const wxString& h_data)
|
|||||||
|
|
||||||
wxString wxHTTP::GetHeader(const wxString& header)
|
wxString wxHTTP::GetHeader(const wxString& header)
|
||||||
{
|
{
|
||||||
wxNode *node;
|
// not using m_headers::Find as can't control case-sensitivity
|
||||||
wxString upper_header;
|
// in comparison
|
||||||
|
wxNode *head = m_headers.GetFirst();
|
||||||
upper_header = header.Upper();
|
while(head)
|
||||||
|
{
|
||||||
node = m_headers.Find(upper_header);
|
wxString key = head->GetKeyString();
|
||||||
if (!node)
|
if(header.Upper() == key.Upper())
|
||||||
|
return *((wxString *)head->GetData());
|
||||||
|
head = head->GetNext();
|
||||||
|
}
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
return *((wxString *)node->Data());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHTTP::SendHeaders()
|
void wxHTTP::SendHeaders()
|
||||||
@@ -153,7 +154,6 @@ bool wxHTTP::ParseHeaders()
|
|||||||
|
|
||||||
wxString left_str = line.BeforeFirst(':');
|
wxString left_str = line.BeforeFirst(':');
|
||||||
wxString *str = new wxString(line.AfterFirst(':').Strip(wxString::both));
|
wxString *str = new wxString(line.AfterFirst(':').Strip(wxString::both));
|
||||||
left_str.MakeUpper();
|
|
||||||
|
|
||||||
m_headers.Append(left_str, (wxObject *) str);
|
m_headers.Append(left_str, (wxObject *) str);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user