Bug 496114 - repo entry with double slashes cause wrong Host: header
Summary: repo entry with double slashes cause wrong Host: header
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: yum
Version: 5.3
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-16 17:50 UTC by Mike McCune
Modified: 2014-01-21 06:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-03-12 20:32:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Mike McCune 2009-04-16 17:50:25 UTC
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:

%packages
xen

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 18:16:39 UTC
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 21:41:01 UTC
 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 
urlparse.urlparse().
 Can you reproduce this with plain yum?


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