Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

Commit 57cd31d

Browse files
authored
Expose user defined proxy (#196)
* Expose Proxy to user * Added missing dependency.
1 parent d02c495 commit 57cd31d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

source/projects/MyCouch/ConnectionInfo.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Linq;
3+
using System.Net;
34
using EnsureThat;
45
using MyCouch.Net;
56

@@ -32,6 +33,7 @@ public abstract class ConnectionInfo
3233
public bool AllowAutoRedirect { get; set; } = false;
3334
public bool ExpectContinue { get; set; } = false;
3435
public bool UseProxy { get; set; } = true;
36+
public IWebProxy Proxy { get; set; } = null;
3537

3638
protected ConnectionInfo(Uri address)
3739
{
@@ -59,4 +61,4 @@ private string[] ExtractUserInfoPartsFrom(Uri address)
5961
.ToArray();
6062
}
6163
}
62-
}
64+
}

source/projects/MyCouch/Net/Connection.cs

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ protected virtual HttpClient CreateHttpClient(ConnectionInfo connectionInfo)
6262
AllowAutoRedirect = connectionInfo.AllowAutoRedirect,
6363
UseProxy = connectionInfo.UseProxy
6464
};
65+
handler.Proxy = connectionInfo.Proxy;
6566

6667
var client = new HttpClient(handler, true)
6768
{

0 commit comments

Comments
 (0)