diff options
author | Melanie | 2012-01-14 05:28:57 +0100 |
---|---|---|
committer | Melanie | 2012-01-14 05:28:57 +0100 |
commit | 72247bdaef1cf76e4f51b41bc7413a0837f7a332 (patch) | |
tree | b25ab78a6ad267b4f8936c794635cc0c2734be5e | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-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.cs | 34 |
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; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Net; | 31 | using System.Net; |
32 | using System.Net.Mail; | ||
32 | using System.Net.Security; | 33 | using System.Net.Security; |
33 | using System.Text; | 34 | using System.Text; |
34 | using System.Threading; | 35 | using 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 |