mirror of https://gitlab.com/bashrc2/epicyon
More debug
parent
8c2b1e3018
commit
9ddda0b9e0
17
httpsig.py
17
httpsig.py
|
@ -354,14 +354,23 @@ def verifyPostHeaders(httpPrefix: str, publicKeyPem: str, headers: dict,
|
||||||
f'{signedHeader}: {headers[signedHeader]}')
|
f'{signedHeader}: {headers[signedHeader]}')
|
||||||
else:
|
else:
|
||||||
if '-' in signedHeader:
|
if '-' in signedHeader:
|
||||||
|
# capitalise with dashes
|
||||||
|
# my-header becomes My-Header
|
||||||
headerParts = signedHeader.split('-')
|
headerParts = signedHeader.split('-')
|
||||||
signedHeaderCap = ''
|
signedHeaderCap = None
|
||||||
for part in headerParts:
|
for part in headerParts:
|
||||||
if signedHeaderCap:
|
if signedHeaderCap:
|
||||||
signedHeaderCap += '-'
|
signedHeaderCap += '-' + part.capitalize()
|
||||||
signedHeaderCap += part.capitalize()
|
else:
|
||||||
|
signedHeaderCap = part.capitalize()
|
||||||
else:
|
else:
|
||||||
|
# header becomes Header
|
||||||
signedHeaderCap = signedHeader.capitalize()
|
signedHeaderCap = signedHeader.capitalize()
|
||||||
|
|
||||||
|
if debug:
|
||||||
|
print('signedHeaderCap: ' + signedHeaderCap)
|
||||||
|
|
||||||
|
# if this is the date header then check it is recent
|
||||||
if signedHeaderCap == 'Date':
|
if signedHeaderCap == 'Date':
|
||||||
if not _verifyRecentSignature(headers[signedHeaderCap]):
|
if not _verifyRecentSignature(headers[signedHeaderCap]):
|
||||||
if debug:
|
if debug:
|
||||||
|
@ -369,6 +378,8 @@ def verifyPostHeaders(httpPrefix: str, publicKeyPem: str, headers: dict,
|
||||||
'verifyPostHeaders date is not recent ' +
|
'verifyPostHeaders date is not recent ' +
|
||||||
headers[signedHeader])
|
headers[signedHeader])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# add the capitalised header
|
||||||
if headers.get(signedHeaderCap):
|
if headers.get(signedHeaderCap):
|
||||||
signedHeaderList.append(
|
signedHeaderList.append(
|
||||||
f'{signedHeader}: {headers[signedHeaderCap]}')
|
f'{signedHeader}: {headers[signedHeaderCap]}')
|
||||||
|
|
Loading…
Reference in New Issue