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"); }
const XML::gcXMLElement WebCoreClass::postToServer(std::string url, std::string resource, PostMap &postData, XML::gcXMLDocument &xmlDocument, bool useHTTPS) { gcString httpOut; if (m_bDebuggingOut) { if (url.find('?') == std::string::npos) url += "?XDEBUG_SESSION_START=xdebug"; else url += "&XDEBUG_SESSION_START=xdebug"; } gcTrace("Hitting api {0}", url); { HttpHandle hh(url.c_str(), useHTTPS); if (useHTTPS) { hh->setUserAgent(getUserAgent()); if (m_bValidateCert) hh->setCertFile(UTIL::STRING::toStr(UTIL::OS::getDataPath(L"ca-bundle.crt")).c_str()); } 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"); xmlDocument.LoadBuffer(const_cast<char*>(hh->getData()), hh->getDataSize()); if (m_bDebuggingOut) httpOut.assign(const_cast<char*>(hh->getData()), hh->getDataSize()); } xmlDocument.ProcessStatus(resource); return xmlDocument.GetRoot(resource); }