parent
66001ee8b7
commit
cb2347e7d6
3 changed files with 5 additions and 6 deletions
|
@ -12,3 +12,4 @@ gevent-ws
|
||||||
coincurve
|
coincurve
|
||||||
maxminddb
|
maxminddb
|
||||||
rich
|
rich
|
||||||
|
defusedxml>=0.7
|
||||||
|
|
|
@ -28,8 +28,8 @@ class PeerPortchecker(object):
|
||||||
return urllib.request.urlopen(req, timeout=20.0)
|
return urllib.request.urlopen(req, timeout=20.0)
|
||||||
|
|
||||||
def portOpen(self, port):
|
def portOpen(self, port):
|
||||||
self.log.info("Not trying to open port using UpnpPunch until it's proven robust...")
|
# self.log.info("Not trying to open port using UpnpPunch until it's proven robust...")
|
||||||
return False
|
# return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
UpnpPunch.ask_to_open_port(port, 'ZeroNet', retries=3, protos=["TCP"])
|
UpnpPunch.ask_to_open_port(port, 'ZeroNet', retries=3, protos=["TCP"])
|
||||||
|
@ -37,7 +37,6 @@ class PeerPortchecker(object):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
self.log.warning("UpnpPunch run error: %s" % Debug.formatException(err))
|
self.log.warning("UpnpPunch run error: %s" % Debug.formatException(err))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def portClose(self, port):
|
def portClose(self, port):
|
||||||
|
|
|
@ -3,8 +3,7 @@ import urllib.request
|
||||||
import http.client
|
import http.client
|
||||||
import logging
|
import logging
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from xml.dom.minidom import parseString
|
from defusedxml.minidom import parseString
|
||||||
from xml.parsers.expat import ExpatError
|
|
||||||
|
|
||||||
from gevent import socket
|
from gevent import socket
|
||||||
import gevent
|
import gevent
|
||||||
|
@ -105,7 +104,7 @@ def _parse_igd_profile(profile_xml):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
dom = parseString(profile_xml)
|
dom = parseString(profile_xml)
|
||||||
except ExpatError as e:
|
except Exception as e:
|
||||||
raise IGDError(
|
raise IGDError(
|
||||||
'Unable to parse IGD reply: {0} \n\n\n {1}'.format(profile_xml, e))
|
'Unable to parse IGD reply: {0} \n\n\n {1}'.format(profile_xml, e))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue