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 | |
parent | * minor: remove mono compiler warning (diff) | |
download | opensim-SC-28820e618502beac65f246e00509d845dbdfe5ba.zip opensim-SC-28820e618502beac65f246e00509d845dbdfe5ba.tar.gz opensim-SC-28820e618502beac65f246e00509d845dbdfe5ba.tar.bz2 opensim-SC-28820e618502beac65f246e00509d845dbdfe5ba.tar.xz |
Thanks cmickyb for a patch (Mantis#3089) that adds support for proxy in http requests
Diffstat (limited to '')
3 files changed, 39 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); |
diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 481cbbf..e950c12 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example | |||
@@ -7,6 +7,10 @@ | |||
7 | ; (eg default is /opensimdir/crashes/*.txt or C:\opensim\crashes\*.txt) | 7 | ; (eg default is /opensimdir/crashes/*.txt or C:\opensim\crashes\*.txt) |
8 | crash_dir = "crashes" | 8 | crash_dir = "crashes" |
9 | 9 | ||
10 | ; Http proxy support for llHTTPRequest and dynamic texture loading | ||
11 | HttpProxy = "http://proxy.com" | ||
12 | HttpProxyExceptions = ".mydomain.com;localhost" | ||
13 | |||
10 | ; Set this to true if you are connecting your OpenSimulator regions to a grid | 14 | ; Set this to true if you are connecting your OpenSimulator regions to a grid |
11 | ; Set this to false if you are running OpenSimulator in standalone mode | 15 | ; Set this to false if you are running OpenSimulator in standalone mode |
12 | gridmode = false | 16 | gridmode = false |