MAINT-5711 FIX profiles and marketplace are asking for a login each session

master
callum_linden 2015-10-19 18:43:48 -07:00
parent 506e7271a7
commit 2a899b49dd
6 changed files with 71 additions and 5 deletions

View File

@ -1536,11 +1536,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>fe44151af823734c3fdfedce9a91fa49</string>
<string>e1c24780a5ee341fc38b860f27827df5</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
<string>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</string>
<string>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</string>
</map>
<key>name</key>
<string>darwin</string>
@ -1550,18 +1550,18 @@
<key>archive</key>
<map>
<key>hash</key>
<string>72dd692c7ee372ba67117ec2c37d69a9</string>
<string>ab90c7250d2b0859f2094c113101277b</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
<string>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</string>
<string>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</string>
</map>
<key>name</key>
<string>windows</string>
</map>
</map>
<key>version</key>
<string>1.2.0.305753</string>
<string>1.2.0.306266</string>
</map>
<key>llphysicsextensions_source</key>
<map>

View File

@ -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");

View File

@ -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)

View File

@ -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");

View File

@ -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] = "*/*";

View File

@ -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();