From 2a899b49dd5d0a4ff4b4ab2e36bda48ff1473f0a Mon Sep 17 00:00:00 2001 From: callum_linden Date: Mon, 19 Oct 2015 18:43:48 -0700 Subject: MAINT-5711 FIX profiles and marketplace are asking for a login each session --- autobuild.xml | 10 +++---- indra/llplugin/llpluginclassmedia.cpp | 13 +++++++++ indra/llplugin/llpluginclassmedia.h | 2 ++ indra/media_plugins/cef/media_plugin_cef.cpp | 9 ++++++ indra/newview/llviewermedia.cpp | 41 ++++++++++++++++++++++++++++ indra/newview/llviewermedia.h | 1 + 6 files changed, 71 insertions(+), 5 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index cf6f0c8d6b..e6f1bb11aa 100755 --- a/autobuild.xml +++ b/autobuild.xml @@ -1536,11 +1536,11 @@ archive hash - fe44151af823734c3fdfedce9a91fa49 + e1c24780a5ee341fc38b860f27827df5 hash_algorithm md5 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/305753/arch/Darwin/installer/llceflib-1.2.0.305753-darwin-305753.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/306266/arch/Darwin/installer/llceflib-1.2.0.306266-darwin-306266.tar.bz2 name darwin @@ -1550,18 +1550,18 @@ archive hash - 72dd692c7ee372ba67117ec2c37d69a9 + ab90c7250d2b0859f2094c113101277b hash_algorithm md5 url - http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/305753/arch/CYGWIN/installer/llceflib-1.2.0.305753-windows-305753.tar.bz2 + http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/306266/arch/CYGWIN/installer/llceflib-1.2.0.306266-windows-306266.tar.bz2 name windows version - 1.2.0.305753 + 1.2.0.306266 llphysicsextensions_source 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("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(); -- cgit v1.2.3