- fd = {name:v for name, v in d.items() if name.startswith('saml-') or name in ('prelogin-cookie', 'portal-userauthcookie')}
- if fd and self.verbose:
- print("[SAML ] Got SAML result headers: %r" % fd, file=stderr)
+ fd = {name: v for name, v in d.items() if name.startswith('saml-') or name in COOKIE_FIELDS}
+
+ if fd:
+ if self.verbose:
+ print("[SAML ] Got SAML result headers: %r" % fd, file=stderr)
+ if self.verbose > 1:
+ # display everything we found
+ mr.get_data(None, self.log_resource_text, ct[0], ct.params.get('charset'), d)
+ self.saml_result.update(fd, server=urlparse(uri).netloc)
+ self.check_done()
+
+ if not self.success:
+ if self.verbose > 1:
+ print("[SAML ] No headers in response, searching body for xml comments", file=stderr)
+ # asynchronous call to fetch body content, continue processing in callback:
+ mr.get_data(None, self.response_callback, ct)
+
+ def response_callback(self, resource, result, ct):
+ data = resource.get_data_finish(result)
+ content = data.decode(ct.params.get("charset") or "utf-8")
+
+ html_parser = CommentHtmlParser()
+ html_parser.feed(content)
+
+ fd = {}
+ for comment in html_parser.comments: