Bug 496114

Summary: repo entry with double slashes cause wrong Host: header
Product: Red Hat Enterprise Linux 5 Reporter: Mike McCune <mmccune>
Component: yumAssignee: packaging-team-maint
Status: CLOSED INSUFFICIENT_DATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: low    
Version: 5.3CC: james.antill
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-12 16:32:41 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Mike McCune 2009-04-16 13:50:25 EDT
Using a kickstart file with the following repo entry:

repo --name=VT --baseurl=http://somehost.example.com:80//ks/dist/ks-rhel-i386-server-5-u3/VT/repodata/repomd.xml

and a %packages entry with:


generates a request from anaconda to the server with an incorrect Host header:

GET //ks/dist/ks-rhel-i386-server-5-u3/VT/repodata/repomd.xml HTTP/1.1
Accept-Encoding: identity
Host: ks
Connection: close
User-agent: urlgrabber/3.1.0 yum/3.2.19

note the Host: ks instead of the actual server.  This caused the server that was hosting the repo's data to respond with a 404.

If we correct the kickstart file to not contain the double slashes after the port:

repo --name=VT --baseurl=http://somehost.example.com:80/ks/dist/ks-rhel-i386-server-5-u3/VT/repodata/repomd.xml

it works fine.  We changed our application to ensure that our kickstart files do not contain the // but it took us a while to realize those double slashes were causing breakage.
Comment 1 Chris Lumens 2009-04-29 14:16:39 EDT
We just pass the baseurl down to yum, which probably does some mangling of it before passing it down into python's urllib/urlgrabber/whatever.  It's probably worth doing sanitizing of the URL at some lower level than anaconda to make sure the whole system benefits from it.
Comment 3 James Antill 2009-04-29 17:41:01 EDT
 Also the only thing I know that does anything "funny" with URLs is fastestmirror, and that does:

host = lambda mirror: mirror.split('/')[2].split('@')[-1]

...which works fine. AFAIK everything else in yum/urlgrabber uses 
 Can you reproduce this with plain yum?