aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2018-08-04 11:32:32 +0200
committerAnders Broman <a.broman58@gmail.com>2018-08-04 18:58:50 +0000
commit2f1df0482a98d65eef81b69eed4d9ab058676397 (patch)
tree1b15620237438b2bfb570635610f5fbc5cccab8e /tools
parent5c474bdef11d4650d39b6242c5c0d1c7877673a7 (diff)
win-setup.ps1: make downloads faster by reusing proxy information
The initial proxy bypass check can take a lot of time (14 seconds). Cache the instance to make subsequent downloads faster. Change-Id: I3ccb99d245e0127f03d9b022d10f9ce4a89018d2 Fixes: v1.99.6rc0-344-ge3785f7aff ("win-setup.ps1 Make setup script aware of proxies") Reviewed-on: https://code.wireshark.org/review/28953 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/win-setup.ps19
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/win-setup.ps1 b/tools/win-setup.ps1
index 823181268e..99edac5498 100644
--- a/tools/win-setup.ps1
+++ b/tools/win-setup.ps1
@@ -196,6 +196,7 @@ $CleanupItems = @(
[Uri] $DownloadPrefix = "https://anonsvn.wireshark.org/wireshark-$($Platform)-libs/tags/$($CurrentTag)/packages"
$Global:SevenZip = "7-zip-not-found"
+$proxy = $null
# Functions
@@ -209,12 +210,14 @@ function DownloadFile($fileName, [Uri] $fileUrl = $null) {
return
}
- $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
- $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
+ if (-not ($Script:proxy)) {
+ $Script:proxy = [System.Net.WebRequest]::GetSystemWebProxy()
+ $Script:proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
+ }
Write-Output "Downloading $fileUrl into $Destination"
$webClient = New-Object System.Net.WebClient
- $webClient.proxy = $proxy
+ $webClient.proxy = $Script:proxy
$webClient.DownloadFile($fileUrl, "$Destination\$destinationFile")
}