Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
qutrits committed Sep 18, 2024
1 parent 101ec10 commit f3e3153
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Entities/ApiWebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected override WebRequest GetWebRequest(Uri address) {
BypassProxyOnLocal = false
};

if (Stats.EnableProxyAuthentication) {
if (Stats.EnableProxyAuthentication && !string.IsNullOrEmpty(Stats.ProxyUsername) && !string.IsNullOrEmpty(Stats.ProxyPassword)) {
webproxy.Credentials = new NetworkCredential(Stats.ProxyUsername, Stats.ProxyPassword);
}

Expand Down
13 changes: 13 additions & 0 deletions Entities/ZipWebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ protected override WebRequest GetWebRequest(Uri address) {
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(address);
request.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

if (Stats.UseWebProxy && Stats.SucceededTestProxy) {
WebProxy webproxy = new WebProxy($"{Stats.ProxyAddress}:{(!string.IsNullOrEmpty(Stats.ProxyPort) ? Stats.ProxyPort : "80")}", false) {
BypassProxyOnLocal = false
};

if (Stats.EnableProxyAuthentication && !string.IsNullOrEmpty(Stats.ProxyUsername) && !string.IsNullOrEmpty(Stats.ProxyPassword)) {
webproxy.Credentials = new NetworkCredential(Stats.ProxyUsername, Stats.ProxyPassword);
}

request.Proxy = webproxy;
}

return request;
}
}
Expand Down

0 comments on commit f3e3153

Please sign in to comment.