Message ID | 20221129132246.436271-1-kasper@krinvent.dk |
---|---|
State | Accepted, archived |
Commit | 88350002d45e0aa85ecd5356da2c8d71e450641e |
Headers | show |
Series | fetch2/wget: handle username/password in uri | expand |
On Tue, 2022-11-29 at 14:22 +0100, Kasper wrote: > From: Kasper Revsbech <kasper.revsbech.ext@siemensgamesa.com> > > In checkstatus() opener.open() is used to check if an artifact is available. > The check fails if the uri contains username password in the format: > "username:password@hostname..". Moreover, the checkstatus function already uses > the username from the "ud" object to craft a header, is username and password is > provided. > > This fix ensure the uri in the Requests object used does not contain username as > password. > > Signed-off-by: Kasper Revsbech <kasper.revsbech.ext@siemensgamesa.com> > --- > lib/bb/fetch2/wget.py | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py > index 821afa5b..d9aaad6b 100644 > --- a/lib/bb/fetch2/wget.py > +++ b/lib/bb/fetch2/wget.py > @@ -341,7 +341,8 @@ class Wget(FetchMethod): > opener = urllib.request.build_opener(*handlers) > > try: > - uri = ud.url.split(";")[0] > + uri_base = ud.url.split(";")[0] > + uri = "{}://{}{}".format(urllib.parse.urlparse(uri_base).scheme, ud.host, ud.path) > r = urllib.request.Request(uri) > r.get_method = lambda: "HEAD" > # Some servers (FusionForge, as used on Alioth) require that the Didn't this merge back in December? https://git.yoctoproject.org/poky/commit/bitbake/lib/bb/fetch2?id=89ccf603d8119c34f5398dbd737e6a0b805234d3 Cheers, Richard
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py index 821afa5b..d9aaad6b 100644 --- a/lib/bb/fetch2/wget.py +++ b/lib/bb/fetch2/wget.py @@ -341,7 +341,8 @@ class Wget(FetchMethod): opener = urllib.request.build_opener(*handlers) try: - uri = ud.url.split(";")[0] + uri_base = ud.url.split(";")[0] + uri = "{}://{}{}".format(urllib.parse.urlparse(uri_base).scheme, ud.host, ud.path) r = urllib.request.Request(uri) r.get_method = lambda: "HEAD" # Some servers (FusionForge, as used on Alioth) require that the