aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-01-14 05:28:57 +0100
committerMelanie2012-01-14 06:03:27 +0000
commitec299bfa878498713e4538f825fd3a2ca92cd125 (patch)
tree6425451f702271d948f6c09bda136ccef85fb650 /OpenSim/Region
parentExtend scripts show command to accept a single item UUID parameter to display... (diff)
downloadopensim-SC_OLD-ec299bfa878498713e4538f825fd3a2ca92cd125.zip
opensim-SC_OLD-ec299bfa878498713e4538f825fd3a2ca92cd125.tar.gz
opensim-SC_OLD-ec299bfa878498713e4538f825fd3a2ca92cd125.tar.bz2
opensim-SC_OLD-ec299bfa878498713e4538f825fd3a2ca92cd125.tar.xz
Allow SmtpClients and other SSL users to work with our cert handler installed
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs34
1 files changed, 25 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 8fb5d75..d328eb3 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -29,6 +29,7 @@ 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.Mail;
32using System.Net.Security; 33using System.Net.Security;
33using System.Text; 34using System.Text;
34using System.Threading; 35using System.Threading;
@@ -111,21 +112,36 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
111 X509Chain chain, 112 X509Chain chain,
112 SslPolicyErrors sslPolicyErrors) 113 SslPolicyErrors sslPolicyErrors)
113 { 114 {
114 HttpWebRequest Request = (HttpWebRequest)sender; 115 // If this is a web request we need to check the headers first
115 116 // We may want to ignore SSL
116 if (Request.Headers.Get("NoVerifyCert") != null) 117 if (sender is HttpWebRequest)
117 { 118 {
119 HttpWebRequest Request = (HttpWebRequest)sender;
120 ServicePoint sp = Request.ServicePoint;
121
122 // We don't case about encryption, get out of here
123 if (Request.Headers.Get("NoVerifyCert") != null)
124 {
125 return true;
126 }
127
128 // If there was an upstream cert verification error, bail
129 if ((((int)sslPolicyErrors) & ~4) != 0)
130 return false;
131
132 // Check for policy and execute it if defined
133 if (ServicePointManager.CertificatePolicy != null)
134 {
135 return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0);
136 }
137
118 return true; 138 return true;
119 } 139 }
120 140
141 // If it's not HTTP, trust .NET to check it
121 if ((((int)sslPolicyErrors) & ~4) != 0) 142 if ((((int)sslPolicyErrors) & ~4) != 0)
122 return false; 143 return false;
123 144
124 if (ServicePointManager.CertificatePolicy != null)
125 {
126 ServicePoint sp = Request.ServicePoint;
127 return ServicePointManager.CertificatePolicy.CheckValidationResult (sp, certificate, Request, 0);
128 }
129 return true; 145 return true;
130 } 146 }
131 #region IHttpRequestModule Members 147 #region IHttpRequestModule Members