@@ -1600,36 +1600,57 @@ fn header_included_ipv6() {
1600
1600
#[ test]
1601
1601
#[ cfg( all(
1602
1602
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
+ )
1604
1609
) ) ]
1605
1610
fn original_dst ( ) {
1606
1611
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
+
1607
1617
match socket. original_dst ( ) {
1608
1618
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 ) ,
1610
1620
}
1611
1621
1612
1622
let socket = Socket :: new ( Domain :: IPV6 , Type :: STREAM , None ) . unwrap ( ) ;
1613
1623
match socket. original_dst ( ) {
1614
1624
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 ) ,
1616
1626
}
1617
1627
}
1618
1628
1619
1629
#[ 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
+ ) ) ]
1621
1634
fn original_dst_ipv6 ( ) {
1622
1635
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 ) ;
1623
1644
match socket. original_dst_ipv6 ( ) {
1624
1645
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 ) ,
1626
1647
}
1627
1648
1628
1649
// Not supported on IPv4 socket.
1629
1650
let socket = Socket :: new ( Domain :: IPV4 , Type :: STREAM , None ) . unwrap ( ) ;
1630
1651
match socket. original_dst_ipv6 ( ) {
1631
1652
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 ) ,
1633
1654
}
1634
1655
}
1635
1656
0 commit comments