summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llmessage/CMakeLists.txt3
-rwxr-xr-xindra/llmessage/llhttpclientadapter.cpp73
-rwxr-xr-xindra/llmessage/llhttpclientadapter.h53
-rwxr-xr-xindra/llmessage/tests/llhttpclientadapter_test.cpp222
-rwxr-xr-xindra/llmessage/tests/lltesthttpclientadapter.cpp61
-rwxr-xr-xindra/llmessage/tests/lltesthttpclientadapter.h57
-rwxr-xr-xindra/newview/llgroupmgr.cpp183
-rwxr-xr-xindra/newview/llgroupmgr.h18
-rwxr-xr-xindra/newview/llwebprofile.cpp24
9 files changed, 153 insertions, 541 deletions
diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt
index 51b8ed6c62..abdb418224 100755
--- a/indra/llmessage/CMakeLists.txt
+++ b/indra/llmessage/CMakeLists.txt
@@ -48,7 +48,6 @@ set(llmessage_SOURCE_FILES
llhost.cpp
llhttpassetstorage.cpp
llhttpclient.cpp
- llhttpclientadapter.cpp
llhttpconstants.cpp
llhttpnode.cpp
llhttpsdhandler.cpp
@@ -143,7 +142,6 @@ set(llmessage_HEADER_FILES
llhttpassetstorage.h
llhttpclient.h
llhttpclientinterface.h
- llhttpclientadapter.h
llhttpconstants.h
llhttpnode.h
llhttpnodeadapter.h
@@ -281,7 +279,6 @@ if (LL_TESTS)
LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}")
- LL_ADD_INTEGRATION_TEST(llhttpclientadapter "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llpartdata "" "${test_libs}")
LL_ADD_INTEGRATION_TEST(llxfer_file "" "${test_libs}")
endif (LL_TESTS)
diff --git a/indra/llmessage/llhttpclientadapter.cpp b/indra/llmessage/llhttpclientadapter.cpp
deleted file mode 100755
index 8c2a0ad9cf..0000000000
--- a/indra/llmessage/llhttpclientadapter.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * @file llhttpclientadapter.cpp
- * @brief
- *
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "llhttpclientadapter.h"
-#include "llhttpclient.h"
-//
-// LLHTTPClientAdapter::~LLHTTPClientAdapter()
-// {
-// }
-//
-// void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder)
-// {
-// LLSD empty_pragma_header;
-// // Pragma is required to stop curl adding "no-cache"
-// // Space is required to stop llurlrequest from turning off proxying
-// empty_pragma_header[HTTP_OUT_HEADER_PRAGMA] = " ";
-// LLHTTPClient::get(url, responder, empty_pragma_header);
-// }
-//
-// void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)
-// {
-// LLSD empty_pragma_header = headers;
-// if (!empty_pragma_header.has(HTTP_OUT_HEADER_PRAGMA))
-// {
-// // as above
-// empty_pragma_header[HTTP_OUT_HEADER_PRAGMA] = " ";
-// }
-// LLHTTPClient::get(url, responder, empty_pragma_header);
-// }
-//
-// void LLHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder)
-// {
-// LLHTTPClient::put(url, body, responder);
-// }
-//
-// void LLHTTPClientAdapter::put(
-// const std::string& url,
-// const LLSD& body,
-// LLCurl::ResponderPtr responder,
-// const LLSD& headers)
-// {
-// LLHTTPClient::put(url, body, responder, headers);
-// }
-//
-// void LLHTTPClientAdapter::del(
-// const std::string& url,
-// LLCurl::ResponderPtr responder)
-// {
-// LLHTTPClient::del(url, responder);
-// }
diff --git a/indra/llmessage/llhttpclientadapter.h b/indra/llmessage/llhttpclientadapter.h
deleted file mode 100755
index 0067703895..0000000000
--- a/indra/llmessage/llhttpclientadapter.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file llhttpclientadepter.h
- * @brief
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_HTTPCLIENTADAPTER_H
-#define LL_HTTPCLIENTADAPTER_H
-
-#include "llhttpclientinterface.h"
-#include "llsingleton.h" // LLSingleton<>
-
-/*
-class LLHTTPClientAdapter : public LLHTTPClientInterface, public LLSingleton<LLHTTPClientAdapter>
-{
-public:
- virtual ~LLHTTPClientAdapter();
- virtual void get(const std::string& url, LLCurl::ResponderPtr responder);
- virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers);
- virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder);
- virtual void put(
- const std::string& url,
- const LLSD& body,
- LLCurl::ResponderPtr responder,
- const LLSD& headers);
- virtual void del(
- const std::string& url,
- LLCurl::ResponderPtr responder);
-};
-*/
-
-#endif
-
diff --git a/indra/llmessage/tests/llhttpclientadapter_test.cpp b/indra/llmessage/tests/llhttpclientadapter_test.cpp
deleted file mode 100755
index e0a82e237b..0000000000
--- a/indra/llmessage/tests/llhttpclientadapter_test.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * @file llhttpclientadapter_test.cpp
- * @brief Tests for LLHTTPClientAdapter
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-#if 0
-#include "llhttpclientadapter.h"
-
-#include "../test/lltut.h"
-#include "llhttpclient.h"
-#include "llcurl_stub.cpp"
-
-float const HTTP_REQUEST_EXPIRY_SECS = 1.0F;
-
-std::vector<std::string> get_urls;
-std::vector< LLCurl::ResponderPtr > get_responders;
-void LLHTTPClient::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers, const F32 timeout, bool follow_redirects)
-{
- get_urls.push_back(url);
- get_responders.push_back(responder);
-}
-
-std::vector<std::string> put_urls;
-std::vector<LLSD> put_body;
-std::vector<LLSD> put_headers;
-std::vector<LLCurl::ResponderPtr> put_responders;
-
-void LLHTTPClient::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder, const LLSD& headers, const F32 timeout)
-{
- put_urls.push_back(url);
- put_responders.push_back(responder);
- put_body.push_back(body);
- put_headers.push_back(headers);
-
-}
-
-std::vector<std::string> delete_urls;
-std::vector<LLCurl::ResponderPtr> delete_responders;
-
-void LLHTTPClient::del(
- const std::string& url,
- LLCurl::ResponderPtr responder,
- const LLSD& headers,
- const F32 timeout)
-{
- delete_urls.push_back(url);
- delete_responders.push_back(responder);
-}
-
-namespace tut
-{
- struct LLHTTPClientAdapterData
- {
- LLHTTPClientAdapterData()
- {
- get_urls.clear();
- get_responders.clear();
- put_urls.clear();
- put_responders.clear();
- put_body.clear();
- put_headers.clear();
- delete_urls.clear();
- delete_responders.clear();
- }
- };
-
- typedef test_group<LLHTTPClientAdapterData> factory;
- typedef factory::object object;
-}
-
-namespace
-{
- tut::factory tf("LLHTTPClientAdapterData");
-}
-
-namespace tut
-{
- // Ensure we can create the object
- template<> template<>
- void object::test<1>()
- {
- LLHTTPClientAdapter adapter;
- }
-
- // Does the get pass the appropriate arguments to the LLHTTPClient
- template<> template<>
- void object::test<2>()
- {
- LLHTTPClientAdapter adapter;
-
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- adapter.get("Made up URL", responder);
- ensure_equals(get_urls.size(), 1);
- ensure_equals(get_urls[0], "Made up URL");
- }
-
- // Ensure the responder matches the one passed to get
- template<> template<>
- void object::test<3>()
- {
- LLHTTPClientAdapter adapter;
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- adapter.get("Made up URL", responder);
-
- ensure_equals(get_responders.size(), 1);
- ensure_equals(get_responders[0].get(), responder.get());
- }
-
- // Ensure the correct url is used in the put
- template<> template<>
- void object::test<4>()
- {
- LLHTTPClientAdapter adapter;
-
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- LLSD body;
- body["TestBody"] = "Foobar";
-
- adapter.put("Made up URL", body, responder);
- ensure_equals(put_urls.size(), 1);
- ensure_equals(put_urls[0], "Made up URL");
- }
-
- // Ensure the correct responder is used by put
- template<> template<>
- void object::test<5>()
- {
- LLHTTPClientAdapter adapter;
-
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- LLSD body;
- body["TestBody"] = "Foobar";
-
- adapter.put("Made up URL", body, responder);
-
- ensure_equals(put_responders.size(), 1);
- ensure_equals(put_responders[0].get(), responder.get());
- }
-
- // Ensure the message body is passed through the put properly
- template<> template<>
- void object::test<6>()
- {
- LLHTTPClientAdapter adapter;
-
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- LLSD body;
- body["TestBody"] = "Foobar";
-
- adapter.put("Made up URL", body, responder);
-
- ensure_equals(put_body.size(), 1);
- ensure_equals(put_body[0]["TestBody"].asString(), "Foobar");
- }
-
- // Ensure that headers are passed through put properly
- template<> template<>
- void object::test<7>()
- {
- LLHTTPClientAdapter adapter;
-
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- LLSD body = LLSD::emptyMap();
- body["TestBody"] = "Foobar";
-
- LLSD headers = LLSD::emptyMap();
- headers["booger"] = "omg";
-
- adapter.put("Made up URL", body, responder, headers);
-
- ensure_equals("Header count", put_headers.size(), 1);
- ensure_equals(
- "First header",
- put_headers[0]["booger"].asString(),
- "omg");
- }
-
- // Ensure that del() passes appropriate arguments to the LLHTTPClient
- template<> template<>
- void object::test<8>()
- {
- LLHTTPClientAdapter adapter;
-
- LLCurl::ResponderPtr responder = new LLCurl::Responder();
-
- adapter.del("Made up URL", responder);
-
- ensure_equals("URL count", delete_urls.size(), 1);
- ensure_equals("Received URL", delete_urls[0], "Made up URL");
-
- ensure_equals("Responder count", delete_responders.size(), 1);
- //ensure_equals("Responder", delete_responders[0], responder);
- }
-}
-
-#endif \ No newline at end of file
diff --git a/indra/llmessage/tests/lltesthttpclientadapter.cpp b/indra/llmessage/tests/lltesthttpclientadapter.cpp
deleted file mode 100755
index 4539e4a540..0000000000
--- a/indra/llmessage/tests/lltesthttpclientadapter.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- * @brief
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-#include "lltesthttpclientadapter.h"
-
-LLTestHTTPClientAdapter::LLTestHTTPClientAdapter()
-{
-}
-
-LLTestHTTPClientAdapter::~LLTestHTTPClientAdapter()
-{
-}
-
-void LLTestHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder)
-{
- mGetUrl.push_back(url);
- mGetResponder.push_back(responder);
-}
-
-void LLTestHTTPClientAdapter::put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder)
-{
- mPutUrl.push_back(url);
- mPutBody.push_back(body);
- mPutResponder.push_back(responder);
-}
-
-U32 LLTestHTTPClientAdapter::putCalls() const
-{
- return mPutUrl.size();
-}
-
-void LLTestHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)
-{
- mGetUrl.push_back(url);
- mGetHeaders.push_back(headers);
- mGetResponder.push_back(responder);
-}
-
-
diff --git a/indra/llmessage/tests/lltesthttpclientadapter.h b/indra/llmessage/tests/lltesthttpclientadapter.h
deleted file mode 100755
index c29cbb3a2a..0000000000
--- a/indra/llmessage/tests/lltesthttpclientadapter.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @file
- * @brief
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-/* Macro Definitions */
-#ifndef LL_LLTESTHTTPCLIENTADAPTER_H
-#define LL_LLTESTHTTPCLIENTADAPTER_H
-
-
-#include "linden_common.h"
-#include "llhttpclientinterface.h"
-
-class LLTestHTTPClientAdapter : public LLHTTPClientInterface
-{
-public:
- LLTestHTTPClientAdapter();
- virtual ~LLTestHTTPClientAdapter();
- virtual void get(const std::string& url, LLCurl::ResponderPtr responder);
- virtual void get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers);
-
- virtual void put(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder);
- U32 putCalls() const;
-
- std::vector<LLSD> mPutBody;
- std::vector<LLSD> mGetHeaders;
- std::vector<std::string> mPutUrl;
- std::vector<std::string> mGetUrl;
- std::vector<LLCurl::ResponderPtr> mPutResponder;
- std::vector<LLCurl::ResponderPtr> mGetResponder;
-};
-
-
-
-#endif //LL_LLSIMULATORPRESENCESENDER_H
-
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index 56e671d902..21220507e7 100755
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -53,6 +53,7 @@
#include "lltrans.h"
#include "llviewerregion.h"
#include <boost/regex.hpp>
+#include "llcorehttputil.h"
#if LL_MSVC
#pragma warning(push)
@@ -768,9 +769,9 @@ void LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id)
// LLGroupMgr
//
-LLGroupMgr::LLGroupMgr()
+LLGroupMgr::LLGroupMgr():
+ mMemberRequestInFlight(false)
{
- mLastGroupMembersRequestFrame = 0;
}
LLGroupMgr::~LLGroupMgr()
@@ -1861,7 +1862,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
group_datap->mMemberVersion.generate();
}
-
+#if 1
// Responder class for capability group management
class GroupBanDataResponder : public LLHTTPClient::Responder
{
@@ -1900,6 +1901,77 @@ void GroupBanDataResponder::httpSuccess()
}
}
+#else
+//void LLGroupMgr::groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId,
+// LLGroupMgr::EBanRequestAction action, uuid_vec_t banList)
+void LLGroupMgr::groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId,
+ LLGroupMgr::EBanRequestAction action, LLSD body)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("groupMembersRequest", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+
+ std::string finalUrl = url + "?group_id=" + groupId.asString();
+
+ EBanRequestAction currAction = action;
+
+ do
+ {
+ LLSD result;
+
+ if (currAction & (BAN_CREATE | BAN_DELETE)) // these two actions result in POSTS
+ { // build the post data.
+// LLSD postData = LLSD::emptyMap();
+//
+// postData["ban_action"] = (LLSD::Integer)(currAction & ~BAN_UPDATE);
+// // Add our list of potential banned residents to the list
+// postData["ban_ids"] = LLSD::emptyArray();
+//
+// LLSD banEntry;
+// for (uuid_vec_t::const_iterator it = banList.begin(); it != banList.end(); ++it)
+// {
+// banEntry = (*it);
+// postData["ban_ids"].append(banEntry);
+// }
+//
+// result = httpAdapter->postAndYield(self, httpRequest, finalUrl, postData);
+
+ result = httpAdapter->postAndYield(self, httpRequest, finalUrl, body);
+ }
+ else
+ {
+ result = httpAdapter->getAndYield(self, httpRequest, finalUrl);
+ }
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ if (!status)
+ {
+ LL_WARNS("GrpMgr") << "Error receiving group member data " << LL_ENDL;
+ return;
+ }
+
+ if (result.has("ban_list"))
+ {
+ result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
+ // group ban data received
+ processGroupBanRequest(result);
+ }
+
+ if (currAction & BAN_UPDATE)
+ {
+ currAction = BAN_NO_ACTION;
+ continue;
+ }
+ break;
+ } while (true);
+}
+
+#endif
+
+
void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
const LLUUID& group_id,
U32 ban_action, /* = BAN_NO_ACTION */
@@ -1925,7 +1997,32 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
{
return;
}
- cap_url += "?group_id=" + group_id.asString();
+
+#if 0
+
+ LLSD body = LLSD::emptyMap();
+ body["ban_action"] = (LLSD::Integer)(ban_action & ~BAN_UPDATE);
+ // Add our list of potential banned residents to the list
+ body["ban_ids"] = LLSD::emptyArray();
+ LLSD ban_entry;
+
+ uuid_vec_t::const_iterator iter = ban_list.begin();
+ for (; iter != ban_list.end(); ++iter)
+ {
+ ban_entry = (*iter);
+ body["ban_ids"].append(ban_entry);
+ }
+
+ LLCoros::instance().launch("LLGroupMgr::groupBanRequestCoro",
+ boost::bind(&LLGroupMgr::groupBanRequestCoro, this, _1, cap_url, group_id,
+ static_cast<LLGroupMgr::EBanRequestAction>(ban_action), body));
+
+// LLCoros::instance().launch("LLGroupMgr::groupBanRequestCoro",
+// boost::bind(&LLGroupMgr::groupBanRequestCoro, this, _1, cap_url, group_id,
+// static_cast<LLGroupMgr::EBanRequestAction>(ban_action), ban_list));
+
+#else
+ cap_url += "?group_id=" + group_id.asString();
LLSD body = LLSD::emptyMap();
body["ban_action"] = (LLSD::Integer)(ban_action & ~BAN_UPDATE);
@@ -1953,9 +2050,9 @@ void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type,
case REQUEST_DEL:
break;
}
+#endif
}
-
void LLGroupMgr::processGroupBanRequest(const LLSD& content)
{
// Did we get anything in content?
@@ -1992,45 +2089,42 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content)
LLGroupMgr::getInstance()->notifyObservers(GC_BANLIST);
}
+void LLGroupMgr::groupMembersRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId)
+{
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("groupMembersRequest", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ LLCore::HttpOptions::ptr_t httpOpts = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions);
+ mMemberRequestInFlight = true;
-// Responder class for capability group management
-class GroupMemberDataResponder : public LLHTTPClient::Responder
-{
- LOG_CLASS(GroupMemberDataResponder);
-public:
- GroupMemberDataResponder() {}
- virtual ~GroupMemberDataResponder() {}
+ LLSD postData = LLSD::emptyMap();
+ postData["group_id"] = groupId;
-private:
- /* virtual */ void httpSuccess();
- /* virtual */ void httpFailure();
- LLSD mMemberData;
-};
+ LLSD result = httpAdapter->postAndYield(self, httpRequest, url, postData, httpOpts);
-void GroupMemberDataResponder::httpFailure()
-{
- LL_WARNS("GrpMgr") << "Error receiving group member data "
- << dumpResponse() << LL_ENDL;
-}
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
-void GroupMemberDataResponder::httpSuccess()
-{
- const LLSD& content = getContent();
- if (!content.isMap())
- {
- failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
- return;
- }
- LLGroupMgr::processCapGroupMembersRequest(content);
-}
+ if (!status)
+ {
+ LL_WARNS("GrpMgr") << "Error receiving group member data " << LL_ENDL;
+ mMemberRequestInFlight = false;
+ return;
+ }
+ result.erase(LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS);
+ LLGroupMgr::processCapGroupMembersRequest(result);
+ mMemberRequestInFlight = false;
+}
-// static
void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id)
{
+ static U32 lastGroupMemberRequestFrame = 0;
+
// Have we requested the information already this frame?
- if(mLastGroupMembersRequestFrame == gFrameCount)
+ if ((lastGroupMemberRequestFrame == gFrameCount) || (mMemberRequestInFlight))
return;
LLViewerRegion* currentRegion = gAgent.getRegion();
@@ -2059,20 +2153,13 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id)
return;
}
- // Post to our service. Add a body containing the group_id.
- LLSD body = LLSD::emptyMap();
- body["group_id"] = group_id;
-
- LLHTTPClient::ResponderPtr grp_data_responder = new GroupMemberDataResponder();
-
- // This could take a while to finish, timeout after 5 minutes.
- LLHTTPClient::post(cap_url, body, grp_data_responder, LLSD(), 300);
+ lastGroupMemberRequestFrame = gFrameCount;
- mLastGroupMembersRequestFrame = gFrameCount;
+ LLCoros::instance().launch("LLGroupMgr::groupMembersRequestCoro",
+ boost::bind(&LLGroupMgr::groupMembersRequestCoro, this, _1, cap_url, group_id));
}
-// static
void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
{
// Did we get anything in content?
@@ -2089,7 +2176,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
LLUUID group_id = content["group_id"].asUUID();
- LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
+ LLGroupMgrGroupData* group_datap = getGroupData(group_id);
if(!group_datap)
{
LL_WARNS("GrpMgr") << "Received incorrect, possibly stale, group or request id" << LL_ENDL;
@@ -2183,7 +2270,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
// TODO:
// Refactor to reduce multiple calls for data we already have.
if(group_datap->mTitles.size() < 1)
- LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id);
+ sendGroupTitlesRequest(group_id);
group_datap->mMemberDataComplete = true;
@@ -2192,11 +2279,11 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content)
if (group_datap->mPendingRoleMemberRequest || !group_datap->mRoleMemberDataComplete)
{
group_datap->mPendingRoleMemberRequest = false;
- LLGroupMgr::getInstance()->sendGroupRoleMembersRequest(group_id);
+ sendGroupRoleMembersRequest(group_id);
}
group_datap->mChanged = TRUE;
- LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA);
+ notifyObservers(GC_MEMBER_DATA);
}
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index 2e94e8d9a0..f41a637917 100755
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -32,6 +32,8 @@
#include <vector>
#include <string>
#include <map>
+#include "lleventcoro.h"
+#include "llcoros.h"
// Forward Declarations
class LLMessageSystem;
@@ -362,6 +364,7 @@ public:
BAN_UPDATE = 4
};
+
public:
LLGroupMgr();
~LLGroupMgr();
@@ -396,15 +399,13 @@ public:
static void sendGroupMemberEjects(const LLUUID& group_id,
uuid_vec_t& member_ids);
- static void sendGroupBanRequest(EBanRequestType request_type,
+ void sendGroupBanRequest(EBanRequestType request_type,
const LLUUID& group_id,
U32 ban_action = BAN_NO_ACTION,
const uuid_vec_t ban_list = uuid_vec_t());
- static void processGroupBanRequest(const LLSD& content);
void sendCapGroupMembersRequest(const LLUUID& group_id);
- static void processCapGroupMembersRequest(const LLSD& content);
void cancelGroupRoleChanges(const LLUUID& group_id);
@@ -427,6 +428,15 @@ public:
void clearGroupData(const LLUUID& group_id);
private:
+ friend class GroupBanDataResponder;
+
+ void groupMembersRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId);
+ void processCapGroupMembersRequest(const LLSD& content);
+
+ //void groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId, EBanRequestAction action, uuid_vec_t banList);
+ void groupBanRequestCoro(LLCoros::self& self, std::string url, LLUUID groupId, EBanRequestAction action, LLSD postBody);
+ static void processGroupBanRequest(const LLSD& content);
+
void notifyObservers(LLGroupChange gc);
void notifyObserver(const LLUUID& group_id, LLGroupChange gc);
void addGroup(LLGroupMgrGroupData* group_datap);
@@ -442,7 +452,7 @@ private:
typedef std::map<LLUUID,observer_set_t> observer_map_t;
observer_map_t mParticularObservers;
- S32 mLastGroupMembersRequestFrame;
+ bool mMemberRequestInFlight;
};
diff --git a/indra/newview/llwebprofile.cpp b/indra/newview/llwebprofile.cpp
index 3d371e629f..df5f4e3588 100755
--- a/indra/newview/llwebprofile.cpp
+++ b/indra/newview/llwebprofile.cpp
@@ -131,10 +131,7 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
if (!status)
{
- std::ostringstream ostm;
- LLSDSerialize::toPrettyXML(httpResults, ostm);
LL_WARNS("Snapshots") << "Failed to get image upload config" << LL_ENDL;
- LL_WARNS("Snapshots") << ostm.str() << LL_ENDL;
LLWebProfile::reportImageUploadStatus(false);
return;
}
@@ -146,7 +143,7 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
const std::string boundary = "----------------------------0123abcdefab";
// a new set of headers.
- httpHeaders = buildDefaultHeaders();
+ httpHeaders = LLWebProfile::buildDefaultHeaders();
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, getAuthCookie());
httpHeaders->remove(HTTP_OUT_HEADER_CONTENT_TYPE);
httpHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
@@ -155,11 +152,6 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
result = httpAdapter->postAndYield(self, httpRequest, uploadUrl, body, httpOpts, httpHeaders);
- {
- std::ostringstream ostm;
- LLSDSerialize::toPrettyXML(result, ostm);
- LL_WARNS("Snapshots") << ostm.str() << LL_ENDL;
- }
body.reset();
httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
@@ -173,7 +165,7 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
LLSD resultHeaders = httpResults[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_HEADERS];
- httpHeaders = buildDefaultHeaders();
+ httpHeaders = LLWebProfile::buildDefaultHeaders();
httpHeaders->append(HTTP_OUT_HEADER_COOKIE, getAuthCookie());
const std::string& redirUrl = resultHeaders[HTTP_IN_HEADER_LOCATION].asStringRef();
@@ -198,16 +190,10 @@ void LLWebProfile::uploadImageCoro(LLCoros::self& self, LLPointer<LLImageFormatt
return;
}
- LLSD raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW];
-// const LLSD::Binary &rawBin = raw.asBinary();
-// std::istringstream rawresult(rawBin.begin(), rawBin.end());
+ //LLSD raw = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_RAW];
-// LLBufferStream istr(channels, buffer.get());
-// std::stringstream strstrm;
-// strstrm << istr.rdbuf();
-// const std::string body = strstrm.str();
LL_INFOS("Snapshots") << "Image uploaded." << LL_ENDL;
- LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << raw.asString() << "]" << LL_ENDL;
+ //LL_DEBUGS("Snapshots") << "Uploading image succeeded. Response: [" << raw.asString() << "]" << LL_ENDL;
LLWebProfile::reportImageUploadStatus(true);
@@ -219,8 +205,6 @@ LLCore::BufferArray::ptr_t LLWebProfile::buildPostData(const LLSD &data, LLPoint
LLCore::BufferArray::ptr_t body(new LLCore::BufferArray);
LLCore::BufferArrayStream bas(body.get());
- // std::ostringstream body;
-
// *NOTE: The order seems to matter.
bas << "--" << boundary << "\r\n"
<< "Content-Disposition: form-data; name=\"key\"\r\n\r\n"