[Merge] ~toabctl/livecd-rootfs:fix-magic-proxy-with-repo-stamp into livecd-rootfs:ubuntu/master

Thomas Bechtold mp+409129 at code.launchpad.net
Sun Sep 26 18:21:06 UTC 2021



Diff comments:

> diff --git a/magic-proxy b/magic-proxy
> index 29d95ab..10f19c4 100755
> --- a/magic-proxy
> +++ b/magic-proxy
> @@ -814,8 +814,14 @@ class ProxyingHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
>          It is important to understand that there is no status 3xx HTTP redirect
>          happening here, the client does not know that what it receives is not
>          exactly what it requested."""
> +        host = self.headers.get("host")
> +
> +        # the host does not start with http(s):// which result in urlparse
> +        # to not detect the host & path correctly (LP:#1944906)
> +        if not host.startswith("http"):
> +            host = "http://{}".format(host)
> +        uri = host + self.path

It doesn't matter afaics. We only need to add the protocol to make the parsing (with urllib.parse.urlparse()) working. Then only the parsed hostname and path are used. both do not contain http or https.

>  
> -        uri = self.headers.get("host") + self.path
>          parsed = urllib.parse.urlparse(uri)
>  
>          self.sanitize_requestline()


-- 
https://code.launchpad.net/~toabctl/livecd-rootfs/+git/livecd-rootfs-1/+merge/409129
Your team Ubuntu Core Development Team is subscribed to branch livecd-rootfs:ubuntu/master.




More information about the Ubuntu-reviews mailing list