@@ -1600,36 +1600,57 @@ fn header_included_ipv6() {
16001600#[ test]
16011601#[ cfg( all(
16021602 feature = "all" ,
1603- any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1603+ any(
1604+ target_os = "android" ,
1605+ target_os = "fuchsia" ,
1606+ target_os = "linux" ,
1607+ target_os = "windows"
1608+ )
16041609) ) ]
16051610fn original_dst ( ) {
16061611 let socket = Socket :: new ( Domain :: IPV4 , Type :: STREAM , None ) . unwrap ( ) ;
1612+ #[ cfg( not( target_os = "windows" ) ) ]
1613+ let expected = Some ( libc:: ENOENT ) ;
1614+ #[ cfg( target_os = "windows" ) ]
1615+ let expected = Some ( windows_sys:: Win32 :: Networking :: WinSock :: WSAEINVAL ) ;
1616+
16071617 match socket. original_dst ( ) {
16081618 Ok ( _) => panic ! ( "original_dst on non-redirected socket should fail" ) ,
1609- Err ( err) => assert_eq ! ( err. raw_os_error( ) , Some ( libc :: ENOENT ) ) ,
1619+ Err ( err) => assert_eq ! ( err. raw_os_error( ) , expected ) ,
16101620 }
16111621
16121622 let socket = Socket :: new ( Domain :: IPV6 , Type :: STREAM , None ) . unwrap ( ) ;
16131623 match socket. original_dst ( ) {
16141624 Ok ( _) => panic ! ( "original_dst on non-redirected socket should fail" ) ,
1615- Err ( err) => assert_eq ! ( err. raw_os_error( ) , Some ( libc :: ENOENT ) ) ,
1625+ Err ( err) => assert_eq ! ( err. raw_os_error( ) , expected ) ,
16161626 }
16171627}
16181628
16191629#[ test]
1620- #[ cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) ]
1630+ #[ cfg( all(
1631+ feature = "all" ,
1632+ any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1633+ ) ) ]
16211634fn original_dst_ipv6 ( ) {
16221635 let socket = Socket :: new ( Domain :: IPV6 , Type :: STREAM , None ) . unwrap ( ) ;
1636+ #[ cfg( not( target_os = "windows" ) ) ]
1637+ let expected = Some ( libc:: ENOENT ) ;
1638+ #[ cfg( target_os = "windows" ) ]
1639+ let expected = Some ( windows_sys:: Win32 :: Networking :: WinSock :: WSAEINVAL ) ;
1640+ #[ cfg( not( target_os = "windows" ) ) ]
1641+ let expected_v4 = Some ( libc:: EOPNOTSUPP ) ;
1642+ #[ cfg( target_os = "windows" ) ]
1643+ let expected_v4 = Some ( windows_sys:: Win32 :: Networking :: WinSock :: WSAEINVAL ) ;
16231644 match socket. original_dst_ipv6 ( ) {
16241645 Ok ( _) => panic ! ( "original_dst_ipv6 on non-redirected socket should fail" ) ,
1625- Err ( err) => assert_eq ! ( err. raw_os_error( ) , Some ( libc :: ENOENT ) ) ,
1646+ Err ( err) => assert_eq ! ( err. raw_os_error( ) , expected ) ,
16261647 }
16271648
16281649 // Not supported on IPv4 socket.
16291650 let socket = Socket :: new ( Domain :: IPV4 , Type :: STREAM , None ) . unwrap ( ) ;
16301651 match socket. original_dst_ipv6 ( ) {
16311652 Ok ( _) => panic ! ( "original_dst_ipv6 on non-redirected socket should fail" ) ,
1632- Err ( err) => assert_eq ! ( err. raw_os_error( ) , Some ( libc :: EOPNOTSUPP ) ) ,
1653+ Err ( err) => assert_eq ! ( err. raw_os_error( ) , expected_v4 ) ,
16331654 }
16341655}
16351656
0 commit comments