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

Method set_options

crates/stdlib/src/openssl.rs:1136–1161  ·  view source on GitHub ↗
(&self, new_opts: i64, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1134 }
1135 #[pygetset(setter)]
1136 fn set_options(&self, new_opts: i64, vm: &VirtualMachine) -> PyResult<()> {
1137 if new_opts < 0 {
1138 return Err(vm.new_value_error("invalid options value"));
1139 }
1140 let new_opts = new_opts as libc::c_ulong;
1141 let mut ctx = self.builder();
1142 // Get current options
1143 let current = ctx.options().bits() as libc::c_ulong;
1144
1145 // Calculate options to clear and set
1146 let clear = current & !new_opts;
1147 let set = !current & new_opts;
1148
1149 // Clear options first (using raw FFI since openssl crate doesn't expose clear_options)
1150 if clear != 0 {
1151 unsafe {
1152 sys::SSL_CTX_clear_options(ctx.as_ptr(), clear);
1153 }
1154 }
1155
1156 // Then set new options
1157 if set != 0 {
1158 ctx.set_options(SslOptions::from_bits_truncate(set as _));
1159 }
1160 Ok(())
1161 }
1162 #[pygetset]
1163 fn protocol(&self) -> i32 {
1164 self.protocol as i32

Callers 1

py_newMethod · 0.45

Calls 4

ErrClass · 0.50
builderMethod · 0.45
optionsMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected