SOCIAL-643 As a user, I would like to be able to browse and purchase from the marketplace from within the viewer by logging in only once, and with no appreciable delay

master
Leyla Farazha 2011-03-04 15:57:54 -08:00
parent d19eb012c6
commit cd01bdfffd
1 changed files with 51 additions and 0 deletions

View File

@ -59,6 +59,7 @@
#include "lluuid.h"
#include "llkeyboard.h"
#include "llmutelist.h"
#include "llpanelprofile.h"
//#include "llfirstuse.h"
#include "llwindow.h"
@ -292,6 +293,43 @@ public:
};
class LLViewerMediaWebProfileResponder : public LLHTTPClient::Responder
{
LOG_CLASS(LLViewerMediaWebProfileResponder);
public:
LLViewerMediaWebProfileResponder(std::string host)
{
mHost = host;
}
~LLViewerMediaWebProfileResponder()
{
}
/* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
{
LL_WARNS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL;
LL_WARNS("MediaAuth") << content << LL_ENDL;
std::string cookie = content["set-cookie"].asString();
LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, mHost);
}
void completedRaw(
U32 status,
const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
{
// This is just here to disable the default behavior (attempting to parse the response as llsd).
// We don't care about the content of the response, only the set-cookie header.
}
std::string mHost;
};
LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL;
LLURL LLViewerMedia::sOpenIDURL;
std::string LLViewerMedia::sOpenIDCookie;
@ -1351,6 +1389,19 @@ void LLViewerMedia::setOpenIDCookie()
// *HACK: Doing this here is nasty, find a better way.
LLWebSharing::instance().setOpenIDCookie(sOpenIDCookie);
// Do a web profile get so we can store the cookie
LLSD headers = LLSD::emptyMap();
headers["Accept"] = "*/*";
headers["Cookie"] = sOpenIDCookie;
headers["User-Agent"] = getCurrentUserAgent();
std::string profile_url = getProfileURL("");
LLURL raw_profile_url( profile_url.c_str() );
LLHTTPClient::get(profile_url,
new LLViewerMediaWebProfileResponder(raw_profile_url.getAuthority()),
headers);
}
}