diff --git a/httpsig/utils.py b/httpsig/utils.py index b34e3fa..fe3f24f 100644 --- a/httpsig/utils.py +++ b/httpsig/utils.py @@ -57,7 +57,7 @@ def generate_message(required_headers, headers, host=None, method=None, path=Non if h == '(request-target)': if not method or not path: raise Exception('method and path arguments required when using "(request-target)"') - signable_list.append('%s: %s %s' % (h, method.lower(), path)) + signable_list.append('%s: %s %s' % (h, method.lower(), path.lower())) elif h == 'host': # 'host' special case due to requests lib restrictions @@ -124,10 +124,13 @@ def build_signature_template(key_id, algorithm, headers): """ param_map = {'keyId': key_id, 'algorithm': algorithm, + 'headers': None, 'signature': '%s'} if headers: headers = [h.lower() for h in headers] param_map['headers'] = ' '.join(headers) + else: + del param_map['headers'] kv = map('{0[0]}="{0[1]}"'.format, param_map.items()) kv_string = ','.join(kv) sig_string = 'Signature {0}'.format(kv_string)