Bug 598988

Summary: Download through httpproxy will fail if package is not cached
Product: Red Hat Enterprise Linux 6 Reporter: Šimon Lukašík <slukasik>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED CURRENTRELEASE QA Contact: Miroslav Vadkerti <mvadkert>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: mvadkert, notting, psklenar, tao
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rpm-4.8.0-10.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-10 21:32:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 519840, 582655, 599016    

Description Šimon Lukašík 2010-06-02 13:43:02 UTC
Description of problem:
Download through httpproxy will fail, if package is not cached. See steps for more info.

Version-Release number of selected component (if applicable):
rpm-4.8.0-8.el6
curl-7.19.7-14.el6

How reproducible:
Sometimes.
Reproducible against http://download.devel.redhat.com/ but not against EPEL repo.

Steps to Reproduce:
1. # Take some http proxy and repository
2. # Try to source non-cached package
rpm -ivh --httpproxy squid.redhat.com --htppport 3128 http://download.devel.redhat.com/released/RHEL-5-Server/U4/i386/os/Server/Deployment_Guide-si-LK-5.2-11.noarch.rpm 
# Download will fail
3. # Cache the package
curl -x squid.redhat.com:3128 http://download.devel.redhat.com/released/RHEL-5-Server/U4/i386/os/Server/Deployment_Guide-si-LK-5.2-11.noarch.rpm > /dev/null
4. #repeat step 2. and download will be successful.
  
Actual results:
Retrieving http://download.devel.redhat.com/released/RHEL-5-Server/U4/i386/os/Server/Deployment_Guide-si-LK-5.2-11.noarch.rpm
curl: (52) Empty reply from server
error: skipping http://download.devel.redhat.com/released/RHEL-5-Server/U4/i386/os/Server/Deployment_Guide-si-LK-5.2-11.noarch.rpm - transfer failed

Expected results:
Download through httpproxy should work.

Additional info:
This behaviour is regression.
On rhel5.5 with rpm-4.4.2.3-18.el5, curl-7.15.5-2.1.el5_3.5 download works as expected.
On fedora12 with rpm-4.7.2-1.fc12, curl-7.19.7-9.fc12 download fails.

Comment 2 RHEL Program Management 2010-06-02 19:05:20 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 3 Panu Matilainen 2010-06-03 09:21:08 UTC
rpm 4.4.x didn't use curl but rpm's internal networking code. And rpm >= 4.6.x simply calls out to curl, so if "curl <something>" from command line works, it should work with rpm too. If it doesn't...

Rpm by default calls curl with the following opts:
--silent --show-error --fail --location 

One of those (--fail looks likely) causes curl to give up where it doesn't when you call it from the command line. Notice the "curl: (52) Empty reply from server" error from curl, maybe the proxy is reporting something funny here when referring to an internal address.

Comment 4 Šimon Lukašík 2010-06-03 09:47:54 UTC
Hi Panu,

I understand, but weird thing is: If I try to add these options to curl in command line, it will download that file. While rpm is failing to do that.

Even If I force curl to use http/1.0 while talking to proxy, it will download desired file.

Another thing I do not understand, is while it's ok for rpm to communicate with EPEL repo. But it gives up communication with download.devel.redhat.com.

Comment 5 Panu Matilainen 2010-06-03 10:54:18 UTC
Are you running curl as root? Differing environment, such as no_proxy for .redhat.com in your normal account but for root, can affect things...

Comment 6 Šimon Lukašík 2010-06-03 11:20:58 UTC
Yes, I am running curl as root. 

tcpdump verified that curl and rpm are communicating only with proxy.

Comment 7 Panu Matilainen 2010-06-03 13:19:17 UTC
A fair amount of head-scratching later... the bug was as silly as it seemed mysterious: it's an extra trailing \n in the command line which rpm passes down to exec(), with the \n ending up as a part of the url. Which apparently some servers dont mind, some servers do. Doh :)

Comment 8 Panu Matilainen 2010-06-29 06:09:04 UTC
Fixed in rpm-4.8.0-10.el6

Comment 10 Panu Matilainen 2010-07-09 05:13:16 UTC
*** Bug 612727 has been marked as a duplicate of this bug. ***

Comment 13 Miroslav Vadkerti 2010-08-05 14:22:56 UTC
VERIFIED as fixed in rpm-4.8.0-12.el6

Comment 14 releng-rhel@redhat.com 2010-11-10 21:32:16 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.