예제 #1
0
void Tabid::pop() {
	if (symbols->size() == 0) return;
	Hashtable *bucket = (*symbols)[0];
	Hashtable::iterator iter = bucket->begin(),
			    end  = bucket->end();
	while (iter != end)
		delete iter->second;
	bucket->clear();
	symbols->pop_back();
	delete bucket;
}
예제 #2
0
void Tabid::pop() {
	if (symbols->size() == 0) return;
	Hashtable *bucket = symbols->back();
	Hashtable::iterator iter = bucket->begin(),
			    end  = bucket->end();
	while (iter != end) {
		delete &iter->first;
		delete iter->second;
		iter++;
	}
	bucket->clear();
	symbols->pop_back();
	delete bucket;
}
예제 #3
0
boolean CNetRequestImpl::readHeaders(Hashtable<String,String>& oHeaders)
{
    oHeaders.clear();

    CAtlStringW strHeaders;
    DWORD dwLen = 0;
    DWORD nIndex = 0;
    if( !HttpQueryInfo( hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, null, &dwLen, &nIndex) )
    {   
        DWORD dwErr = ::GetLastError();
        if ( dwErr != ERROR_INSUFFICIENT_BUFFER )
        {
            pszErrFunction = L"HttpQueryInfo";
            return false;
        }
    }
    if( !HttpQueryInfo( hRequest, HTTP_QUERY_RAW_HEADERS_CRLF, strHeaders.GetBuffer(dwLen), &dwLen, &nIndex) )
    {
        pszErrFunction = L"HttpQueryInfo";
        return false;
    }
    strHeaders.ReleaseBuffer();

    int nStart = 0;
    for(int nEnd = strHeaders.Find(L"\r\n", nStart); nEnd > 0; nStart = nEnd+2, nEnd = strHeaders.Find(L"\r\n", nStart) )
    {
        CAtlStringW strHeader = strHeaders.Mid(nStart, nEnd-nStart);
        int nSep = strHeader.Find(':');
        if (nSep < 0 )
            continue;

        CAtlStringW strName = strHeader.Mid(0, nSep);
        strName.Trim();
        strName.MakeLower();
        CAtlStringW strValue = strHeader.Mid(nSep+1);
        strValue.Trim();

        oHeaders.put(common::convertToStringA(strName.GetString()),common::convertToStringA(strValue.GetString()));
    }

    return true;
}