'Test SEARCH method.'

def _SEARCH(self, domain_path):

    content = "<?xml    version='1.0'?>\r\n"
    content += "<g:searchrequest    xmlns:g='DAV:'>\r\n"
    content += '<g:sql>\r\n'
    content += "Select    'DAV:displayname'    from    scope()\r\n"
    content += '</g:sql>\r\n'
    content += '</g:searchrequest>\r\n'
    res = self._uri_opener.SEARCH(domain_path, data=content, headers=self.CONTENT_TYPE)
    content_matches = (('<a:response>' in res) or ('<a:status>' in res) or ('xmlns:a="DAV:"' in res))
    if (content_matches and (res.get_code() in xrange(200, 300))):
        msg = ('Directory    listing    with    HTTP    SEARCH    method    was    found    atdirectory:    "%s".' % domain_path)
        v = Vuln('Insecure    DAV    configuration', msg, severity.MEDIUM, res.id, self.get_name())
        v.set_url(res.get_url())
        v.set_method('SEARCH')
        self.kb_append(self, 'dav', v)
