File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,16 @@ public static Settings Default
7878        { 
7979            if  ( EndpointType  !=  EndpointVsock )  return  null ; 
8080
81+             const  string  httpScheme  =  "http://" ; 
82+             const  string  httpsScheme  =  "https://" ; 
8183            var  endpoint  =  Endpoint ; 
82-             if  ( Endpoint . StartsWith ( "http://" ) ) 
84+             if  ( endpoint . StartsWith ( httpScheme ) ) 
8385            { 
84-                 endpoint  =  endpoint . Substring ( "http://" . Length ) ; 
86+                 endpoint  =  endpoint . Substring ( httpScheme . Length ) ; 
8587            } 
86-             else  if  ( Endpoint . StartsWith ( "https://" ) ) 
88+             else  if  ( endpoint . StartsWith ( httpsScheme ) ) 
8789            { 
88-                 endpoint  =  endpoint . Substring ( "https://" . Length ) ; 
90+                 endpoint  =  endpoint . Substring ( httpsScheme . Length ) ; 
8991            } 
9092
9193            var  parts  =  endpoint . Split ( ':' ,  2 ) ; 
Original file line number Diff line number Diff line change @@ -40,15 +40,15 @@ public Vsock(VsockAddress address)
4040            _endpoint  =  new  VSockEndPoint ( address . ContextId ,  address . Port ) ; 
4141        } 
4242
43-         internal  async  ValueTask < Stream >  ConnectAsync ( SocketsHttpConnectionContext  context ,  CancellationToken  cancellationToken ) 
43+         internal  async  ValueTask < Stream >  ConnectAsync ( SocketsHttpConnectionContext  context ,  CancellationToken  cancellation ) 
4444        { 
4545            if  ( ! OperatingSystem . IsLinux ( ) )  throw  new  PlatformNotSupportedException ( "Vsock is only supported on Linux." ) ; 
4646
4747            var  socket  =  VSock . Create ( SocketType . Stream ) ; 
4848            try 
4949            { 
5050                // Have to use `Task.Run` with `Connect` to avoid some compatibility issues(if use ConnectAsync). 
51-                 await  Task . Run ( ( )  =>  socket . Connect ( _endpoint ) ,  cancellationToken ) ; 
51+                 await  Task . Run ( ( )  =>  socket . Connect ( _endpoint ) ,  cancellation ) ; 
5252                return  new  NetworkStream ( socket ,  true ) ; 
5353            } 
5454            catch 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments