Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinavsingh committed Aug 12, 2024
1 parent 4bc4600 commit 51d0320
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion benchmark/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.8.2
aiohttp==3.10.3
# Blacksheep depends upon essentials_openapi which is pinned to pyyaml==5.4.1
# and pyyaml>5.3.1 is broken for cython 3
# See https://github.com/yaml/pyyaml/issues/724#issuecomment-1638587228
Expand Down
10 changes: 5 additions & 5 deletions proxy/http/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,23 @@ def client(
conn_close: bool = True,
scheme: bytes = HTTPS_PROTO,
timeout: float = DEFAULT_TIMEOUT,
content_type: bytes = b"application/x-www-form-urlencoded",
content_type: bytes = b'application/x-www-form-urlencoded',
) -> Optional[HttpParser]:
"""Makes a request to remote registry endpoint"""
request = build_http_request(
method=method,
url=path,
headers={
b"Host": host,
b"Content-Type": content_type,
b'Host': host,
b'Content-Type': content_type,
},
body=body,
conn_close=conn_close,
)
try:
conn = new_socket_connection((host.decode(), port))
except ConnectionRefusedError as exc:
logger.exception("Connection refused", exc_info=exc)
logger.exception('Connection refused', exc_info=exc)
return None
sock: TcpOrTlsSocket = conn
if scheme == HTTPS_PROTO:
Expand All @@ -61,7 +61,7 @@ def client(
ctx.load_verify_locations(cafile=certifi.where())
sock = ctx.wrap_socket(conn, server_hostname=host.decode())

Check failure

Code scanning / CodeQL

Use of insecure SSL/TLS version High

Insecure SSL/TLS protocol version TLSv1 allowed by
call to ssl.SSLContext
.
Insecure SSL/TLS protocol version TLSv1_1 allowed by
call to ssl.SSLContext
.
except Exception as exc:
logger.exception("Unable to wrap", exc_info=exc)
logger.exception('Unable to wrap', exc_info=exc)
conn.close()
return None
parser = HttpParser(httpParserTypes.RESPONSE_PARSER)
Expand Down
12 changes: 6 additions & 6 deletions tests/http/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class TestClient(unittest.TestCase):

def test_client(self) -> None:
response = client(
host=b"google.com",
host=b'google.com',
port=443,
scheme=b"https",
path=b"/",
method=b"GET",
content_type=b"text/html",
scheme=b'https',
path=b'/',
method=b'GET',
content_type=b'text/html',
)
assert response is not None
self.assertEqual(response.code, b"301")
self.assertEqual(response.code, b'301')

0 comments on commit 51d0320

Please sign in to comment.