mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Specify caching policy for XML/MSI downloads
Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
This commit is contained in:
parent
bfd99e1869
commit
44d4482513
@ -33,6 +33,7 @@ using System.ComponentModel;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Cache;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -84,6 +85,7 @@ namespace XenAdmin.Actions.Updates
|
|||||||
_client = new WebClient();
|
_client = new WebClient();
|
||||||
_client.DownloadProgressChanged += client_DownloadProgressChanged;
|
_client.DownloadProgressChanged += client_DownloadProgressChanged;
|
||||||
_client.DownloadFileCompleted += client_DownloadFileCompleted;
|
_client.DownloadFileCompleted += client_DownloadFileCompleted;
|
||||||
|
_client.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
|
||||||
|
|
||||||
// register event handler to detect changes in network connectivity
|
// register event handler to detect changes in network connectivity
|
||||||
NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged;
|
NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged;
|
||||||
|
@ -36,6 +36,7 @@ using System.Xml;
|
|||||||
using XenAdmin.Core;
|
using XenAdmin.Core;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Cache;
|
||||||
|
|
||||||
|
|
||||||
namespace XenAdmin.Actions
|
namespace XenAdmin.Actions
|
||||||
@ -356,6 +357,8 @@ namespace XenAdmin.Actions
|
|||||||
|
|
||||||
using (var webClient = new WebClient())
|
using (var webClient = new WebClient())
|
||||||
{
|
{
|
||||||
|
webClient.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
|
||||||
|
|
||||||
webClient.Proxy = proxy;
|
webClient.Proxy = proxy;
|
||||||
webClient.Headers.Add("User-Agent", _userAgent);
|
webClient.Headers.Add("User-Agent", _userAgent);
|
||||||
using (var stream = new MemoryStream(webClient.DownloadData(uriBuilder.Uri)))
|
using (var stream = new MemoryStream(webClient.DownloadData(uriBuilder.Uri)))
|
||||||
|
Loading…
Reference in New Issue
Block a user