File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,14 @@ impl Target {
214
214
path : decoded. into ( ) ,
215
215
} ) ;
216
216
}
217
+ // vsock:<cid>:<port> is valid RFC3986 but not as an http::Uri
218
+ #[ cfg( any( target_os = "linux" , target_os = "macos" ) ) ]
219
+ if let Some ( cid_port) = val. strip_prefix ( "vsock:" ) {
220
+ let ( left, right) = cid_port. split_once ( ":" ) ?;
221
+ let cid = left. parse :: < u32 > ( ) . ok ( ) ?;
222
+ let port = right. parse :: < u32 > ( ) . ok ( ) ?;
223
+ return Some ( Target :: Vsock { cid, port } ) ;
224
+ }
217
225
218
226
let uri = val. parse :: < Uri > ( ) . ok ( ) ?;
219
227
@@ -920,6 +928,16 @@ fn test_proxy_parse_from_env() {
920
928
}
921
929
_ => panic ! ( "bad target" ) ,
922
930
}
931
+
932
+ // vsock
933
+ #[ cfg( any( target_os = "linux" , target_os = "macos" ) ) ]
934
+ match parse ( "vsock:1234:5678" ) {
935
+ Target :: Vsock { cid, port } => {
936
+ assert_eq ! ( cid, 1234 ) ;
937
+ assert_eq ! ( port, 5678 ) ;
938
+ }
939
+ _ => panic ! ( "bad target" ) ,
940
+ }
923
941
}
924
942
925
943
#[ test]
You can’t perform that action at this time.
0 commit comments