diff options
author | Dahlia Trimble | 2009-02-06 01:25:59 +0000 |
---|---|---|
committer | Dahlia Trimble | 2009-02-06 01:25:59 +0000 |
commit | 28820e618502beac65f246e00509d845dbdfe5ba (patch) | |
tree | 1b406beba1250cca9d07d07c18752d4013939e76 /OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |
parent | * minor: remove mono compiler warning (diff) | |
download | opensim-SC_OLD-28820e618502beac65f246e00509d845dbdfe5ba.zip opensim-SC_OLD-28820e618502beac65f246e00509d845dbdfe5ba.tar.gz opensim-SC_OLD-28820e618502beac65f246e00509d845dbdfe5ba.tar.bz2 opensim-SC_OLD-28820e618502beac65f246e00509d845dbdfe5ba.tar.xz |
Thanks cmickyb for a patch (Mantis#3089) that adds support for proxy in http requests
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 7b21832..eb9b322 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -90,6 +90,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
90 | private int httpTimeout = 30000; | 90 | private int httpTimeout = 30000; |
91 | private string m_name = "HttpScriptRequests"; | 91 | private string m_name = "HttpScriptRequests"; |
92 | 92 | ||
93 | private string m_proxyurl = ""; | ||
94 | private string m_proxyexcepts = ""; | ||
95 | |||
93 | // <request id, HttpRequestClass> | 96 | // <request id, HttpRequestClass> |
94 | private Dictionary<UUID, HttpRequestClass> m_pendingRequests; | 97 | private Dictionary<UUID, HttpRequestClass> m_pendingRequests; |
95 | private Scene m_scene; | 98 | private Scene m_scene; |
@@ -152,6 +155,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
152 | htc.httpTimeout = httpTimeout; | 155 | htc.httpTimeout = httpTimeout; |
153 | htc.outbound_body = body; | 156 | htc.outbound_body = body; |
154 | htc.response_headers = headers; | 157 | htc.response_headers = headers; |
158 | htc.proxyurl = m_proxyurl; | ||
159 | htc.proxyexcepts = m_proxyexcepts; | ||
155 | 160 | ||
156 | lock (HttpListLock) | 161 | lock (HttpListLock) |
157 | { | 162 | { |
@@ -232,6 +237,9 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
232 | 237 | ||
233 | m_scene.RegisterModuleInterface<IHttpRequests>(this); | 238 | m_scene.RegisterModuleInterface<IHttpRequests>(this); |
234 | 239 | ||
240 | m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); | ||
241 | m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); | ||
242 | |||
235 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); | 243 | m_pendingRequests = new Dictionary<UUID, HttpRequestClass>(); |
236 | } | 244 | } |
237 | 245 | ||
@@ -285,6 +293,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
285 | public Dictionary<string, string> response_headers; | 293 | public Dictionary<string, string> response_headers; |
286 | public int status; | 294 | public int status; |
287 | public string url; | 295 | public string url; |
296 | public string proxyurl; | ||
297 | public string proxyexcepts; | ||
288 | 298 | ||
289 | public void process() | 299 | public void process() |
290 | { | 300 | { |
@@ -316,6 +326,15 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
316 | WebRequest.Create(url); | 326 | WebRequest.Create(url); |
317 | request.Method = httpMethod; | 327 | request.Method = httpMethod; |
318 | request.ContentType = httpMIMEType; | 328 | request.ContentType = httpMIMEType; |
329 | if (proxyurl.Length > 0) | ||
330 | { | ||
331 | if (proxyexcepts.Length > 0) { | ||
332 | string[] elist = proxyexcepts.Split(';'); | ||
333 | request.Proxy = new WebProxy(proxyurl,true,elist); | ||
334 | } else { | ||
335 | request.Proxy = new WebProxy(proxyurl,true); | ||
336 | } | ||
337 | } | ||
319 | 338 | ||
320 | foreach (KeyValuePair<string, string> entry in response_headers) | 339 | foreach (KeyValuePair<string, string> entry in response_headers) |
321 | request.Headers[entry.Key] = entry.Value; | 340 | request.Headers[entry.Key] = entry.Value; |