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

Function set_verify_error_info

crates/stdlib/src/openssl.rs:3850–3873  ·  view source on GitHub ↗

Helper function to set verify_code and verify_message on SSLCertVerificationError

(
        exc: &Py<PyBaseException>,
        ssl_ptr: *const sys::SSL,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

3848
3849 // Helper function to set verify_code and verify_message on SSLCertVerificationError
3850 fn set_verify_error_info(
3851 exc: &Py<PyBaseException>,
3852 ssl_ptr: *const sys::SSL,
3853 vm: &VirtualMachine,
3854 ) {
3855 // Get verify result
3856 let verify_code = unsafe { sys::SSL_get_verify_result(ssl_ptr) };
3857 let verify_code_obj = vm.ctx.new_int(verify_code);
3858
3859 // Get verify message
3860 let verify_message = unsafe {
3861 let verify_str = sys::X509_verify_cert_error_string(verify_code);
3862 if verify_str.is_null() {
3863 vm.ctx.none()
3864 } else {
3865 let c_str = std::ffi::CStr::from_ptr(verify_str);
3866 vm.ctx.new_str(c_str.to_string_lossy()).into()
3867 }
3868 };
3869
3870 let exc_obj = exc.as_object();
3871 let _ = exc_obj.set_attr("verify_code", verify_code_obj, vm);
3872 let _ = exc_obj.set_attr("verify_message", verify_message, vm);
3873 }
3874 #[track_caller]
3875 fn convert_ssl_error(
3876 vm: &VirtualMachine,

Callers 1

do_handshakeMethod · 0.85

Calls 6

noneMethod · 0.80
new_intMethod · 0.45
new_strMethod · 0.45
to_string_lossyMethod · 0.45
as_objectMethod · 0.45
set_attrMethod · 0.45

Tested by

no test coverage detected