Commit 597f4dea authored by Tom Niget's avatar Tom Niget Committed by Tom Niget

bug: fix wrong sending of HMAC header causing test failure

parent 64d10c7f
...@@ -328,7 +328,7 @@ class RegistryServer: ...@@ -328,7 +328,7 @@ class RegistryServer:
request.send_response(http.client.NO_CONTENT) request.send_response(http.client.NO_CONTENT)
if key: if key:
request.send_header(HMAC_HEADER, base64.b64encode( request.send_header(HMAC_HEADER, base64.b64encode(
hmac.HMAC(key, result, hashlib.sha1).digest())) hmac.HMAC(key, result, hashlib.sha1).digest()).decode("ascii"))
request.end_headers() request.end_headers()
if result: if result:
request.wfile.write(result) request.wfile.write(result)
...@@ -849,6 +849,7 @@ class RegistryClient: ...@@ -849,6 +849,7 @@ class RegistryClient:
self._conn.endheaders() self._conn.endheaders()
response = self._conn.getresponse() response = self._conn.getresponse()
body = response.read() body = response.read()
#print(query, repr(body))
if response.status in (http.client.OK, http.client.NO_CONTENT): if response.status in (http.client.OK, http.client.NO_CONTENT):
if (not client_prefix or if (not client_prefix or
hmac.HMAC(key, body, hashlib.sha1).digest() == hmac.HMAC(key, body, hashlib.sha1).digest() ==
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment