void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, const F32 timeout) { LLURI uri; uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query); get(uri.asString(), responder, headers, timeout); }
void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, const F32 timeout, bool follow_redirects /* = true */) { LLURI uri; uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query); get(uri.asString(), responder, headers, timeout, follow_redirects); }
void checkParts(const LLURI& u, const char* expectedScheme, const char* expectedOpaque, const char* expectedAuthority, const char* expectedPath, const char* expectedQuery = "") { ensure_equals("scheme", u.scheme(), expectedScheme); ensure_equals("opaque", u.opaque(), expectedOpaque); ensure_equals("authority", u.authority(), expectedAuthority); ensure_equals("path", u.path(), expectedPath); ensure_equals("query", u.query(), expectedQuery); }
void SDTestObject::test<7>() // Test assignment and casting to various scalar types. These // assignments should invoke the right conversion without it being // mentioned explicitly. The few exceptions are marked SAD. { SDCleanupCheck check; LLSD v(" 42.375"); bool b = false; b = v; ensure_equals("assign to bool", b, true); b = (bool)v; ensure_equals("cast to bool", b, true); int i = 99; i = v; ensure_equals("assign to int", i, 42); i = (int)v; ensure_equals("cast to int", i, 42); double d = 3.14159; d = v; ensure_equals("assign to double", d, 42.375); d = (double)v; ensure_equals("cast to double", d, 42.375); std::string s = "yo"; // SAD s = v; ensure_equals("assign to string", s, " 42.375"); s = (std::string)v; ensure_equals("cast to string", s, " 42.375"); std::string uuidStr = "b1e50c2b-b627-4d23-8a86-a65d97b6319b"; v = uuidStr; LLUUID u; u = v; ensure_equals("assign to LLUUID", u, LLUUID(uuidStr)); // SAD u = (LLUUID)v; // ensure_equals("cast to LLUUID", u, LLUUID(uuidStr)); std::string dateStr = "2005-10-24T15:00:00Z"; v = dateStr; LLDate date; date = v; ensure_equals("assign to LLDate", date.asString(), dateStr); // SAD date = (LLDate)v; // ensure_equals("cast to LLDate", date.asString(), dateStr); std::string uriStr = "http://secondlife.com"; v = uriStr; LLURI uri; uri = v; ensure_equals("assign to LLURI", uri.asString(), uriStr); // SAD uri = (LLURI)v; // ensure_equals("cast to LLURI", uri.asString(), uriStr); }
void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std::string const & hash) { mDownloadData["url"] = uri.asString(); mDownloadData["hash"] = hash; mDownloadData["current_version"] = ll_get_version(); LLSD path = uri.pathArray(); if(path.size() == 0) throw DownloadError("no file path"); std::string fileName = path[path.size() - 1].asString(); std::string filePath = gDirUtilp->getExpandedFilename(LL_PATH_TEMP, fileName); mDownloadData["path"] = filePath; LL_INFOS("UpdateDownload") << "downloading " << filePath << " from " << uri.asString() << LL_ENDL; LL_INFOS("UpdateDownload") << "hash of file is " << hash << LL_ENDL; llofstream dataStream(mDownloadRecordPath); LLSDSerialize::toPrettyXML(mDownloadData, dataStream); mDownloadStream.open(filePath, std::ios_base::out | std::ios_base::binary); initializeCurlGet(uri.asString(), true); start(); }
void ensure_equals(const char* msg, const LLURI& actual, const LLURI& expected) { ensure_equals(msg, actual.asString(), expected.asString()); }
bool operator!=(const LLURI& first, const LLURI& second) { return (first.asString() != second.asString()); }