summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorcallum_linden <none@none>2015-10-20 14:44:36 -0700
committercallum_linden <none@none>2015-10-20 14:44:36 -0700
commitc16e726d0e2a8c607ce441eb5bf2419b16b41cab (patch)
tree871cafe6ac47a75437e852868a066557d128026b /indra/newview
parent2a899b49dd5d0a4ff4b4ab2e36bda48ff1473f0a (diff)
MAINT-5711 FIX2 auto login for profiles - final part retrieves the URL to set cookie for
from the message sent over by login.cgi
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llviewermedia.cpp43
-rwxr-xr-xindra/newview/llviewermedia.h4
2 files changed, 26 insertions, 21 deletions
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 3342fddade..1098b2a7e1 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -285,13 +285,16 @@ public:
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
{
+ const std::string url = getURL();
+ llinfos << "@@@ URL to set cookie on" << url << llendl;
+
// We don't care about the content of the response, only the Set-Cookie header.
- LL_DEBUGS("MediaAuth") << dumpResponse()
- << " [headers:" << getResponseHeaders() << "]" << LL_ENDL;
+ llinfos << dumpResponse()
+ << " [headers:" << getResponseHeaders() << "]" << llendl;
const std::string& cookie = getResponseHeader(HTTP_IN_HEADER_SET_COOKIE);
// *TODO: What about bad status codes? Does this destroy previous cookies?
- LLViewerMedia::openIDCookieResponse(cookie);
+ LLViewerMedia::openIDCookieResponse(url, cookie);
}
};
@@ -1200,7 +1203,7 @@ void LLViewerMedia::clearAllCookies()
}
// If we have an OpenID cookie, re-add it to the cookie store.
- setOpenIDCookie();
+ setOpenIDCookie(std::string());
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -1303,7 +1306,7 @@ void LLViewerMedia::loadCookieFile()
}
// If we have an OpenID cookie, re-add it to the cookie store.
- setOpenIDCookie();
+ setOpenIDCookie(std::string());
}
@@ -1413,7 +1416,7 @@ bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& na
/////////////////////////////////////////////////////////////////////////////////////////
// static
-void LLViewerMedia::setOpenIDCookie()
+void LLViewerMedia::setOpenIDCookie(const std::string& url)
{
if(!sOpenIDCookie.empty())
{
@@ -1442,19 +1445,21 @@ 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))
+ if (url.length())
+ {
+ LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
+ if (media_instance)
{
- std::string url = "http://id.secondlife.com/openid/webkit";
- media_instance->getMediaPlugin()->setCookie(url, cookie_name, cookie_value, cookie_host, cookie_path);
+ 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))
+ {
+ 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
@@ -1514,13 +1519,13 @@ void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string
/////////////////////////////////////////////////////////////////////////////////////////
// static
-void LLViewerMedia::openIDCookieResponse(const std::string &cookie)
+void LLViewerMedia::openIDCookieResponse(const std::string& url, const std::string &cookie)
{
LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
sOpenIDCookie += cookie;
- setOpenIDCookie();
+ setOpenIDCookie(url);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 0101c85e79..45d211f232 100755
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -150,7 +150,7 @@ public:
static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
- static void openIDCookieResponse(const std::string &cookie);
+ static void openIDCookieResponse(const std::string& url, const std::string &cookie);
static void proxyWindowOpened(const std::string &target, const std::string &uuid);
static void proxyWindowClosed(const std::string &uuid);
@@ -164,7 +164,7 @@ public:
private:
static bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path);
- static void setOpenIDCookie();
+ static void setOpenIDCookie(const std::string& url);
static void onTeleportFinished();
static LLPluginCookieStore *sCookieStore;