From 73ebebdcd17ccb75d6e4b2a7140746d393d101bc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 12 Nov 2019 17:16:34 +0000 Subject: [PATCH] More debug --- httpsig.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/httpsig.py b/httpsig.py index 7495ab1b..8987f0f2 100644 --- a/httpsig.py +++ b/httpsig.py @@ -191,11 +191,17 @@ def verifyPostHeaders(httpPrefix: str,publicKeyPem: str,headers: dict, \ #print('***************************Verify digest: SHA-256='+bodyDigest) #print('***************************Verify messageBodyJsonStr: '+messageBodyJsonStr) elif signedHeader == 'content-length' or signedHeader == 'Content-Length': - if int(headers[signedHeader])!=contentLength: + 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 content-length does not match '+headers[signedHeader]+' != '+str(contentLength)) - return False - signedHeaderList.append(f'content-length: {headers[signedHeader]}') + 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':