Http.fs icon indicating copy to clipboard operation
Http.fs copied to clipboard

Self signed

Open haf opened this issue 6 years ago • 1 comments

https://gist.github.com/benhysell/10c1eb546bd3401ee50f https://stackoverflow.com/questions/28406226/how-to-import-private-key-of-self-signed-certificate-using-certmgr-in-mono#31330399

haf avatar Apr 26 '18 11:04 haf

Not sure if related or this will help you @haf

The way I do this at the moment is something like:

use dangerousHttpHandler =
    new HttpClientHandler(
        // check:
        // https://github.com/dotnet/corefx/issues/24774
        // https://github.com/dotnet/corefx/issues/19709
        ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator)

let dangerousHttpClient = new HttpClient (dangerousHttpHandler)

let createDangerousRequest (method: HttpMethod) (url: string) =
    new Uri (url)
    |> Request.createWithClient dangerousHttpClient method

let request =
    "https://localhost" // self-signed
    |> createDangerousRequest Get

There could be more functions baked into Http.Fs to make it less cumbersome but the API surface is flexible enough.

seanamos avatar Apr 26 '18 15:04 seanamos