aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2012-01-14 05:28:57 +0100
committerMelanie2012-01-14 05:28:57 +0100
commit72247bdaef1cf76e4f51b41bc7413a0837f7a332 (patch)
treeb25ab78a6ad267b4f8936c794635cc0c2734be5e /OpenSim
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-72247bdaef1cf76e4f51b41bc7413a0837f7a332.zip
opensim-SC-72247bdaef1cf76e4f51b41bc7413a0837f7a332.tar.gz
opensim-SC-72247bdaef1cf76e4f51b41bc7413a0837f7a332.tar.bz2
opensim-SC-72247bdaef1cf76e4f51b41bc7413a0837f7a332.tar.xz
Allow SmtpClients and other SSL users to work with our cert handler installed
Diffstat (limited to '')
-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 2fe36c1..9dac6b9 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