Skip to content

Commit

Permalink
Test out memory limiting to see if we can trip the limit
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Apr 24, 2023
1 parent ba3f080 commit 5af1b0a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/truststore/_macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,13 @@ def _verify_peercerts_impl(
ctypes.byref(CoreFoundation.kCFTypeArrayCallBacks),
)
CoreFoundation.CFArrayAppendValue(policies, ssl_policy)
CoreFoundation.CFRelease(ssl_policy)
# CoreFoundation.CFRelease(ssl_policy)
revocation_policy = Security.SecPolicyCreateRevocation(
kSecRevocationUseAnyAvailableMethod
| kSecRevocationRequirePositiveResponse
)
CoreFoundation.CFArrayAppendValue(policies, revocation_policy)
CoreFoundation.CFRelease(revocation_policy)
# CoreFoundation.CFRelease(revocation_policy)
elif ssl_context.verify_flags & ssl.VERIFY_CRL_CHECK_LEAF:
raise NotImplementedError("VERIFY_CRL_CHECK_LEAF not implemented for macOS")

Expand Down
4 changes: 2 additions & 2 deletions src/truststore/_windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ def _verify_peercerts_impl(
else:
raise
finally:
CertCloseStore(hIntermediateCertStore, 0)
# CertCloseStore(hIntermediateCertStore, 0)
if pCertContext:
CertFreeCertificateContext(pCertContext)
# CertFreeCertificateContext(pCertContext)


def _get_and_verify_cert_chain(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
async def test_memory_limit(server: Server) -> None:
def run_requests():
ctx = truststore.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
for _ in range(10000):
for _ in range(1000):
with urllib3.PoolManager(ssl_context=ctx) as http:
http.request("GET", server.base_url)
http.request("HEAD", server.base_url)
http.clear() # Close connections so we get new ones.

thread = asyncio.to_thread(run_requests)
Expand Down

0 comments on commit 5af1b0a

Please sign in to comment.