Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maybe help with #126 #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions SWProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def handle(self, client):
class SWProxyCallback(object):
def __init__(self):
self.request = None
self.failed_urls = set()

def onRequest(self, proxy, host, port, request):
try:
Expand All @@ -47,6 +48,11 @@ def onResponse(self, proxy, response):
# we have not obtained a valid request yet
return

if request.url.path in self.failed_urls:
# we've tried unsuccessfully before to decrypt a request for this url
# lets improve efficiency by skipping the decrypt we know will fail
return

try:
req_plain, req_json = self._parse_request(self.request)
resp_plain, resp_json = self._parse_response(response)
Expand All @@ -62,6 +68,7 @@ def onResponse(self, proxy, response):
logger.exception('Exception while executing plugin : {}'.format(e))

except Exception as e:
self.failed_urls.add(request.url.path) # add this url to a set of urls known to fail
logger.debug('unknown exception: {}'.format(e))

def onDone(self, proxy):
Expand Down