Bug 496114 - repo entry with double slashes cause wrong Host: header
repo entry with double slashes cause wrong Host: header
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum (Show other bugs)
All Linux
low Severity medium
: rc
: ---
Assigned To: packaging-team-maint
BaseOS QE Security Team
Depends On:
  Show dependency treegraph
Reported: 2009-04-16 13:50 EDT by Mike McCune
Modified: 2014-01-21 01:13 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-03-12 16:32:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
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?

Note You need to log in before you can comment on or make changes to this bug.