virtual void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { if (!isGoodStatus(status)) { llinfos << mURL << " [" << status << "]: " << reason << llendl; if (mURL == legacy_client_list) { LL_WARNS("ClientTags") << "client_list_v2.xml download failed with status of " << status << LL_ENDL; // Wolfspirit: If something failes, try to use the local file FSData::getInstance()->updateClientTagsLocal(); } return; } LLSD content; LLBufferStream istr(channels, buffer.get()); if (!LLSDSerialize::fromXML(content, istr)) { llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl; if (mURL == legacy_client_list) { LL_WARNS("ClientTags") << "Downloaded client_list_v2.xml decode failed." << LL_ENDL; // Wolfspirit: If something failes, try to use the local file FSData::getInstance()->updateClientTagsLocal(); } return; } FSData::getInstance()->processResponder(content, mURL); }
void exoFlickrResponse::completedRaw( U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { LLBufferStream istr(channels, buffer.get()); std::stringstream strstrm; strstrm << istr.rdbuf(); std::string result = strstrm.str(); Json::Value root; Json::Reader reader; bool success = reader.parse(result, root); if(!success) { mCallback(false, LLSD()); return; } else { LL_INFOS("FlickrAPI") << "Got response string: " << result << LL_ENDL; LLSD response; JsonToLLSD(root, response); mCallback(isGoodStatus(status), response); } }
void httpCompleted() { if (!isGoodStatus(mStatus)) { // *TODO do some user messaging here LL_WARNS("UserReport") << dumpResponse() << LL_ENDL; } // we don't care about what the server returns LLUploadDialog::modalUploadFinished(); }
// virtual void LLCurl::Responder::completed(U32 status, const std::string& reason, const LLSD& content) { if (isGoodStatus(status)) { result(content); } else { errorWithContent(status, reason, content); } }
// virtual void LLCurl::Responder::httpCompleted() { if (isGoodStatus()) { httpSuccess(); } else { httpFailure(); } }
void completedRaw( const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { completedHeader(); if (!isGoodStatus()) { if (getStatus() == HTTP_NOT_MODIFIED) { LL_INFOS("fsdata") << "Got [304] not modified for " << mURL << LL_ENDL; } else { LL_WARNS("fsdata") << "Error fetching " << mURL << " Status: [" << getStatus() << "]" << LL_ENDL; } return; } S32 data_size = buffer->countAfter(channels.in(), NULL); if (data_size <= 0) { LL_WARNS("fsdata") << "Received zero data for " << mURL << LL_ENDL; return; } U8* data = new U8[data_size]; buffer->readAfter(channels.in(), NULL, data, data_size); // basic check for valid data received LLXMLNodePtr xml_root; if ( (!LLXMLNode::parseBuffer(data, data_size, xml_root, NULL)) || (xml_root.isNull()) || (!xml_root->hasName("script_library")) ) { LL_WARNS("fsdata") << "Could not read the script library data from "<< mURL << LL_ENDL; delete[] data; data = NULL; return; } LLAPRFile outfile ; outfile.open(mFilename, LL_APR_WB); if (!outfile.getFileHandle()) { LL_WARNS("fsdata") << "Unable to open file for writing: " << mFilename << LL_ENDL; } else { LL_INFOS("fsdata") << "Saving " << mFilename << LL_ENDL; outfile.write(data, data_size); outfile.close() ; } delete[] data; data = NULL; }
void LLCurl::Responder::completed(U32 status, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const &reason, LLSD const& mContent) { if (isGoodStatus(status)) { result(mContent); } else { errorWithContent(status, reason, mContent); } }
/*virtual*/ void completedHeaders(void) { if (isGoodStatus(mStatus)) { std::string media_type; if (mReceivedHeaders.getFirstValue("content-type", media_type)) { std::string::size_type idx1 = media_type.find_first_of(";"); std::string mime_type = media_type.substr(0, idx1); completeAny(mStatus, mime_type); return; } llwarns << "LLMediaTypeResponder::completedHeaders: OK HTTP status (" << mStatus << ") but no Content-Type! Received headers: " << mReceivedHeaders << llendl; } completeAny(mStatus, "none/none"); }
/*virtual*/ void completed(U32 status, const std::string& reason, const LLSD& content) { //std::ostringstream ss; //LLSDSerialize::toPrettyXML(content, ss); //llinfos << ss.str() << llendl; // in case of invalid characters, the avatar picker returns a 400 // just set it to process so it displays 'not found' if (isGoodStatus(status) || status == 400) { LLFloaterAvatarPicker* floater = LLFloaterReg::findTypedInstance<LLFloaterAvatarPicker>("avatar_picker"); if (floater) { floater->processResponse(mQueryID, content); } } else { llwarns << "avatar picker failed [status:" << status << "]: " << content << llendl; } }