summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorcallum_linden <none@none>2015-10-19 18:43:48 -0700
committercallum_linden <none@none>2015-10-19 18:43:48 -0700
commit2a899b49dd5d0a4ff4b4ab2e36bda48ff1473f0a (patch)
treea551bdf4312569c9d2039c66650bc45b217515f2 /indra
parent506e7271a7b69cc08a9096a6642a0b3f1b0ce04a (diff)
MAINT-5711 FIX profiles and marketplace are asking for a login each session
Diffstat (limited to 'indra')
-rwxr-xr-xindra/llplugin/llpluginclassmedia.cpp13
-rwxr-xr-xindra/llplugin/llpluginclassmedia.h2
-rw-r--r--indra/media_plugins/cef/media_plugin_cef.cpp9
-rwxr-xr-xindra/newview/llviewermedia.cpp41
-rwxr-xr-xindra/newview/llviewermedia.h1
5 files changed, 66 insertions, 0 deletions
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index c1464db834..b48f664a2a 100755
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -670,6 +670,19 @@ bool LLPluginClassMedia::textInput(const std::string &text, MASK modifiers, LLSD
return true;
}
+void LLPluginClassMedia::setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path)
+{
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "set_cookie");
+
+ message.setValue("uri", uri);
+ message.setValue("name", name);
+ message.setValue("value", value);
+ message.setValue("domain", domain);
+ message.setValue("path", path);
+
+ sendMessage(message);
+}
+
void LLPluginClassMedia::loadURI(const std::string &uri)
{
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "load_uri");
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 5fe8254331..3f53551b90 100755
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -133,6 +133,8 @@ public:
// Text may be unicode (utf8 encoded)
bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data);
+ void setCookie(std::string uri, std::string name, std::string value, std::string domain, std::string path);
+
void loadURI(const std::string &uri);
// "Loading" means uninitialized or any state prior to fully running (processing commands)
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 3f3d9dc657..7f538e16d8 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -479,6 +479,15 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
std::string uri = message_in.getValue("uri");
mLLCEFLib->navigate(uri);
}
+ else if (message_name == "set_cookie")
+ {
+ std::string uri = message_in.getValue("uri");
+ std::string name = message_in.getValue("name");
+ std::string value = message_in.getValue("value");
+ std::string domain = message_in.getValue("domain");
+ std::string path = message_in.getValue("path");
+ mLLCEFLib->setCookie(uri, name, value, domain, path);
+ }
else if (message_name == "mouse_event")
{
std::string event = message_in.getValue("event");
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 5eab0a15ab..3342fddade 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -66,6 +66,7 @@
#include "llvoavatar.h"
#include "llvoavatarself.h"
#include "llvovolume.h"
+#include "llfloaterreg.h"
#include "llwebprofile.h"
#include "llwindow.h"
#include "llvieweraudio.h"
@@ -1388,6 +1389,28 @@ LLSD LLViewerMedia::getHeaders()
return headers;
}
+ /////////////////////////////////////////////////////////////////////////////////////////
+ // static
+bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path)
+{
+ std::size_t name_pos = raw_cookie.find_first_of("=");
+ if (name_pos != std::string::npos)
+ {
+ name = raw_cookie.substr(0, name_pos);
+ std::size_t value_pos = raw_cookie.find_first_of(";", name_pos);
+ if (value_pos != std::string::npos)
+ {
+ value = raw_cookie.substr(name_pos + 1, value_pos - name_pos - 1);
+ path = "/"; // assume root path for now
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
/////////////////////////////////////////////////////////////////////////////////////////
// static
void LLViewerMedia::setOpenIDCookie()
@@ -1419,6 +1442,24 @@ void LLViewerMedia::setOpenIDCookie()
getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start));
+ LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
+ if (media_instance)
+ {
+ std::string cookie_host = authority.substr(host_start, host_end - host_start);
+ std::string cookie_name = "";
+ std::string cookie_value = "";
+ std::string cookie_path = "";
+ if (parseRawCookie(sOpenIDCookie, cookie_name, cookie_value, cookie_path))
+ {
+ std::string url = "http://id.secondlife.com/openid/webkit";
+ media_instance->getMediaPlugin()->setCookie(url, cookie_name, cookie_value, cookie_host, cookie_path);
+ }
+ };
+
+ // NOTE: this is the original OpenID cookie code, so of which is no longer needed now that we
+ // are using CEF - it's very intertwined with other code so, for the moment, I'm going to
+ // leave it alone and make a task to come back to it once we're sure the CEF cookie code is robust.
+
// Do a web profile get so we can store the cookie
LLSD headers = LLSD::emptyMap();
headers[HTTP_OUT_HEADER_ACCEPT] = "*/*";
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index f2da30e10b..0101c85e79 100755
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -163,6 +163,7 @@ public:
static LLSD getHeaders();
private:
+ static bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path);
static void setOpenIDCookie();
static void onTeleportFinished();