MCPcopy
hub / github.com/urllib3/urllib3 / test_server_hostname

Method test_server_hostname

test/with_dummyserver/test_https.py:445–464  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

443 https_pool.request("GET", "/")
444
445 def test_server_hostname(self) -> None:
446 with HTTPSConnectionPool(
447 "127.0.0.1",
448 self.port,
449 cert_reqs="CERT_REQUIRED",
450 ca_certs=DEFAULT_CA,
451 server_hostname="localhost",
452 ssl_minimum_version=self.tls_version(),
453 ) as https_pool:
454 conn = https_pool._new_conn()
455 conn.request("GET", "/")
456
457 # Assert the wrapping socket is using the passed-through SNI name.
458 # pyopenssl doesn't let you pull the server_hostname back off the
459 # socket, so only add this assertion if the attribute is there (i.e.
460 # the python ssl module).
461 if hasattr(conn.sock, "server_hostname"): # type: ignore[attr-defined]
462 assert conn.sock.server_hostname == "localhost" # type: ignore[attr-defined]
463 conn.getresponse().close()
464 conn.close()
465
466 def test_assert_fingerprint_md5(self) -> None:
467 with HTTPSConnectionPool(

Callers

nothing calls this directly

Calls 6

tls_versionMethod · 0.95
HTTPSConnectionPoolClass · 0.90
_new_connMethod · 0.45
requestMethod · 0.45
closeMethod · 0.45
getresponseMethod · 0.45

Tested by

no test coverage detected