mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
hs: Updated synapse.http.client to handle DNSLookupErrors and bail immediately.
This commit is contained in:
parent
da31b96b55
commit
b1195c125f
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
from twisted.internet import defer, reactor
|
from twisted.internet import defer, reactor
|
||||||
|
from twisted.internet.error import DNSLookupError
|
||||||
from twisted.web.client import _AgentBase, _URI, readBody
|
from twisted.web.client import _AgentBase, _URI, readBody
|
||||||
from twisted.web.http_headers import Headers
|
from twisted.web.http_headers import Headers
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ from synapse.util.async import sleep
|
|||||||
|
|
||||||
from syutil.jsonutil import encode_canonical_json
|
from syutil.jsonutil import encode_canonical_json
|
||||||
|
|
||||||
from synapse.api.errors import CodeMessageException
|
from synapse.api.errors import CodeMessageException, SynapseError
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -198,6 +199,10 @@ class TwistedHttpClient(HttpClient):
|
|||||||
|
|
||||||
logger.debug("Got response to %s", method)
|
logger.debug("Got response to %s", method)
|
||||||
break
|
break
|
||||||
|
except DNSLookupError as dns:
|
||||||
|
logger.warn("DNS Lookup failed to %s with %s", destination,
|
||||||
|
dns)
|
||||||
|
raise SynapseError(400, "Domain specified not found.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Got error in _create_request")
|
logger.exception("Got error in _create_request")
|
||||||
_print_ex(e)
|
_print_ex(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user