Giter Site home page Giter Site logo

Comments (3)

foodaemon avatar foodaemon commented on May 22, 2024

Since i did not got any replies i decided to hack it and add the following configuration. Please let me know if its a good idea.

Created a following method on RavenClient.cs

private static bool ValidateRemoteCertificate(object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors policyErrors)
{
if (Convert.ToBoolean(ConfigurationManager.AppSettings["IgnoreSslErrors"]))
{
return true;
}
else
{
return policyErrors == SslPolicyErrors.None;
}
}

Added the following line to Send(JsonPacket packet, Dsn dns) method:
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(ValidateRemoteCertificate);

Added the following to the web.config in appSettings
add key="IgnoreSslErrors" value="true"

from raven-csharp.

asbjornu avatar asbjornu commented on May 22, 2024

The idea is fine, I'm just not too fond of the implementation. Magic configuration settings like that are both hard to discover and test. It would probably be better with a public property on the RavenClient class, either a Boolean or perhaps a ServerCertificateValidationCallback to provide full control.

from raven-csharp.

asbjornu avatar asbjornu commented on May 22, 2024

Since ServicePointManager.ServerCertificateValidationCallback is a static event that applies to all SSL connections within the thread, you can just do the following anywhere inside your application:

ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, policyErrors) =>
{
    if (Convert.ToBoolean(ConfigurationManager.AppSettings["IgnoreSslErrors"]))
        return true;

    return policyErrors == SslPolicyErrors.None;
};

I don't see why we need to include any functionality around this within RavenClient. I'm therefore closing this. Feel free to reopen if you have anything to add. Thanks! 😄

from raven-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.