[yum-commits] yum/yumRepo.py
James Antill
james at osuosl.org
Tue Sep 16 17:47:36 UTC 2014
yum/yumRepo.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 065ac16ed15dc60aa5a8bf1ce9a370f3a4efcf19
Author: Michael Calmer <mc at suse.de>
Date: Fri Sep 12 13:09:09 2014 +0200
yumRepos.py - preserve queryparams in urls
Hi,
attached you can find a patch for yum to preserve query parameter in urls.
A second patch for urlgrabber will follow.
Some CDN do token authentication by appending a token to the URL
as query parameter. So the baseurl could be something like:
https://host.domain.top/path/?abcdef1234567890
Simply appending the relative part to it will result in something like this
https://host.domain.top/path/?abcdef1234567890/repodata/repomd.xml
which is simply wrong.
--
Regards
Michael Calmer
--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575 - e-mail: Michael.Calmer at suse.com
--------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
HRB 16746 (AG Nürnberg)
>From 964f75c66170d7d5aa860f2dd37d5a079f900bde Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc at suse.de>
Date: Fri, 12 Sep 2014 13:05:04 +0200
Subject: [PATCH] preserve queryparams in urls
Some CDN do token authentication by appending a token to the URL
as query parameter. So the baseurl could be something like:
https://host.domain.top/path/?abcdef1234567890
Simply appending the relative part to it will result in an invalid URL.
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 4d64dff..b95b333 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -845,11 +845,11 @@ class YumRepository(Repository, config.RepoConf):
if url in ['', None]:
continue
url = parser.varReplace(url, self.yumvar)
- if url[-1] != '/':
- url= url + '/'
try:
# This started throwing ValueErrors, BZ 666826
(s,b,p,q,f,o) = urlparse.urlparse(url)
+ if p[-1] != '/':
+ p = p + '/'
except (ValueError, IndexError, KeyError), e:
s = 'blah'
@@ -857,7 +857,7 @@ class YumRepository(Repository, config.RepoConf):
skipped = url
continue
else:
- goodurls.append(url)
+ goodurls.append(urlparse.urlunparse((s,b,p,q,f,o)))
if skipped is not None:
# Caller cleans up for us.
@@ -996,7 +996,7 @@ Insufficient space in download directory %s
size=size,
**ugopts)
- remote = url + '/' + relative
+ remote = urlparse.urlunsplit((scheme, netloc, path + '/' + relative, query, fragid))
try:
result = ug.urlgrab(misc.to_utf8(remote), local,
More information about the Yum-commits
mailing list