@@ -20,15 +20,7 @@ impl AsyncNetworkClient for ReqwestNetworkClient {
20
20
& ' a mut self ,
21
21
request : & ' a sspi:: generator:: NetworkRequest ,
22
22
) -> Pin < Box < dyn Future < Output = ConnectorResult < Vec < u8 > > > + ' a > > {
23
- Box :: pin ( async move {
24
- match & request. protocol {
25
- sspi:: network_client:: NetworkProtocol :: Tcp => self . send_tcp ( & request. url , & request. data ) . await ,
26
- sspi:: network_client:: NetworkProtocol :: Udp => self . send_udp ( & request. url , & request. data ) . await ,
27
- sspi:: network_client:: NetworkProtocol :: Http | sspi:: network_client:: NetworkProtocol :: Https => {
28
- self . send_http ( & request. url , & request. data ) . await
29
- }
30
- }
31
- } )
23
+ Box :: pin ( ReqwestNetworkClient :: send ( self , request) )
32
24
}
33
25
}
34
26
@@ -45,6 +37,16 @@ impl Default for ReqwestNetworkClient {
45
37
}
46
38
47
39
impl ReqwestNetworkClient {
40
+ pub async fn send < ' a > ( & ' a mut self , request : & ' a sspi:: generator:: NetworkRequest ) -> ConnectorResult < Vec < u8 > > {
41
+ match & request. protocol {
42
+ sspi:: network_client:: NetworkProtocol :: Tcp => self . send_tcp ( & request. url , & request. data ) . await ,
43
+ sspi:: network_client:: NetworkProtocol :: Udp => self . send_udp ( & request. url , & request. data ) . await ,
44
+ sspi:: network_client:: NetworkProtocol :: Http | sspi:: network_client:: NetworkProtocol :: Https => {
45
+ self . send_http ( & request. url , & request. data ) . await
46
+ }
47
+ }
48
+ }
49
+
48
50
async fn send_tcp ( & self , url : & Url , data : & [ u8 ] ) -> ConnectorResult < Vec < u8 > > {
49
51
let addr = format ! ( "{}:{}" , url. host_str( ) . unwrap_or_default( ) , url. port( ) . unwrap_or( 88 ) ) ;
50
52
0 commit comments