download: greedy pattern in effective filename computation
The effective filename taken into account for Adoptium is the second header received:
HTTP/1.1 307 Temporary Redirect
Date: Fri, 01 Oct 2021 04:22:21 GMT
Content-Type: application/octet-stream
Connection: keep-alive
Location: https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz
HTTP/2 302
server: GitHub.com
date: Fri, 01 Oct 2021 04:22:21 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Accept-Encoding, Accept, X-Requested-With
permissions-policy: interest-cohort=()
location: https://github-releases.githubusercontent.com/372925054/23f6f1a0-cdcf-4e0b-ba2a-a3c64c6dc46a?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20211001%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20211001T042221Z&X-Amz-Expires=300&X-Amz-Signature=f8067d5b6aaadaa372919ab9e64c38d8d85d0cb953688f9767c4fefd0bc43d9a&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=372925054&response-content-disposition=attachment%3B%20filename%3DOpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz&response-content-type=application%2Foctet-stream
cache-control: no-cache
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
expect-ct: max-age=2592000, report-uri="https://api.github.com/_private/browser/errors"
content-security-policy: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src github.com/javascripts/worker/ gist.github.com/javascripts/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.githubapp.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com cdn.optimizely.com logx.optimizely.com/v1/events translator.github.com wss://alive.github.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com online.visualstudio.com/api/v1/locations raw.githubusercontent.com github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com; frame-ancestors 'none'; frame-src render.githubusercontent.com viewscreen.githubusercontent.com viewscreen-lab.githubusercontent.com; img-src 'self' data: github.githubassets.com identicons.github.com collector.githubapp.com github-cloud.s3.amazonaws.com secured-user-images.githubusercontent.com/ *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; worker-src github.com/javascripts/worker/ gist.github.com/javascripts/worker/ github.com/socket-worker-0af8a29d.js gist.github.com/socket-worker-0af8a29d.js
content-length: 656
x-github-request-id: BAD4:5B8E:450B4A:49321E:61568CFD
HTTP/2 200
x-amz-id-2: oIEwynAUgdjEPLc2zMoH1bzUhYtWbn4guM2LCAWM7tIZG3ldt9h4Kkti7ars+q5z9JahvBowgxQ=
x-amz-request-id: 23D9SN3566EQKY3W
last-modified: Fri, 30 Jul 2021 17:08:31 GMT
etag: "4b1d904c0e1115c4305dded853665904"
content-disposition: attachment; filename=OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz
content-type: application/octet-stream
server: AmazonS3
via: 1.1 varnish, 1.1 varnish
accept-ranges: bytes
age: 0
date: Fri, 01 Oct 2021 04:22:21 GMT
x-served-by: cache-dca17769-DCA, cache-cdg20721-CDG
x-cache: MISS, MISS
x-cache-hits: 0, 0
strict-transport-security: max-age=31536000
x-fastly-request-id: 8ccc026984f5167fcac0a4add362217f41cee2dd
content-length: 205463525
Then the download fails.
Edited by Pierre-Yves Fourmond