Bug 1472847

Summary: dnf install dosn't handle 'Location:' http header
Product: [Fedora] Fedora Reporter: jniederm
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: low    
Version: 26CC: dmach, jmracek, mhatina, packaging-team-maint, rpm-software-management, sonny, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-2.7.3-1.fc26 dnf-2.7.3-1.fc27 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-08 08:27:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description jniederm 2017-07-19 14:01:06 UTC
Description of problem:
When installing a package from http location, `dnf install` doesn't handle http redirection expressed by 'Location:' http header.

Version-Release number of selected component (if applicable):
dnf-2.5.1-1.fc26.noarch

How reproducible:
100%

Steps to Reproduce:
1. dnf install https://atom.io/download/rpm

Actual results:
Last metadata expiration check: 0:06:52 ago on Wed Jul 19 13:04:23 2017.
No package https://atom.io/download/rpm available.
Error: Unable to find a match

Expected results:
package is offered for installation with resolved dependencies

Additional info:
it works with manually resolver url: dnf install 'https://atom-installer.github.com/v1.18.0/atom.x86_64.rpm?s=1497483731&ext=.rpm'

$ http https://atom.io/download/rpmHTTP/1.1 302 Found
Cache-Control: no-cache
Connection: close
Content-Security-Policy: default-src 'self'; connect-src 'self'; font-src https://github-atom-io-herokuapp-com.global.ssl.fastly.net; frame-src 'self' https://www.youtube.com; img-src https://* 'self' https://github-atom-io-herokuapp-com.global.ssl.fastly.net data:; media-src 'self'; object-src 'self' https://github-atom-io-herokuapp-com.global.ssl.fastly.net; script-src 'self' 'unsafe-inline' https://ssl.google-analytics.com https://www.google-analytics.com https://platform.twitter.com https://github-atom-io-herokuapp-com.global.ssl.fastly.net; style-src 'self' 'unsafe-inline' https://github-atom-io-herokuapp-com.global.ssl.fastly.net;
Content-Type: text/html; charset=utf-8
Date: Wed, 19 Jul 2017 13:59:35 GMT
Location: https://atom-installer.github.com/v1.18.0/atom.x86_64.rpm?s=1497483731&ext=.rpm
Server: Cowboy
Status: 302 Found
Strict-Transport-Security: max-age=631152000
Via: 1.1 vegur
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Rack-Cache: miss
X-Request-Id: bba84816-1ddb-4432-94cc-82a3026ba699
X-Runtime: 0.006117
X-Xss-Protection: 1; mode=block

<html><body>You are being <a href="https://atom-installer.github.com/v1.18.0/atom.x86_64.rpm?s=1497483731&amp;ext=.rpm">redirected</a>.</body></html>


$ http 'https://atom-installer.github.com/v1.18.0/atom.x86_64.rpm?s=1497483731&ext=.rpm'
HTTP/1.1 200 OK
Accept-Ranges: bytes
Connection: keep-alive
Content-Length: 128551353
Content-Type: application/octet-stream
Date: Wed, 19 Jul 2017 14:00:01 GMT
ETag: "330658dca5740290e461a617386625cc-25"
Last-Modified: Wed, 14 Jun 2017 23:42:14 GMT
Server: AmazonS3
Via: 1.1 varnish
X-Cache: HIT
X-Cache-Hits: 0
X-Served-By: cache-ams4447-AMS
X-Timer: S1500472801.280472,VS0,VE1
x-amz-id-2: dqwCDVYxHQ8pGEOJVs2VW3bfz9aKf3AEAD4FyZzvADX/lwl7zeTovW317zkqkNjuZR8F2ZEeDsQ=
x-amz-request-id: E0E279692A01927C



+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+

Comment 1 Jaroslav Mracek 2017-07-24 19:25:54 UTC
What If I will note that dnf handles argument like that only arguments that end up with ".rpm" are recognized as rpm file. The rest is handled as NEVRA, provide or file provide.

Comment 2 Jaroslav Mracek 2017-08-15 16:06:43 UTC
I created a patch that should solve reported problem (https://github.com/rpm-software-management/dnf/pull/898). Thanks for report.

Comment 3 Fedora Update System 2017-10-06 15:58:48 UTC
dnf-2.7.3-1.fc27 dnf-plugins-core-2.1.5-1.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-bb3b9775cc

Comment 4 Fedora Update System 2017-10-06 15:59:09 UTC
dnf-2.7.3-1.fc26 dnf-plugins-core-2.1.5-1.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0f2730a8c2

Comment 5 Fedora Update System 2017-10-08 06:23:27 UTC
dnf-2.7.3-1.fc27, dnf-plugins-core-2.1.5-1.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-bb3b9775cc

Comment 6 Fedora Update System 2017-10-08 08:27:36 UTC
dnf-2.7.3-1.fc26, dnf-plugins-core-2.1.5-1.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2017-10-10 19:30:21 UTC
dnf-2.7.3-1.fc27, dnf-plugins-core-2.1.5-1.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Sonny Piers 2020-11-09 12:17:39 UTC
Problem still persists

> sudo dnf install "https://www.process-one.net/downloads/downloads-action.php?file=/20.07/ejabberd-20.07-0.x86_64.rpm"
[MIRROR] ejabberd-20.07-0.x86_64.rpm: Status code: 403 for https://static.process-one.net/ejabberd/downloads/20.07 (IP: 99.84.156.93)                                                                                                                                                                                         
[FAILED] ejabberd-20.07-0.x86_64.rpm: Status code: 403 for https://static.process-one.net/ejabberd/downloads/20.07 (IP: 99.84.156.93)                                                                                                                                                                                         
Status code: 403 for https://static.process-one.net/ejabberd/downloads/20.07 (IP: 99.84.156.93)

> curl -i "https://www.process-one.net/downloads/downloads-action.php?file=/20.07/ejabberd-20.07-0.x86_64.rpm"
HTTP/2 302 
server: nginx
date: Mon, 09 Nov 2020 12:16:38 GMT
content-type: text/html; charset=UTF-8
content-length: 83
location: https://static.process-one.net/ejabberd/downloads/20.07/ejabberd-20.07-0.x86_64.rpm
x-powered-by: WP Engine
x-cacheable: non200
cache-control: max-age=600, must-revalidate
x-cache: HIT: 7
x-cache-group: normal

https://static.process-one.net/ejabberd/downloads/20.07/ejabberd-20.07-0.x86_64.rpm