Simplify header-parsing code in wxWebResponseCURL
Use BeforeFirst() when we only need to find the first colon instead of wxSplit(). No real changes (except for pathological case when there is no colon at all, which wasn't handled correctly by the original code and still isn't, but in a slightly different way).
This commit is contained in:
parent
b37c7417f6
commit
7b7f9fa6c0
@ -89,14 +89,10 @@ size_t wxWebResponseCURL::AddHeaderData(const char * buffer, size_t size)
|
||||
}
|
||||
else if ( !hdr.empty() )
|
||||
{
|
||||
wxArrayString hdrArr = wxSplit(hdr, ':');
|
||||
wxString hdrName;
|
||||
wxString hdrValue;
|
||||
if ( hdrArr.size() > 0 )
|
||||
hdrName = hdrArr[0].Trim().MakeUpper();
|
||||
if ( hdrArr.size() > 1 )
|
||||
hdrValue = hdrArr[1].Trim(false);
|
||||
m_headers[hdrName] = hdrValue;
|
||||
wxString hdrName = hdr.BeforeFirst(':', &hdrValue).Strip(wxString::trailing);
|
||||
hdrName.MakeUpper();
|
||||
m_headers[hdrName] = hdrValue.Strip(wxString::leading);
|
||||
}
|
||||
|
||||
return size;
|
||||
|
Loading…
Reference in New Issue
Block a user