Merge branch 'master' of git://github.com/AlericInglewood/SingularityViewer

This commit is contained in:
Siana Gearz
2012-11-14 19:40:45 +01:00
9 changed files with 209 additions and 59 deletions

View File

@@ -53,7 +53,7 @@ static LLFloaterURLEntry* sInstance = NULL;
// Move this to its own file.
// helper class that tries to download a URL from a web site and calls a method
// on the Panel Land Media and to discover the MIME type
class LLMediaTypeResponder : public LLHTTPClient::ResponderIgnoreBody
class LLMediaTypeResponder : public LLHTTPClient::ResponderHeadersOnly
{
public:
LLMediaTypeResponder( const LLHandle<LLFloater> parent ) :
@@ -62,20 +62,20 @@ public:
LLHandle<LLFloater> mParent;
virtual bool needsHeaders(void) const { return true; }
virtual void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
{
std::string media_type;
bool content_type_found = headers.getFirstValue("content-type", media_type);
llassert_always(content_type_found);
std::string::size_type idx1 = media_type.find_first_of(";");
std::string mime_type = media_type.substr(0, idx1);
completeAny(status, mime_type);
}
virtual void error( U32 status, const std::string& reason )
{
if (200 <= status && status < 300)
{
std::string media_type;
if (headers.getFirstValue("content-type", media_type))
{
std::string::size_type idx1 = media_type.find_first_of(";");
std::string mime_type = media_type.substr(0, idx1);
completeAny(status, mime_type);
return;
}
llwarns << "LLMediaTypeResponder::completedHeaders: OK HTTP status (" << status << ") but no Content-Type! Received headers: " << headers << llendl;
}
completeAny(status, "none/none");
}

View File

@@ -168,7 +168,7 @@ std::string gFullName;
// helper class that trys to download a URL from a web site and calls a method
// on parent class indicating if the web server is working or not
class LLIamHereLogin : public LLHTTPClient::ResponderWithCompleted
class LLIamHereLogin : public LLHTTPClient::ResponderHeadersOnly
{
private:
LLIamHereLogin( LLPanelLogin* parent ) :
@@ -188,10 +188,7 @@ class LLIamHereLogin : public LLHTTPClient::ResponderWithCompleted
mParent = parentIn;
};
// We don't actually expect LLSD back, so need to override completedRaw
virtual void completedRaw(U32 status, const std::string& reason,
const LLChannelDescriptors& channels,
const LLIOPipe::buffer_ptr_t& buffer)
/*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
{
if (mParent)
{
@@ -887,7 +884,7 @@ void LLPanelLogin::refreshLoginPage()
std::string login_page = gHippoGridManager->getConnectedGrid()->getLoginPage();
if (!login_page.empty()) {
LLHTTPClient::head(login_page, gResponsePtr);
LLHTTPClient::head(login_page, gResponsePtr.get());
} else {
sInstance->setSiteIsAlive(false);
}

View File

@@ -71,7 +71,7 @@ const int RIGHT_BUTTON = 1;
///////////////////////////////////////////////////////////////////////////////
// Helper class that tries to download a URL from a web site and calls a method
// on the Panel Land Media and to discover the MIME type
class LLMimeDiscoveryResponder : public LLHTTPClient::ResponderIgnoreBody
class LLMimeDiscoveryResponder : public LLHTTPClient::ResponderHeadersOnly
{
LOG_CLASS(LLMimeDiscoveryResponder);
public:
@@ -80,16 +80,21 @@ public:
mInitialized(false)
{}
/*virtual*/ bool needsHeaders(void) const { return true; }
/*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers)
{
std::string media_type;
bool content_type_found = headers.getFirstValue("content-type", media_type);
llassert_always(content_type_found);
std::string::size_type idx1 = media_type.find_first_of(";");
std::string mime_type = media_type.substr(0, idx1);
completeAny(status, mime_type);
if (200 <= status && status < 300)
{
std::string media_type;
if (headers.getFirstValue("content-type", media_type))
{
std::string::size_type idx1 = media_type.find_first_of(";");
std::string mime_type = media_type.substr(0, idx1);
completeAny(status, mime_type);
return;
}
llwarns << "LLMimeDiscoveryResponder::completedHeaders: OK HTTP status (" << status << ") but no Content-Type! Received headers: " << headers << llendl;
}
completeAny(status, "none/none");
}
void completeAny(U32 status, const std::string& mime_type)