svn merge -r67131:67483 svn+ssh://svn/svn/linden/branches/Branch_1-18-1

master
Kartic Krishnamurthy 2007-08-08 00:55:57 +00:00
parent 057a5646c1
commit 52cb2aea86
6 changed files with 80 additions and 4 deletions

View File

@ -245,6 +245,7 @@ static void request(
LLURLRequest *req = new LLURLRequest(method, url);
req->requestEncoding("");
// Insert custom headers is the caller sent any
if (headers.isMap())
{
LLSD::map_const_iterator iter = headers.beginMap();
@ -253,7 +254,17 @@ static void request(
for (; iter != end; ++iter)
{
std::ostringstream header;
//if the header is "Pragma" with no value
//the caller intends to force libcurl to drop
//the Pragma header it so gratuitously inserts
//Before inserting the header, force libcurl
//to not use the proxy (read: llurlrequest.cpp)
if ((iter->first == "Pragma") && (iter->second.asString() == ""))
{
req->useProxy(FALSE);
}
header << iter->first << ": " << iter->second.asString() ;
llinfos << "header = " << header.str() << llendl;
req->addHeader(header.str().c_str());
}
}

View File

@ -19,6 +19,7 @@
#include "llpumpio.h"
#include "llsd.h"
#include "llstring.h"
#include "apr-1/apr_env.h"
static const U32 HTTP_STATUS_PIPE_ERROR = 499;
@ -182,6 +183,47 @@ void LLURLRequest::setCallback(LLURLRequestComplete* callback)
curl_easy_setopt(mDetail->mCurl, CURLOPT_WRITEHEADER, callback);
}
// Added to mitigate the effect of libcurl looking
// for the ALL_PROXY and http_proxy env variables
// and deciding to insert a Pragma: no-cache
// header! The only usage of this method at the
// time of this writing is in llhttpclient.cpp
// in the request() method, where this method
// is called with use_proxy = FALSE
void LLURLRequest::useProxy(bool use_proxy)
{
static char *env_proxy;
if (use_proxy && (env_proxy == NULL))
{
apr_status_t status;
apr_pool_t* pool;
apr_pool_create(&pool, NULL);
status = apr_env_get(&env_proxy, "ALL_PROXY", pool);
if (status != APR_SUCCESS)
{
status = apr_env_get(&env_proxy, "http_proxy", pool);
}
if (status != APR_SUCCESS)
{
use_proxy = FALSE;
}
apr_pool_destroy(pool);
}
lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << env_proxy << llendl;
if (env_proxy && use_proxy)
{
curl_easy_setopt(mDetail->mCurl, CURLOPT_PROXY, env_proxy);
}
else
{
curl_easy_setopt(mDetail->mCurl, CURLOPT_PROXY, "");
}
}
// virtual
LLIOPipe::EStatus LLURLRequest::handleError(
LLIOPipe::EStatus status,

View File

@ -154,6 +154,12 @@ public:
/* @name LLIOPipe virtual implementations
*/
/**
* @ brief Turn off (or on) the CURLOPT_PROXY header.
*/
void useProxy(bool use_proxy);
public:
/**
* @brief Give this pipe a chance to handle a generated error

View File

@ -107,8 +107,8 @@ void LLHUDManager::cleanupEffects()
LLHUDEffect *LLHUDManager::createViewerEffect(const U8 type, BOOL send_to_sim, BOOL originated_here)
{
// Should assert that this is actually an LLHUDEffect
LLHUDEffect *hep = (LLHUDEffect *)LLHUDObject::addHUDObject(type);
// SJB: DO NOT USE addHUDObject!!! Not all LLHUDObjects are LLHUDEffects!
LLHUDEffect *hep = LLHUDObject::addHUDEffect(type);
if (!hep)
{
return NULL;
@ -149,7 +149,6 @@ void LLHUDManager::processViewerEffect(LLMessageSystem *mesgsys, void **user_dat
{
effectp = NULL;
LLHUDEffect::getIDType(mesgsys, k, effect_id, effect_type);
S32 i;
for (i = 0; i < gHUDManager->mHUDEffects.count(); i++)
{

View File

@ -135,6 +135,22 @@ LLHUDObject *LLHUDObject::addHUDObject(const U8 type)
case LL_HUD_CONNECTOR:
hud_objectp = new LLHUDConnector(type);
break;
default:
llwarns << "Unknown type of hud object:" << (U32) type << llendl;
}
if (hud_objectp)
{
sHUDObjects.push_back(hud_objectp);
}
return hud_objectp;
}
LLHUDEffect *LLHUDObject::addHUDEffect(const U8 type)
{
LLHUDEffect *hud_objectp = NULL;
switch (type)
{
case LL_HUD_EFFECT_BEAM:
hud_objectp = new LLHUDEffectSpiral(type);
((LLHUDEffectSpiral *)hud_objectp)->setDuration(0.7f);
@ -213,7 +229,7 @@ LLHUDObject *LLHUDObject::addHUDObject(const U8 type)
hud_objectp = new LLHUDEffectPointAt(type);
break;
default:
llwarns << "Unknown type of hud object:" << (U32) type << llendl;
llwarns << "Unknown type of hud effect:" << (U32) type << llendl;
}
if (hud_objectp)

View File

@ -26,6 +26,7 @@ class LLViewerCamera;
class LLFontGL;
class LLFace;
class LLViewerObject;
class LLHUDEffect;
class LLHUDObject : public LLRefCount
{
@ -45,6 +46,7 @@ public:
U8 getType() const { return mType; }
static LLHUDObject *addHUDObject(const U8 type);
static LLHUDEffect *addHUDEffect(const U8 type);
static void updateAll();
static void renderAll();
static void renderAllForSelect();