Separate cases

main
Bob Mottram 2019-11-12 18:48:29 +00:00
parent f2b295ed7b
commit 808b5a4c8b
1 changed files with 13 additions and 1 deletions

View File

@ -191,7 +191,7 @@ def verifyPostHeaders(httpPrefix: str,publicKeyPem: str,headers: dict, \
signedHeaderList.append(f'digest: SHA-256={bodyDigest}')
#print('***************************Verify digest: SHA-256='+bodyDigest)
#print('***************************Verify messageBodyJsonStr: '+messageBodyJsonStr)
elif signedHeader == 'content-length' or signedHeader == 'Content-Length':
elif signedHeader == 'content-length':
if headers.get(signedHeader):
if int(headers[signedHeader])!=contentLength:
if debug:
@ -203,6 +203,18 @@ def verifyPostHeaders(httpPrefix: str,publicKeyPem: str,headers: dict, \
else:
if debug:
print('DEBUG: verifyPostHeaders '+signedHeader+' not found in '+str(headers))
elif signedHeader == 'Content-Length':
if headers.get(signedHeader):
if int(headers[signedHeader])!=contentLength:
if debug:
print('DEBUG: verifyPostHeaders Content-Length does not match '+headers[signedHeader]+' != '+str(contentLength))
return False
if debug:
print('DEBUG: verifyPostHeaders adding Content-Length to signedHeaderList')
signedHeaderList.append(f'Content-Length: {headers[signedHeader]}')
else:
if debug:
print('DEBUG: verifyPostHeaders '+signedHeader+' not found in '+str(headers))
else:
if headers.get(signedHeader):
if signedHeader=='date':