summaryrefslogtreecommitdiff
path: root/indra/llmessage/llurlrequest.cpp
diff options
context:
space:
mode:
authorLogan Dethrow <log@lindenlab.com>2011-09-07 16:40:40 -0400
committerLogan Dethrow <log@lindenlab.com>2011-09-07 16:40:40 -0400
commitb8fddce34d1737acf32d83dac423dbb7a948cc4a (patch)
treeadf4c05ab3a42b2d3fed8fbda23c2de97840bab7 /indra/llmessage/llurlrequest.cpp
parentf73b795bb709b3060e06b4238ae4dac702f21301 (diff)
parent82b1b1bc6ee91e1778a16634fb9e2988da23fd71 (diff)
Merge. Fixed issue with LLProxy code related to changes to the LLSocket interface.
Diffstat (limited to 'indra/llmessage/llurlrequest.cpp')
-rw-r--r--indra/llmessage/llurlrequest.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index d5400e4169..91a5a8ce2c 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -41,6 +41,7 @@
#include "llstring.h"
#include "apr_env.h"
#include "llapr.h"
+#include "llscopedvolatileaprpool.h"
static const U32 HTTP_STATUS_PIPE_ERROR = 499;
/**
@@ -211,26 +212,31 @@ void LLURLRequest::setCallback(LLURLRequestComplete* callback)
// is called with use_proxy = FALSE
void LLURLRequest::useProxy(bool use_proxy)
{
- static char *env_proxy;
+ static std::string env_proxy;
- if (use_proxy && (env_proxy == NULL))
+ if (use_proxy && env_proxy.empty())
{
- apr_status_t status;
- LLAPRPool pool;
- status = apr_env_get(&env_proxy, "ALL_PROXY", pool.getAPRPool());
+ char* env_proxy_str;
+ LLScopedVolatileAPRPool scoped_pool;
+ apr_status_t status = apr_env_get(&env_proxy_str, "ALL_PROXY", scoped_pool);
if (status != APR_SUCCESS)
{
- status = apr_env_get(&env_proxy, "http_proxy", pool.getAPRPool());
+ status = apr_env_get(&env_proxy_str, "http_proxy", scoped_pool);
}
if (status != APR_SUCCESS)
{
- use_proxy = FALSE;
+ use_proxy = false;
}
+ else
+ {
+ // env_proxy_str is stored in the scoped_pool, so we have to make a copy.
+ env_proxy = env_proxy_str;
+ }
}
- LL_DEBUGS("Proxy") << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (env_proxy ? env_proxy : "(null)") << LL_ENDL;
+ LL_DEBUGS("Proxy") << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (!env_proxy.empty() ? env_proxy : "(null)") << LL_ENDL;
- if (env_proxy && use_proxy)
+ if (use_proxy && !env_proxy.empty())
{
mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, env_proxy);
}