Browse Source

sanitize payment request code

283
ThomasV 11 years ago
parent
commit
0149ec5921
  1. 10
      lib/paymentrequest.py

10
lib/paymentrequest.py

@ -65,13 +65,21 @@ class PaymentRequest:
u = urlparse.urlparse(self.url)
self.domain = u.netloc
try:
connection = httplib.HTTPConnection(u.netloc) if u.scheme == 'http' else httplib.HTTPSConnection(u.netloc)
connection.request("GET",u.geturl(), headers=REQUEST_HEADERS)
resp = connection.getresponse()
except:
self.error = "cannot read url"
return
r = resp.read()
paymntreq = paymentrequest_pb2.PaymentRequest()
try:
r = resp.read()
paymntreq.ParseFromString(r)
except:
self.error = "cannot parse payment request"
return
sig = paymntreq.signature
if not sig:

Loading…
Cancel
Save