Browse Source

verify: return earlier if request is empty

283
ThomasV 10 years ago
parent
commit
d85a11173d
  1. 4
      lib/paymentrequest.py

4
lib/paymentrequest.py

@ -64,6 +64,7 @@ def get_payment_request(url):
connection.request("GET", u.geturl(), headers=REQUEST_HEADERS) connection.request("GET", u.geturl(), headers=REQUEST_HEADERS)
response = connection.getresponse() response = connection.getresponse()
data = response.read() data = response.read()
print_error('fetched payment request', url, len(data))
elif u.scheme == 'file': elif u.scheme == 'file':
with open(u.path, 'r') as f: with open(u.path, 'r') as f:
data = f.read() data = f.read()
@ -105,6 +106,9 @@ class PaymentRequest:
if not ca_list: if not ca_list:
self.error = "Trusted certificate authorities list not found" self.error = "Trusted certificate authorities list not found"
return False return False
if not self.raw:
self.error = "Empty request"
return
paymntreq = pb2.PaymentRequest() paymntreq = pb2.PaymentRequest()
paymntreq.ParseFromString(self.raw) paymntreq.ParseFromString(self.raw)
if not paymntreq.signature: if not paymntreq.signature:

Loading…
Cancel
Save