Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Recent change to Resolve-SystemNetWebRequest appears to have broken URL's returned for Sourceforge based Apps #669

Closed
2 tasks done
chezzer64 opened this issue May 2, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@chezzer64
Copy link

What happened?

When running the latest version of Evergreen module (2405.959) URI's returned for Sourceforge based apps seem to be incorrect. I think this may be as a result of recent changes to Resolve-SystemNetWebRequest to add UserAgent? The Sourceforge mirror is not getting resolved. Please see verbose output below for comparison.

Version

2405.959

What PowerShell edition/s are you running Evergreen on?

Windows PowerShell

Which operating system/s are you running Evergreen on?

Windows 10+

Have you reviewed the documentation?

Verbose output

Get-EvergreenApp -Name WinSCP -Verbose
VERBOSE: Function path: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2405.959\Apps\Get-WinSCP.ps1
VERBOSE: Function exists: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2405.959\Apps\Get-WinSCP.ps1.
VERBOSE: Dot sourcing: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2405.959\Apps\Get-WinSCP.ps1.
VERBOSE: Get-FunctionResource: read application resource strings from [C:\Program Files\WindowsPowerShell\Modules\Evergreen\2405.959\Manifests\WinSCP.json]
VERBOSE: Calling: Get-WinSCP.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UseBasicParsing: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: MaximumRedirection: 2.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: DisableKeepAlive: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.2478.67.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Method: Default.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Uri: https://sourceforge.net/projects/winscp/best_release.json.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: ContentType: application/json; charset=utf-8.
VERBOSE: GET https://sourceforge.net/projects/winscp/best_release.json with 0-byte payload
VERBOSE: received 3296-byte response of content type application/json; charset=utf-8
VERBOSE: Get-SourceForgeRepoRelease: Validating SourceForge release object.
VERBOSE: Get-SourceForgeRepoRelease: Property validation succeeded.
VERBOSE: Get-SourceForgeRepoRelease: Capture version number from: /WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe.
VERBOSE: Get-SourceForgeRepoRelease: Found filename: [WinSCP-6.3.3-Setup.exe].
VERBOSE: Get-SourceForgeRepoRelease: Found folder:   [/WinSCP/6.3.3/].
VERBOSE: Get-SourceForgeRepoRelease: Found version:  [6.3.3].
VERBOSE: Resolve-SystemNetWebRequest: Attempting to resolve: http://downloads.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe?ts=gAAAAABmMgl9a1Zt1kVMVnF_CIMgT-ibMKhz3cOXDbV7AWpXZ4HkCBN8q_KTi3Wgx53aLrwoSeUp7xdQIjPMWOIyiSczc9dc9g%3D%3D.
VERBOSE: Resolve-SystemNetWebRequest: Resolved to: [https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/download?use_mirror=cytranet-dal].
VERBOSE: Get-SourceForgeRepoRelease: Resolve mirror to: sourceforge.net.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UseBasicParsing: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: MaximumRedirection: 2.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: DisableKeepAlive: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.2478.67.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Method: Default.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Uri: https://sourceforge.net/projects/winscp/rss?path=/WinSCP/6.3.3/.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: ContentType: application/rss+xml; charset=utf-8.
VERBOSE: GET https://sourceforge.net/projects/winscp/rss?path=/WinSCP/6.3.3/ with 0-byte payload
VERBOSE: received 7236-byte response of content type application/rss+xml; charset=utf-8
VERBOSE: Get-SourceForgeRepoRelease: found 2 items.
VERBOSE: Get-SourceForgeRepoRelease: matched: https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3.msi/download.
VERBOSE: Get-SourceForgeRepoRelease: file: /WinSCP/6.3.3/WinSCP-6.3.3.msi
VERBOSE: Get-Architecture: Architecture not found in https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/WinSCP-6.3.3.msi, defaulting to x86.
VERBOSE: Get-SourceForgeRepoRelease: matched: https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/download.
VERBOSE: Get-SourceForgeRepoRelease: file: /WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe
VERBOSE: Get-Architecture: Architecture not found in https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/WinSCP-6.3.3-Setup.exe, defaulting to x86.


Version      : 6.3.3
Architecture : x86
Type         : exe
Size         : 11588560
Md5          : 91dbb70daebfd07c13cc7bf5bb8898a0
URI          : https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/WinSCP-6.3.3-Setup.exe

Version      : 6.3.3
Architecture : x86
Type         : msi
Size         : 27959296
Md5          : 1289dddf9fceb42565a4d3bf70862427
URI          : https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/WinSCP-6.3.3.msi
@chezzer64 chezzer64 added the bug Something isn't working label May 2, 2024
@chezzer64
Copy link
Author

Here is a sample of the correct URI's being returned when running Evergreen 2404.928

Get-EvergreenApp -name winscp -verbose
VERBOSE: Function path: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2404.928\Apps\Get-winscp.ps1
VERBOSE: Function exists: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2404.928\Apps\Get-winscp.ps1.
VERBOSE: Dot sourcing: C:\Program Files\WindowsPowerShell\Modules\Evergreen\2404.928\Apps\Get-winscp.ps1.
VERBOSE: Get-FunctionResource: read application resource strings from [C:\Program Files\WindowsPowerShell\Modules\Evergreen\2404.928\Manifests\winscp.json]
VERBOSE: Calling: Get-winscp.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UseBasicParsing: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: MaximumRedirection: 2.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: DisableKeepAlive: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0..
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Method: Default.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Uri: https://sourceforge.net/projects/winscp/best_release.json.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: ContentType: application/json; charset=utf-8.
VERBOSE: GET https://sourceforge.net/projects/winscp/best_release.json with 0-byte payload
VERBOSE: received 3296-byte response of content type application/json; charset=utf-8
VERBOSE: Get-SourceForgeRepoRelease: Validating SourceForge release object.
VERBOSE: Get-SourceForgeRepoRelease: Property validation succeeded.
VERBOSE: Get-SourceForgeRepoRelease: Capture version number from: /WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe.
VERBOSE: Get-SourceForgeRepoRelease: Found filename: [WinSCP-6.3.3-Setup.exe].
VERBOSE: Get-SourceForgeRepoRelease: Found folder:   [/WinSCP/6.3.3/].
VERBOSE: Get-SourceForgeRepoRelease: Found version:  [6.3.3].
VERBOSE: Resolve-SystemNetWebRequest: Attempting to resolve:
http://downloads.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe?ts=gAAAAABmMgl9a1Zt1kVMVnF_CIMgT-ibMKhz3cOXDbV7AWpXZ4HkCBN8q_KTi3Wgx53aLrwoSeUp7xdQIjPMWOIyiSczc9dc9g%3D%3D.
VERBOSE: Resolve-SystemNetWebRequest: Resolved to: [http://kumisystems.dl.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe?viasf=1].
VERBOSE: Get-SourceForgeRepoRelease: Resolve mirror to: kumisystems.dl.sourceforge.net.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UseBasicParsing: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: MaximumRedirection: 2.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: DisableKeepAlive: True.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0..
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Method: Default.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: Uri: https://sourceforge.net/projects/winscp/rss?path=/WinSCP/6.3.3/.
VERBOSE: Invoke-EvergreenRestMethod: Invoke-RestMethod parameter: ContentType: application/rss+xml; charset=utf-8.
VERBOSE: GET https://sourceforge.net/projects/winscp/rss?path=/WinSCP/6.3.3/ with 0-byte payload
VERBOSE: received 7236-byte response of content type application/rss+xml; charset=utf-8
VERBOSE: Get-SourceForgeRepoRelease: found 2 items.
VERBOSE: Get-SourceForgeRepoRelease: matched: https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3.msi/download.
VERBOSE: Get-SourceForgeRepoRelease: file: /WinSCP/6.3.3/WinSCP-6.3.3.msi
VERBOSE: Get-Architecture: Architecture not found in https://kumisystems.dl.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3.msi, defaulting to x86.
VERBOSE: Get-SourceForgeRepoRelease: matched: https://sourceforge.net/projects/winscp/files/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe/download.
VERBOSE: Get-SourceForgeRepoRelease: file: /WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe
VERBOSE: Get-Architecture: Architecture not found in https://kumisystems.dl.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe, defaulting to x86.


Version      : 6.3.3
Architecture : x86
Type         : exe
Size         : 11588560
Md5          : 91dbb70daebfd07c13cc7bf5bb8898a0
URI          : https://kumisystems.dl.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3-Setup.exe

Version      : 6.3.3
Architecture : x86
Type         : msi
Size         : 27959296
Md5          : 1289dddf9fceb42565a4d3bf70862427
URI          : https://kumisystems.dl.sourceforge.net/project/winscp/WinSCP/6.3.3/WinSCP-6.3.3.msi

@DanGough
Copy link
Contributor

DanGough commented May 2, 2024

Hmm, I may have to modify my PsDownload code to try a blank user agent first:

image

@aaronparker
Copy link
Owner

I've updated Resolve-SystemNetWebRequest and Get-SourceForgeRepoRelease to not send a user agent, so it should now resolve the right URL

Version Architecture Type Size    Md5                              URI
------- ------------ ---- ----    ---                              ---
23.01   x86          exe  584704  58fc6de6c4e5d2fda63565d54feb9e75 https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7zr.exe
23.01   x64          msi  1933312 7025502de20d7b39fb06870ab06d015b https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7z2301-x64.msi
23.01   x64          exe  1589510 e5788b13546156281bf0a4b38bdd0901 https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7z2301-x64.exe
23.01   ARM64        exe  1527518 3c5917f4da614ef892f055c697744b77 https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7z2301-arm64.exe
23.01   ARM32        exe  1596691 d98f54ca52882376fd8b39b29628a90a https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7z2301-arm.exe
23.01   x86          msi  1501184 49780e0517aa248e7fd90f50674a2645 https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7z2301.msi
23.01   x86          exe  1301195 1cfb215a6fb373ac33a38b1db320c178 https://ixpeering.dl.sourceforge.net/project/sevenzip/7-Zip/23.01/7z2301.exe

aaronparker added a commit that referenced this issue May 3, 2024
Update Get-SourceForgeRepoRelease to not send a user agent so that the right download URL is resolved
@aaronparker aaronparker mentioned this issue May 4, 2024
@xenadmin
Copy link

xenadmin commented May 4, 2024

Thank you very much for the very fast fix! I wasn't able to install 7-Zip and WinSCP Friday.
Do you have an ETA for when the fix will be GA? No pressure! Just curious.

@aaronparker
Copy link
Owner

Pushed to the PowerShell gallery just now

@xenadmin
Copy link

xenadmin commented May 6, 2024

Evergreen Version 2405.994

Something is still off for me. On Azure VMs a command like this, for 7-zip and WinSCP, always results in a 100KB exe file, that is malformed and/or broken.

$Evergreen = Get-EvergreenApp -Name 7zip | Where-Object { $_.Architecture -eq 'x64' -and $_.Type -eq 'exe' }
Save-EvergreenApp -InputObject $Evergreen -CustomPath "D:\Temp\"
$Evergreen = Get-Evergreenapp -Name WinSCP | Where-Object { $_.Type -eq "exe" } | Select-Object -First 1
Save-EvergreenApp -InputObject $Evergreen -CustomPath "D:\Temp\"

Any ideas?
I have the feeling, it's not an Evergreen, but an Sourceforge issue. Because it works sometimes, but more ofter it fails. Maybe depending on the Sourceforge Hoster?

@aaronparker
Copy link
Owner

The issue could be with Save-EvergreenApp which sends a user agent. I'll test with it not sending a user agent for SourceForge.

Have I mentioned how much I dislike SourceForge?

@aaronparker
Copy link
Owner

I have also been wondering whether Evergreen should normalise the SourceForge URLs with a single host name, instead of returning one of the mirrors each time.

@aaronparker
Copy link
Owner

See #677 re:SourceForge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants