Cannot add certain packages (proxy error)

Hallo Mikolas,

i had a similiar issue, i fixed it through patching BinaryProvider.jl (file PlatformEngines.jl starting line 248)

@static if Sys.iswindows()
        # For download engines, we will most likely want to use powershell.
        # Let's generate a functor to return the necessary powershell magics
        # to download a file, given a path to the powershell executable
        psh_download = (psh_path) -> begin
            return (url, path) -> begin
                webclient_code = """
                [System.Net.ServicePointManager]::SecurityProtocol =
                    [System.Net.SecurityProtocolType]::Tls12;
                \$webclient = (New-Object System.Net.Webclient);
                \$webclient.Proxy=[System.Net.WebProxy]::GetDefaultProxy();
                \$webclient.Proxy.Credentials=[net.credentialcache]::defaultcredentials;
                \$webclient.Headers.Add("user-agent", "$agent");
                \$webclient.DownloadFile("$url", "$path")
                """
                replace(webclient_code, "\n" => " ")
                return `$psh_path -NoProfile -Command "$webclient_code"`
            end
        end

The important lines are

 \$webclient.Proxy=[System.Net.WebProxy]::GetDefaultProxy();
 \$webclient.Proxy.Credentials=[net.credentialcache]::defaultcredentials;

this way BinaryProvider can access files through the proxy.

Hope it helps

Philipp

1 Like