File tree 3 files changed +18
-0
lines changed
3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 30
30
31
31
#if FRAMEWORK
32
32
using System . Net . Cache ;
33
+ using System . Net . Security ;
33
34
using System . Security . Cryptography . X509Certificates ;
34
35
using System . Text . RegularExpressions ;
35
36
#endif
@@ -208,6 +209,12 @@ public Encoding Encoding
208
209
/// </summary>
209
210
public RequestCachePolicy CachePolicy { get ; set ; }
210
211
#endif
212
+ #if NET45
213
+ /// <summary>
214
+ /// Callback function for handling the validation of remote certificates.
215
+ /// </summary>
216
+ public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get ; set ; }
217
+ #endif
211
218
212
219
/// <summary>
213
220
/// Default constructor
Original file line number Diff line number Diff line change 24
24
25
25
#if FRAMEWORK
26
26
using System . Net . Cache ;
27
+ using System . Net . Security ;
27
28
using System . Security . Cryptography . X509Certificates ;
28
29
#endif
29
30
@@ -129,6 +130,9 @@ public interface IHttp
129
130
HttpResponse AsGet ( string httpMethod ) ;
130
131
131
132
IWebProxy Proxy { get ; set ; }
133
+ #endif
134
+ #if NET45
135
+ RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get ; set ; }
132
136
#endif
133
137
}
134
138
}
Original file line number Diff line number Diff line change @@ -118,6 +118,10 @@ public partial class RestClient : IRestClient
118
118
public bool PreAuthenticate { get ; set ; }
119
119
120
120
#if NET45
121
+ /// <summary>
122
+ /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
123
+ /// overriding certificate errors in the scope of a request.
124
+ /// </summary>
121
125
public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get ; set ; }
122
126
#endif
123
127
@@ -544,6 +548,9 @@ private void ConfigureHttp(IRestRequest request, IHttp http)
544
548
}
545
549
#if FRAMEWORK
546
550
this . ConfigureProxy ( http ) ;
551
+ #endif
552
+ #if NET45
553
+ http . RemoteCertificateValidationCallback = this . RemoteCertificateValidationCallback ;
547
554
#endif
548
555
}
549
556
You can’t perform that action at this time.
0 commit comments