diff options
author | Adam Frisby | 2008-04-30 21:43:47 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-30 21:43:47 +0000 |
commit | be20f41637b6c06ce3ab16bc25851b6e43468e12 (patch) | |
tree | c41081329891f4c24de704fc760fb9012954ac9d /OpenSim/Region/Environment/Modules/Scripting/HttpRequest | |
parent | * Sometimes you know, you do something really stupid. (diff) | |
download | opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.zip opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.gz opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.bz2 opensim-SC-be20f41637b6c06ce3ab16bc25851b6e43468e12.tar.xz |
* Cruft removal step #1. Cleaning Modules directory.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Scripting/HttpRequest')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 94 |
1 files changed, 51 insertions, 43 deletions
diff --git a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs index 4977a86..184e026 100644 --- a/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/Scripting/HttpRequest/ScriptsHttpRequests.cs | |||
@@ -84,45 +84,20 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
84 | { | 84 | { |
85 | public class HttpRequestModule : IRegionModule, IHttpRequests | 85 | public class HttpRequestModule : IRegionModule, IHttpRequests |
86 | { | 86 | { |
87 | private Scene m_scene; | ||
88 | private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); | ||
89 | private object HttpListLock = new object(); | 87 | private object HttpListLock = new object(); |
90 | private string m_name = "HttpScriptRequests"; | ||
91 | private int httpTimeout = 30000; | 88 | private int httpTimeout = 30000; |
89 | private string m_name = "HttpScriptRequests"; | ||
92 | 90 | ||
93 | // <request id, HttpRequestClass> | 91 | // <request id, HttpRequestClass> |
94 | private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests; | 92 | private Dictionary<LLUUID, HttpRequestClass> m_pendingRequests; |
93 | private Scene m_scene; | ||
94 | private Queue<HttpRequestClass> rpcQueue = new Queue<HttpRequestClass>(); | ||
95 | 95 | ||
96 | public HttpRequestModule() | 96 | public HttpRequestModule() |
97 | { | 97 | { |
98 | } | 98 | } |
99 | 99 | ||
100 | public void Initialise(Scene scene, IConfigSource config) | 100 | #region IHttpRequests Members |
101 | { | ||
102 | m_scene = scene; | ||
103 | |||
104 | m_scene.RegisterModuleInterface<IHttpRequests>(this); | ||
105 | |||
106 | m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>(); | ||
107 | } | ||
108 | |||
109 | public void PostInitialise() | ||
110 | { | ||
111 | } | ||
112 | |||
113 | public void Close() | ||
114 | { | ||
115 | } | ||
116 | |||
117 | public string Name | ||
118 | { | ||
119 | get { return m_name; } | ||
120 | } | ||
121 | |||
122 | public bool IsSharedModule | ||
123 | { | ||
124 | get { return true; } | ||
125 | } | ||
126 | 101 | ||
127 | public LLUUID MakeHttpRequest(string url, string parameters, string body) | 102 | public LLUUID MakeHttpRequest(string url, string parameters, string body) |
128 | { | 103 | { |
@@ -141,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
141 | if (parameters != null) | 116 | if (parameters != null) |
142 | { | 117 | { |
143 | string[] parms = parameters.ToArray(); | 118 | string[] parms = parameters.ToArray(); |
144 | for (int i = 0; i < parms.Length/2; i += 2) | 119 | for (int i = 0; i < parms.Length / 2; i += 2) |
145 | { | 120 | { |
146 | switch (Int32.Parse(parms[i])) | 121 | switch (Int32.Parse(parms[i])) |
147 | { | 122 | { |
@@ -187,7 +162,8 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
187 | 162 | ||
188 | public void StopHttpRequest(uint m_localID, LLUUID m_itemID) | 163 | public void StopHttpRequest(uint m_localID, LLUUID m_itemID) |
189 | { | 164 | { |
190 | if(m_pendingRequests != null) { | 165 | if (m_pendingRequests != null) |
166 | { | ||
191 | lock (HttpListLock) | 167 | lock (HttpListLock) |
192 | { | 168 | { |
193 | HttpRequestClass tmpReq; | 169 | HttpRequestClass tmpReq; |
@@ -243,36 +219,68 @@ namespace OpenSim.Region.Environment.Modules.Scripting.HttpRequest | |||
243 | } | 219 | } |
244 | } | 220 | } |
245 | 221 | ||
222 | #endregion | ||
223 | |||
224 | #region IRegionModule Members | ||
225 | |||
226 | public void Initialise(Scene scene, IConfigSource config) | ||
227 | { | ||
228 | m_scene = scene; | ||
229 | |||
230 | m_scene.RegisterModuleInterface<IHttpRequests>(this); | ||
231 | |||
232 | m_pendingRequests = new Dictionary<LLUUID, HttpRequestClass>(); | ||
233 | } | ||
234 | |||
235 | public void PostInitialise() | ||
236 | { | ||
237 | } | ||
238 | |||
239 | public void Close() | ||
240 | { | ||
241 | } | ||
242 | |||
243 | public string Name | ||
244 | { | ||
245 | get { return m_name; } | ||
246 | } | ||
247 | |||
248 | public bool IsSharedModule | ||
249 | { | ||
250 | get { return true; } | ||
251 | } | ||
252 | |||
253 | #endregion | ||
246 | } | 254 | } |
247 | 255 | ||
248 | public class HttpRequestClass | 256 | public class HttpRequestClass |
249 | { | 257 | { |
250 | // Constants for parameters | 258 | // Constants for parameters |
259 | public const int HTTP_BODY_MAXLENGTH = 2; | ||
251 | public const int HTTP_METHOD = 0; | 260 | public const int HTTP_METHOD = 0; |
252 | public const int HTTP_MIMETYPE = 1; | 261 | public const int HTTP_MIMETYPE = 1; |
253 | public const int HTTP_BODY_MAXLENGTH = 2; | ||
254 | public const int HTTP_VERIFY_CERT = 3; | 262 | public const int HTTP_VERIFY_CERT = 3; |
263 | public bool finished; | ||
264 | public int httpBodyMaxLen = 2048; // not implemented | ||
255 | 265 | ||
256 | // Parameter members and default values | 266 | // Parameter members and default values |
257 | public string httpMethod = "GET"; | 267 | public string httpMethod = "GET"; |
258 | public string httpMIMEType = "text/plain;charset=utf-8"; | 268 | public string httpMIMEType = "text/plain;charset=utf-8"; |
259 | public int httpBodyMaxLen = 2048; // not implemented | 269 | private Thread httpThread; |
270 | public int httpTimeout; | ||
260 | public bool httpVerifyCert = true; // not implemented | 271 | public bool httpVerifyCert = true; // not implemented |
261 | 272 | ||
262 | // Request info | 273 | // Request info |
263 | public uint localID; | ||
264 | public LLUUID itemID; | 274 | public LLUUID itemID; |
265 | public LLUUID reqID; | 275 | public uint localID; |
266 | public int httpTimeout; | ||
267 | public string url; | ||
268 | public string outbound_body; | ||
269 | public DateTime next; | 276 | public DateTime next; |
270 | public int status; | 277 | public string outbound_body; |
271 | public bool finished; | 278 | public LLUUID reqID; |
272 | public List<string> response_metadata; | ||
273 | public string response_body; | ||
274 | public HttpWebRequest request; | 279 | public HttpWebRequest request; |
275 | private Thread httpThread; | 280 | public string response_body; |
281 | public List<string> response_metadata; | ||
282 | public int status; | ||
283 | public string url; | ||
276 | 284 | ||
277 | public void process() | 285 | public void process() |
278 | { | 286 | { |