MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_unverified_chain

Method get_unverified_chain

crates/stdlib/src/ssl.rs:3973–4000  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

3971
3972 #[pymethod]
3973 fn get_unverified_chain(&self, vm: &VirtualMachine) -> PyResult<Option<PyListRef>> {
3974 // Get peer certificates from the connection
3975 let conn_guard = self.connection.lock();
3976 let conn = conn_guard
3977 .as_ref()
3978 .ok_or_else(|| vm.new_value_error("Handshake not completed"))?;
3979
3980 let certs = conn.peer_certificates();
3981
3982 let Some(certs) = certs else {
3983 return Ok(None);
3984 };
3985
3986 // Convert to list of Certificate objects
3987 let cert_list: Vec<PyObjectRef> = certs
3988 .iter()
3989 .map(|cert_der| {
3990 let cert_bytes = cert_der.as_ref().to_vec();
3991 PySSLCertificate {
3992 der_bytes: cert_bytes,
3993 }
3994 .into_ref(&vm.ctx)
3995 .into()
3996 })
3997 .collect();
3998
3999 Ok(Some(vm.ctx.new_list(cert_list)))
4000 }
4001
4002 #[pymethod]
4003 fn get_verified_chain(&self, vm: &VirtualMachine) -> PyResult<Option<PyListRef>> {

Callers

nothing calls this directly

Calls 11

ok_or_elseMethod · 0.80
peer_certificatesMethod · 0.80
collectMethod · 0.80
to_vecMethod · 0.80
new_listMethod · 0.80
SomeClass · 0.50
lockMethod · 0.45
as_refMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
into_refMethod · 0.45

Tested by

no test coverage detected