Skip to content

Commit

Permalink
use ZeepClientAdapter instead of bare Zeep for confidence
Browse files Browse the repository at this point in the history
  • Loading branch information
Q-back committed Sep 30, 2020
1 parent 9ba5a08 commit 182522b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions w3af/core/data/parsers/doc/wsdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def _load_remote_data(self, url):
return response.body


class ZeepClientAdapter(zeep.Client):
def __init__(self, url, transport=None, *args, **kwargs):
transport = transport or ZeepTransport()
super(ZeepClientAdapter, self).__init__(url, transport=transport, *args, **kwargs)


class WSDLParser(BaseParser):
"""
This class parses WSDL documents.
Expand All @@ -88,7 +94,7 @@ def __init__(self, http_response):
self._proxy = None
super(WSDLParser, self).__init__(http_response)
wsdl_url = str(http_response.get_uri())
self._wsdl_client = zeep.Client(wsdl_url, transport=ZeepTransport())
self._wsdl_client = ZeepClientAdapter(wsdl_url)
self._discovered_urls = set()

def __getstate__(self):
Expand All @@ -98,16 +104,13 @@ def __getstate__(self):

def __setstate__(self, state):
self.__dict__.update(state)
self._wsdl_client = zeep.Client(
str(self._http_response.get_uri()),
transport=ZeepTransport(),
)
self._wsdl_client = ZeepClientAdapter(str(self._http_response.get_uri()))

@staticmethod
def can_parse(http_resp):
url = http_resp.get_uri()
try:
wsdl_client = zeep.Client(str(url), transport=ZeepTransport())
wsdl_client = ZeepClientAdapter(str(url))
except (XMLSyntaxError, HTTPError):
exception_description = (
"The result of url: {} seems not to be valid XML.".format(
Expand Down

0 comments on commit 182522b

Please sign in to comment.