[common] raise ChallengeError for CF & DDG challenges (#1945)
this sets bit 0x08 in the exit status bitmask
This commit is contained in:
@@ -155,17 +155,15 @@ class Extractor():
|
|||||||
kwargs["verify"] = self._verify
|
kwargs["verify"] = self._verify
|
||||||
|
|
||||||
if "json" in kwargs:
|
if "json" in kwargs:
|
||||||
json = kwargs["json"]
|
if (json := kwargs["json"]) is not None:
|
||||||
if json is not None:
|
|
||||||
kwargs["data"] = util.json_dumps(json).encode()
|
kwargs["data"] = util.json_dumps(json).encode()
|
||||||
del kwargs["json"]
|
del kwargs["json"]
|
||||||
headers = kwargs.get("headers")
|
if headers := kwargs.get("headers"):
|
||||||
if headers:
|
|
||||||
headers["Content-Type"] = "application/json"
|
headers["Content-Type"] = "application/json"
|
||||||
else:
|
else:
|
||||||
kwargs["headers"] = {"Content-Type": "application/json"}
|
kwargs["headers"] = {"Content-Type": "application/json"}
|
||||||
|
|
||||||
response = None
|
response = challenge = None
|
||||||
tries = 1
|
tries = 1
|
||||||
|
|
||||||
if self._interval:
|
if self._interval:
|
||||||
@@ -249,8 +247,12 @@ class Extractor():
|
|||||||
self.log.warning(msg)
|
self.log.warning(msg)
|
||||||
return util.NullResponse(url, msg)
|
return util.NullResponse(url, msg)
|
||||||
|
|
||||||
self.status |= exception.HttpError.code
|
if challenge is None:
|
||||||
raise exception.HttpError(msg, response)
|
exc = exception.HttpError(msg, response)
|
||||||
|
else:
|
||||||
|
exc = exception.ChallengeError(challenge, response)
|
||||||
|
self.status |= exc.code
|
||||||
|
raise exc
|
||||||
|
|
||||||
def request_location(self, url, **kwargs):
|
def request_location(self, url, **kwargs):
|
||||||
kwargs.setdefault("method", "HEAD")
|
kwargs.setdefault("method", "HEAD")
|
||||||
|
|||||||
Reference in New Issue
Block a user