Skip to content

Commit

Permalink
Add chained HTTP Proxy constructor (minio#276)
Browse files Browse the repository at this point in the history
Fixes minio#273
  • Loading branch information
poornas authored and nitisht committed Jan 28, 2019
1 parent df3e540 commit db8313d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ __Secure Access__
|---|
|`Chain .WithSSL() to Minio Client object to use https instead of http. ` |

__Proxy__

| |
|---|
|`Chain .WithProxy(proxyObject) to Minio Client object to use proxy ` |

__Example__

Expand All @@ -78,6 +83,10 @@ MinioClient minioClient = new MinioClient("play.minio.io:9000",
accessKey:"Q3AM3UQ867SPQQA43P2F",
secretKey:"zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
).WithSSL();

// 3. Initializing minio client with proxy
IWebProxy proxy = new WebProxy("192.168.0.1",8000);
MinioClient minioClient = new MinioClient("my-ip-address:9000","minio","minio123").WithSSL().WithProxy(proxy);
```


Expand Down
11 changes: 11 additions & 0 deletions Minio/MinioClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public partial class MinioClient
// is the virtual style path or location based endpoint
internal string Endpoint { get; private set; }
internal string Region;

// Corresponding URI for above endpoint
internal Uri uri;

Expand Down Expand Up @@ -321,6 +322,16 @@ public MinioClient WithSSL()
SetTargetURL(secureUrl);
return this;
}

/// <summary>
/// Uses webproxy for all requests if this method is invoked on client object
/// </summary>
/// <returns></returns>
public MinioClient WithProxy(IWebProxy proxy)
{
this.restClient.Proxy = proxy;
return this;
}
/// <summary>
/// Sets endpoint URL on the client object that request will be made against
/// </summary>
Expand Down

0 comments on commit db8313d

Please sign in to comment.