23
23
using System . Threading . Tasks ;
24
24
using System . Linq ;
25
25
using System ;
26
+ using System . Net ;
26
27
using System . Threading ;
27
28
using System . Security . Cryptography . X509Certificates ;
28
29
using Confluent . Kafka ;
@@ -166,8 +167,12 @@ private static SubjectNameStrategyDelegate GetValueSubjectNameStrategy(
166
167
/// <param name="authenticationHeaderValueProvider">
167
168
/// The authentication header value provider
168
169
/// </param>
170
+ /// <param name="proxy">
171
+ /// The proxy server to use for connections
172
+ /// </param>
169
173
public CachedSchemaRegistryClient ( IEnumerable < KeyValuePair < string , string > > config ,
170
- IAuthenticationHeaderValueProvider authenticationHeaderValueProvider )
174
+ IAuthenticationHeaderValueProvider authenticationHeaderValueProvider ,
175
+ IWebProxy proxy = null )
171
176
{
172
177
if ( config == null )
173
178
{
@@ -352,13 +357,8 @@ public CachedSchemaRegistryClient(IEnumerable<KeyValuePair<string, string>> conf
352
357
}
353
358
354
359
var sslCaLocation = config . FirstOrDefault ( prop => prop . Key . ToLower ( ) == SchemaRegistryConfig . PropertyNames . SslCaLocation ) . Value ;
355
- if ( string . IsNullOrEmpty ( sslCaLocation ) )
356
- {
357
- this . restService = new RestService ( schemaRegistryUris , timeoutMs , authenticationHeaderValueProvider , SetSslConfig ( config ) , sslVerify ) ;
358
- } else
359
- {
360
- this . restService = new RestService ( schemaRegistryUris , timeoutMs , authenticationHeaderValueProvider , SetSslConfig ( config ) , sslVerify , new X509Certificate2 ( sslCaLocation ) ) ;
361
- }
360
+ var sslCaCertificate = string . IsNullOrEmpty ( sslCaLocation ) ? null : new X509Certificate2 ( sslCaLocation ) ;
361
+ this . restService = new RestService ( schemaRegistryUris , timeoutMs , authenticationHeaderValueProvider , SetSslConfig ( config ) , sslVerify , sslCaCertificate , proxy ) ;
362
362
}
363
363
364
364
/// <summary>
@@ -372,6 +372,20 @@ public CachedSchemaRegistryClient(IEnumerable<KeyValuePair<string, string>> conf
372
372
{
373
373
}
374
374
375
+ /// <summary>
376
+ /// Initialize a new instance of the SchemaRegistryClient class.
377
+ /// </summary>
378
+ /// <param name="config">
379
+ /// Configuration properties.
380
+ /// </param>
381
+ /// <param name="proxy">
382
+ /// The proxy server to use for connections
383
+ /// </param>
384
+ public CachedSchemaRegistryClient ( IEnumerable < KeyValuePair < string , string > > config , IWebProxy proxy )
385
+ : this ( config , null , proxy )
386
+ {
387
+
388
+ }
375
389
376
390
/// <remarks>
377
391
/// This is to make sure memory doesn't explode in the case of incorrect usage.
0 commit comments