aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDahlia Trimble2009-02-06 01:25:59 +0000
committerDahlia Trimble2009-02-06 01:25:59 +0000
commit28820e618502beac65f246e00509d845dbdfe5ba (patch)
tree1b406beba1250cca9d07d07c18752d4013939e76 /OpenSim/Region
parent* minor: remove mono compiler warning (diff)
downloadopensim-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')
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs19
-rw-r--r--OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs16
2 files changed, 35 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;
diff --git a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
index eeeb3ca..3d0afd1 100644
--- a/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
+++ b/OpenSim/Region/Environment/Modules/Scripting/LoadImageURL/LoadImageURLModule.cs
@@ -43,6 +43,10 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
43 private Scene m_scene; 43 private Scene m_scene;
44 private IDynamicTextureManager m_textureManager; 44 private IDynamicTextureManager m_textureManager;
45 45
46 private string m_proxyurl = "";
47 private string m_proxyexcepts = "";
48
49
46 #region IDynamicTextureRender Members 50 #region IDynamicTextureRender Members
47 51
48 public string GetName() 52 public string GetName()
@@ -91,6 +95,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
91 { 95 {
92 m_scene = scene; 96 m_scene = scene;
93 } 97 }
98 m_proxyurl = config.Configs["Startup"].GetString("HttpProxy");
99 m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions");
94 } 100 }
95 101
96 public void PostInitialise() 102 public void PostInitialise()
@@ -121,6 +127,16 @@ namespace OpenSim.Region.Environment.Modules.Scripting.LoadImageURL
121 private void MakeHttpRequest(string url, UUID requestID) 127 private void MakeHttpRequest(string url, UUID requestID)
122 { 128 {
123 WebRequest request = HttpWebRequest.Create(url); 129 WebRequest request = HttpWebRequest.Create(url);
130 if (m_proxyurl.Length > 0)
131 {
132 if (m_proxyexcepts.Length > 0) {
133 string[] elist = m_proxyexcepts.Split(';');
134 request.Proxy = new WebProxy(m_proxyurl,true,elist);
135 } else {
136 request.Proxy = new WebProxy(m_proxyurl,true);
137 }
138 }
139
124 RequestState state = new RequestState((HttpWebRequest) request, requestID); 140 RequestState state = new RequestState((HttpWebRequest) request, requestID);
125 // IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 141 // IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);
126 request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); 142 request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state);