diff options
Diffstat (limited to 'linden/indra/llmessage/llurlrequest.cpp')
-rw-r--r-- | linden/indra/llmessage/llurlrequest.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/linden/indra/llmessage/llurlrequest.cpp b/linden/indra/llmessage/llurlrequest.cpp index 46e976f..87f0116 100644 --- a/linden/indra/llmessage/llurlrequest.cpp +++ b/linden/indra/llmessage/llurlrequest.cpp | |||
@@ -45,6 +45,7 @@ | |||
45 | #include "llstring.h" | 45 | #include "llstring.h" |
46 | #include "apr_env.h" | 46 | #include "apr_env.h" |
47 | #include "llapr.h" | 47 | #include "llapr.h" |
48 | #include "llscopedvolatileaprpool.h" | ||
48 | static const U32 HTTP_STATUS_PIPE_ERROR = 499; | 49 | static const U32 HTTP_STATUS_PIPE_ERROR = 499; |
49 | 50 | ||
50 | /** | 51 | /** |
@@ -161,27 +162,31 @@ void LLURLRequest::setCallback(LLURLRequestComplete* callback) | |||
161 | // is called with use_proxy = FALSE | 162 | // is called with use_proxy = FALSE |
162 | void LLURLRequest::useProxy(bool use_proxy) | 163 | void LLURLRequest::useProxy(bool use_proxy) |
163 | { | 164 | { |
164 | static char *env_proxy; | 165 | static std::string env_proxy; |
165 | 166 | ||
166 | if (use_proxy && (env_proxy == NULL)) | 167 | if (use_proxy && env_proxy.empty()) |
167 | { | 168 | { |
168 | apr_status_t status; | 169 | char* env_proxy_str; |
169 | LLAPRPool pool; | 170 | LLScopedVolatileAPRPool scoped_pool; |
170 | status = apr_env_get(&env_proxy, "ALL_PROXY", pool.getAPRPool()); | 171 | apr_status_t status = apr_env_get(&env_proxy_str, "ALL_PROXY", scoped_pool); |
171 | if (status != APR_SUCCESS) | 172 | if (status != APR_SUCCESS) |
172 | { | 173 | { |
173 | status = apr_env_get(&env_proxy, "http_proxy", pool.getAPRPool()); | 174 | status = apr_env_get(&env_proxy_str, "http_proxy", scoped_pool); |
174 | } | 175 | } |
175 | if (status != APR_SUCCESS) | 176 | if (status != APR_SUCCESS) |
176 | { | 177 | { |
177 | use_proxy = FALSE; | 178 | use_proxy = false; |
178 | } | 179 | } |
180 | else | ||
181 | { | ||
182 | // env_proxy_str is stored in the scoped_pool, so we have to make a copy. | ||
183 | env_proxy = env_proxy_str; | ||
184 | } | ||
179 | } | 185 | } |
180 | 186 | ||
187 | lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = \"" << env_proxy << "\"" << llendl; | ||
181 | 188 | ||
182 | lldebugs << "use_proxy = " << (use_proxy?'Y':'N') << ", env_proxy = " << (env_proxy ? env_proxy : "(null)") << llendl; | 189 | if (use_proxy) |
183 | |||
184 | if (env_proxy && use_proxy) | ||
185 | { | 190 | { |
186 | mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, env_proxy); | 191 | mDetail->mCurlRequest->setoptString(CURLOPT_PROXY, env_proxy); |
187 | } | 192 | } |