Comments (2)
It looks like a proxy is required to download the files in this package. It looks like chocolatey has a strategy for doing this in Get-WebFile.ps1 in the chocolatey repository.
I think we would have to implement something similar in our .NET code.
I have no immediate plans to look at this issue further but would accept a pull request if anyone wants to look at it.
from chocolatestore.
Nope, no proxy just two simple things need to occur:
- Set up TLS1.2 (the root cause of your failure above)
- MUST set the user-agent properly (if you had gotten this far, by default you would only get the SF page as your file without this)
To demonstrate this issue and the solution using dotnet in Powershell:
C:\temp »
λ $url='https://sourceforge.net/projects/mpcbe/files/MPC-BE/Release%20builds/1.5.1/MPC-BE.1.5.1.x64-installer.zip/download'
C:\temp »
λ $path='C:\Temp\MPC-BE.1.5.1.x64-installer.zip'
C:\temp »
λ Invoke-WebRequest -Uri $url -OutFile $path
[Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send.
At line:1 char:1
+ Invoke-WebRequest -Uri $url -OutFile $path
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], We
bException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand]
C:\temp »
λ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
C:\temp »
λ Invoke-WebRequest -Uri $url -OutFile $path
✘ [FAILURE: Successful download but upon opening .zip - it is really the Sourceforge HTML redirect page)]
C:\temp »
λ Invoke-WebRequest -Uri $url -OutFile $path -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
✔ 'SUCCESS: Fully usable/proper MPC-BE installer zip file!
So, in CSharp you would first do this:
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
...And then simply use any explicit useragent you want (best practice, anyway)....and along with the TLS there is no package you should not be able to download with the only single exception being the one-off's that need a very specific header sent with the request that is usually handled in the Powershell install, anyway.
EDIT
Might as well just post the code to fix it :)
I just compiled it to confirm it works, including with the very nicely done upstream fork from @sr258.
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls11 | System.Net.SecurityProtocolType.Tls12;
var request = (HttpWebRequest)WebRequest.Create(url);
((HttpWebRequest)request).UserAgent = "ChocolateStore";
from chocolatestore.
Related Issues (20)
- Improve readme. HOT 2
- Packages such as ProduKey and notepadplusplus HOT 7
- vlc not converting HOT 3
- Skype giving errors HOT 1
- Consider providing a built exe HOT 1
- Only download 64bit version installers
- Can't download URLs that require special headers, eg. audacity-lame
- Can't download URLs with $variables in them HOT 1
- How to approach downloading new versions
- libreoffice-fresh does not download .MSI file HOT 1
- ChocolateStore no longer works! Help! HOT 4
- System.UnauthorizedAccessException HOT 3
- adoptopenjdk8 does not install
- New implementation HOT 1
- Package download does not work when the URL is composed with variables in the powershell script. HOT 13
- Packages with dependencies are not supported
- how this is working exactly ? HOT 1
- Is it still working ? HOT 1
- + characters missing from stored ChocolateyInstall script HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chocolatestore.