File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1056,6 +1056,31 @@ mod _ssl {
10561056 . map ( cipher_to_tuple)
10571057 }
10581058
1059+ #[ pymethod]
1060+ fn selected_alpn_protocol ( & self ) -> Option < String > {
1061+ #[ cfg( ossl102) ]
1062+ {
1063+ let stream = self . stream . read ( ) ;
1064+ unsafe {
1065+ let mut out: * const libc:: c_uchar = std:: ptr:: null ( ) ;
1066+ let mut outlen: libc:: c_uint = 0 ;
1067+
1068+ sys:: SSL_get0_alpn_selected ( stream. ssl ( ) . as_ptr ( ) , & mut out, & mut outlen) ;
1069+
1070+ if out. is_null ( ) {
1071+ None
1072+ } else {
1073+ let slice = std:: slice:: from_raw_parts ( out, outlen as usize ) ;
1074+ Some ( String :: from_utf8_lossy ( slice) . into_owned ( ) )
1075+ }
1076+ }
1077+ }
1078+ #[ cfg( not( ossl102) ) ]
1079+ {
1080+ None
1081+ }
1082+ }
1083+
10591084 #[ cfg( osslconf = "OPENSSL_NO_COMP" ) ]
10601085 #[ pymethod]
10611086 fn compression ( & self ) -> Option < & ' static str > {
You can’t perform that action at this time.
0 commit comments