mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-06-10 17:41:32 +00:00
magic-proxy: return 404 when InRelease file cannot be found "by hash"
When the magic-proxy script could not find a valid InRelease file for the configured timestamp, it would fall back to serving the canonical version of it. This meant that builds would succeed, even though snap-shotting the repository failed. This update makes the script return HTTP 404 when an InRelease by-hash link for a given combination of mirror, suite and timestamp cannot be found.
This commit is contained in:
parent
b2db5bf365
commit
3a294f5b50
11
debian/changelog
vendored
11
debian/changelog
vendored
@ -1,8 +1,19 @@
|
|||||||
livecd-rootfs (2.566) UNRELEASED; urgency=medium
|
livecd-rootfs (2.566) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
[ Julian Andres Klode ]
|
||||||
* Do not mark direct dependencies of ubiquity as auto installed. This caused
|
* Do not mark direct dependencies of ubiquity as auto installed. This caused
|
||||||
cryptsetup to remain auto on the installed system (LP: #1801629)
|
cryptsetup to remain auto on the installed system (LP: #1801629)
|
||||||
|
|
||||||
|
[ Tobias Koch ]
|
||||||
|
* When the magic-proxy script could not find a valid InRelease file for the
|
||||||
|
configured timestamp, it would fall back to serving the canonical version
|
||||||
|
of it. This meant that builds would succeed, even though snap-shotting the
|
||||||
|
repository failed.
|
||||||
|
.
|
||||||
|
This update makes the script return HTTP 404 when an InRelease by-hash
|
||||||
|
link for a given combination of mirror, suite and timestamp cannot be
|
||||||
|
found.
|
||||||
|
|
||||||
-- Julian Andres Klode <juliank@ubuntu.com> Fri, 22 Feb 2019 10:58:48 +0100
|
-- Julian Andres Klode <juliank@ubuntu.com> Fri, 22 Feb 2019 10:58:48 +0100
|
||||||
|
|
||||||
livecd-rootfs (2.565) disco; urgency=medium
|
livecd-rootfs (2.565) disco; urgency=medium
|
||||||
|
16
magic-proxy
16
magic-proxy
@ -771,14 +771,14 @@ class ProxyingHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
index = LPInReleaseIndex(mirror, suite,
|
index = LPInReleaseIndex(mirror, suite,
|
||||||
cache=self.server.inrelease_cache)
|
cache=self.server.inrelease_cache)
|
||||||
|
|
||||||
try:
|
|
||||||
inrelease = index.get_inrelease_for_timestamp(
|
inrelease = index.get_inrelease_for_timestamp(
|
||||||
self.server.snapshot_stamp)
|
self.server.snapshot_stamp)
|
||||||
except LPInReleaseIndexError as e:
|
|
||||||
inrelease = None
|
|
||||||
|
|
||||||
if inrelease is not None:
|
if inrelease is None:
|
||||||
|
self.__send_error(404, "No InRelease file found for given "
|
||||||
|
"mirror, suite and timestamp.")
|
||||||
|
return
|
||||||
|
|
||||||
if target == "InRelease":
|
if target == "InRelease":
|
||||||
# If target is InRelease, send back contents directly.
|
# If target is InRelease, send back contents directly.
|
||||||
data = inrelease.data.encode("utf-8")
|
data = inrelease.data.encode("utf-8")
|
||||||
@ -839,6 +839,12 @@ class ProxyingHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
self.end_headers()
|
self.end_headers()
|
||||||
shutil.copyfileobj(response, self.wfile)
|
shutil.copyfileobj(response, self.wfile)
|
||||||
|
|
||||||
|
def __send_error(self, status, message):
|
||||||
|
"""Return an HTTP error status and a message in the response body."""
|
||||||
|
self.send_response(status)
|
||||||
|
self.send_header("Content-Type", "text/plain; charset=utf-8")
|
||||||
|
self.wfile.write(message.encode("utf-8"))
|
||||||
|
|
||||||
|
|
||||||
class MagicHTTPProxy(socketserver.ThreadingMixIn, http.server.HTTPServer):
|
class MagicHTTPProxy(socketserver.ThreadingMixIn, http.server.HTTPServer):
|
||||||
"""Tiny HTTP server using ProxyingHTTPRequestHandler instances to provide
|
"""Tiny HTTP server using ProxyingHTTPRequestHandler instances to provide
|
||||||
|
Loading…
x
Reference in New Issue
Block a user