aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting/HttpRequest
diff options
context:
space:
mode:
authorE. Allen Soard2011-04-08 18:30:20 -0700
committerJustin Clark-Casey (justincc)2011-04-11 22:22:11 +0100
commit464fa45ec90767af13bd8edcc7c67de4ec3db6a7 (patch)
treef2aac3107f948c9e4d185984eeb25bdef63f1bda /OpenSim/Region/CoreModules/Scripting/HttpRequest
parentslightly tweak OpenSim.ini.example text (diff)
downloadopensim-SC_OLD-464fa45ec90767af13bd8edcc7c67de4ec3db6a7.zip
opensim-SC_OLD-464fa45ec90767af13bd8edcc7c67de4ec3db6a7.tar.gz
opensim-SC_OLD-464fa45ec90767af13bd8edcc7c67de4ec3db6a7.tar.bz2
opensim-SC_OLD-464fa45ec90767af13bd8edcc7c67de4ec3db6a7.tar.xz
Implimented HTTP_VERIFY_CERT for llHttpRequest
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting/HttpRequest')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs34
1 files changed, 31 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index d78931a..a37c781 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -29,8 +29,10 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using System.Net; 31using System.Net;
32using System.Net.Security;
32using System.Text; 33using System.Text;
33using System.Threading; 34using System.Threading;
35using System.Security.Cryptography.X509Certificates;
34using Nini.Config; 36using Nini.Config;
35using OpenMetaverse; 37using OpenMetaverse;
36using OpenSim.Framework; 38using OpenSim.Framework;
@@ -84,6 +86,7 @@ using OpenSim.Region.Framework.Scenes;
84 86
85namespace OpenSim.Region.CoreModules.Scripting.HttpRequest 87namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
86{ 88{
89
87 public class HttpRequestModule : IRegionModule, IHttpRequestModule 90 public class HttpRequestModule : IRegionModule, IHttpRequestModule
88 { 91 {
89 private object HttpListLock = new object(); 92 private object HttpListLock = new object();
@@ -100,8 +103,23 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
100 103
101 public HttpRequestModule() 104 public HttpRequestModule()
102 { 105 {
106 ServicePointManager.ServerCertificateValidationCallback +=ValidateServerCertificate;
103 } 107 }
104 108
109 public static bool ValidateServerCertificate(
110 object sender,
111 X509Certificate certificate,
112 X509Chain chain,
113 SslPolicyErrors sslPolicyErrors)
114 {
115 HttpWebRequest Request = (HttpWebRequest)sender;
116
117 if(Request.Headers.Get("NoVerifyCert") != null)
118 {
119 return true;
120 }
121 return chain.Build(new X509Certificate2(certificate));
122 }
105 #region IHttpRequestModule Members 123 #region IHttpRequestModule Members
106 124
107 public UUID MakeHttpRequest(string url, string parameters, string body) 125 public UUID MakeHttpRequest(string url, string parameters, string body)
@@ -141,8 +159,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
141 break; 159 break;
142 160
143 case (int)HttpRequestConstants.HTTP_VERIFY_CERT: 161 case (int)HttpRequestConstants.HTTP_VERIFY_CERT:
144 162 htc.HttpVerifyCert = (int.Parse(parms[i + 1]) != 0);
145 // TODO implement me
146 break; 163 break;
147 } 164 }
148 } 165 }
@@ -282,7 +299,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
282 public string HttpMethod = "GET"; 299 public string HttpMethod = "GET";
283 public string HttpMIMEType = "text/plain;charset=utf-8"; 300 public string HttpMIMEType = "text/plain;charset=utf-8";
284 public int HttpTimeout; 301 public int HttpTimeout;
285 // public bool HttpVerifyCert = true; // not implemented 302 public bool HttpVerifyCert = true; // not implemented
286 private Thread httpThread; 303 private Thread httpThread;
287 304
288 // Request info 305 // Request info
@@ -344,6 +361,17 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
344 Request.Method = HttpMethod; 361 Request.Method = HttpMethod;
345 Request.ContentType = HttpMIMEType; 362 Request.ContentType = HttpMIMEType;
346 363
364 if(!HttpVerifyCert)
365 {
366 // Connection Group Name is probably not used so we hijack it to identify
367 // a desired security exception
368// Request.ConnectionGroupName="NoVerify";
369 Request.Headers.Add("NoVerifyCert" , "true");
370 }
371// else
372// {
373// Request.ConnectionGroupName="Verify";
374// }
347 if (proxyurl != null && proxyurl.Length > 0) 375 if (proxyurl != null && proxyurl.Length > 0)
348 { 376 {
349 if (proxyexcepts != null && proxyexcepts.Length > 0) 377 if (proxyexcepts != null && proxyexcepts.Length > 0)