Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mayuki committed Dec 11, 2024
1 parent e4523b7 commit 7c764fc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ Once the handler sends a request, these settings become immutable and cannot be
|MaxIdlePerHost|Gets or sets the maximum idle connection per host allowed in the pool. Default is usize::MAX (no limit).|
|Http2Only|Gets or sets a value that indicates whether to force the use of HTTP/2.|
|SkipCertificateVerification|Gets or sets a value that indicates whether to skip certificate verification.|
|OnVerifyServerCertificate|Gets or sets a custom handler that validates server certificates.|
|RootCertificates|Gets or sets a custom root CA. By default, the built-in root CA (Mozilla's root certificates) is used. See also https://github.com/rustls/webpki-roots. |
|ClientAuthCertificates|Gets or sets a custom client auth key.|
|ClientAuthKey|Gets or sets a custom client auth certificates.|
Expand Down Expand Up @@ -280,6 +281,20 @@ using var handler = new YetAnotherHttpHandler() { RootCertificates = rootCerts }
### Ignore certificate validation errors
We strongly not recommend this, but in some cases, you may want to skip certificate validation when connecting via HTTPS. In this scenario, you can ignore certificate errors by setting the `SkipCertificateVerification` property to `true`.

### Handling server certificate verification
You can customize the server certificate verification process by setting the `OnVerifyServerCertificate` property.

```csharp
using var httpHandler = new YetAnotherHttpHandler()
{
OnVerifyServerCertificate = (serverName, certificate, now) =>
{
var cert = new X509Certificate2(certificate);
return serverName == "api.example.com" &&
cert.Subject == "CN=api.example.com";
}
};
```

## Development
### Build & Tests
Expand Down

0 comments on commit 7c764fc

Please sign in to comment.