Skip to content

Commit

Permalink
fix important looping
Browse files Browse the repository at this point in the history
  • Loading branch information
rawandahmad698 committed Jan 10, 2024
1 parent a0458cd commit f54d722
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion noble_tls/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = "noble_tls"
__description__ = "Advanced TLS/SSL wrapper for Python"
__version__ = "0.0.99"
__version__ = "0.0.100"
__author__ = "Rawand Ahmed Shaswar"
__license__ = "MIT"
6 changes: 5 additions & 1 deletion noble_tls/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ async def execute_request(
request_payload["withRandomTLSExtensionOrder"] = self.random_tls_extension_order

loop = asyncio.get_event_loop()

# this is a pointer to the response
response = await loop.run_in_executor(None, request, dumps(request_payload).encode('utf-8'))

Expand Down Expand Up @@ -420,16 +419,21 @@ async def execute_request(
current_response = build_response(response_object, response_cookie_jar)
# check for redirect
if allow_redirects:
print(">> [SESSION] Checking for redirect...")

if 'Location' in (headers := current_response.headers) and current_response.status_code in (
300, 301, 302, 303, 307, 308
):
history.append(current_response)
url = headers['Location']
else:
break
else:
break

# Assign the history to the final response
current_response.history = history
print(">> [SESSION] Returning response")
return current_response

async def get(
Expand Down

0 comments on commit f54d722

Please sign in to comment.