commit d85a11173d00a653c535ee0e4e34068676d49352
parent cbeeedcca23e957e9e586c5787d85dfba50592f1
Author: ThomasV <thomasv@gitorious>
Date: Wed, 3 Jun 2015 09:34:35 +0200
verify: return earlier if request is empty
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/lib/paymentrequest.py b/lib/paymentrequest.py
@@ -64,6 +64,7 @@ def get_payment_request(url):
connection.request("GET", u.geturl(), headers=REQUEST_HEADERS)
response = connection.getresponse()
data = response.read()
+ print_error('fetched payment request', url, len(data))
elif u.scheme == 'file':
with open(u.path, 'r') as f:
data = f.read()
@@ -105,6 +106,9 @@ class PaymentRequest:
if not ca_list:
self.error = "Trusted certificate authorities list not found"
return False
+ if not self.raw:
+ self.error = "Empty request"
+ return
paymntreq = pb2.PaymentRequest()
paymntreq.ParseFromString(self.raw)
if not paymntreq.signature: