diff --git a/lib/ansible/modules/windows/win_get_url.ps1 b/lib/ansible/modules/windows/win_get_url.ps1 index b7b1a1ed445..71a4d5751af 100644 --- a/lib/ansible/modules/windows/win_get_url.ps1 +++ b/lib/ansible/modules/windows/win_get_url.ps1 @@ -44,9 +44,9 @@ $skip_certificate_validation = Get-Attr $params "skip_certificate_validation" $f $username = Get-Attr $params "username" $password = Get-Attr $params "password" -$proxy_url = $params.proxy_url -$proxy_username = $params.proxy_username -$proxy_password = $params.proxy_password +$proxy_url = Get-Attr $params "proxy_url" +$proxy_username = Get-Attr $params "proxy_username" +$proxy_password = Get-Attr $params "proxy_password" if($skip_certificate_validation){ [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} @@ -56,8 +56,8 @@ $force = Get-Attr -obj $params -name "force" "yes" | ConvertTo-Bool If ($force -or -not (Test-Path $dest)) { $client = New-Object System.Net.WebClient - if($params.proxy_url) { - $proxy_url = $params.proxy_url + if($proxy_url) { + $proxy_server = New-Object System.Net.WebProxy($proxy_url, $true) if($proxy_username -and $proxy_password){ $proxy_credential = New-Object System.Net.NetworkCredential($proxy_username, $proxy_password) $proxy_server.Credentials = $proxy_credential diff --git a/lib/ansible/modules/windows/win_get_url.py b/lib/ansible/modules/windows/win_get_url.py index 1e2031170e1..26b0dc7b012 100644 --- a/lib/ansible/modules/windows/win_get_url.py +++ b/lib/ansible/modules/windows/win_get_url.py @@ -70,22 +70,16 @@ options: - The full URL of the proxy server to download through. version_added: "2.0" required: false - choices: null - default: null proxy_username: description: - Proxy authentication username version_added: "2.0" required: false - choices: null - default: null proxy_password: description: - Proxy authentication password version_added: "2.0" required: false - choices: null - default: null author: - "Paul Durivage (@angstwad)" - "Takeshi Kuramochi (tksarah)"