void WebCoreClass::getInstalledItemList(XML::gcXMLDocument &xmlDocument) { HttpHandle hh(getInstalledWizardUrl().c_str()); setWCCookies(hh); hh->getWeb(); if (hh->getDataSize() == 0) throw gcException(ERR_BADRESPONSE); if (strncmp(hh->getData(), "BZh", 3)==0) { uint32 bufSize = hh->getDataSize() *25; UTIL::MISC::Buffer buff(bufSize); UTIL::BZIP::BZ2DBuff(buff, &bufSize, const_cast<char*>(hh->getData()), hh->getDataSize()); xmlDocument.LoadBuffer(buff, bufSize); } else { xmlDocument.LoadBuffer(const_cast<char*>(hh->getData()), hh->getDataSize()); } xmlDocument.ProcessStatus("itemwizard"); }
TiXmlNode* WebCoreClass::postToServer(std::string url, std::string resource, PostMap &postData, TiXmlDocument &doc, bool useHTTPS) { gcString httpOut; { HttpHandle hh(url.c_str(), useHTTPS); if (useHTTPS) { hh->setUserAgent(getUserAgent()); #ifdef WIN32 hh->setCertFile(".\\data\\ca-bundle.crt"); #else hh->setCertFile("data/ca-bundle.crt"); #endif } else { setWCCookies(hh); } PostMap::iterator it = postData.begin(); while (it != postData.end()) { hh->addPostText(it->first.c_str(), it->second.c_str()); it++; } hh->postWeb(); if (hh->getDataSize() == 0) throw gcException(ERR_BADRESPONSE, "Data size was zero"); doc.LoadBuffer(const_cast<char*>(hh->getData()), hh->getDataSize(), TIXML_ENCODING_UTF8); if (m_bDebuggingOut) httpOut.assign(const_cast<char*>(hh->getData()), hh->getDataSize()); } TiXmlNode *uNode = doc.FirstChild(resource.c_str()); if (m_bDebuggingOut && !uNode) Warning(httpOut); XML::processStatus(doc, resource.c_str()); return uNode; }