network 3.1.2.9 → 3.1.3.0
raw patch · 10 files changed
+56/−32 lines, 10 files
Files
- CHANGELOG.md +5/−0
- Network/Socket/Unix.hsc +3/−1
- Network/Socket/Win32/Cmsg.hsc +4/−0
- configure +9/−9
- configure.ac +1/−1
- include/HsNet.h +1/−0
- include/HsNetDef.h +1/−3
- include/afunix_compat.h +23/−0
- network.cabal +2/−1
- tests/Network/SocketSpec.hs +7/−17
CHANGELOG.md view
@@ -1,3 +1,8 @@+## Version 3.1.3.0++* Supporting AF_UNIX on Windows+ [#553](https://github.com/haskell/network/issues/553)+ ## Version 3.1.2.9 * Resolving the runtime linker problem on Windows.
Network/Socket/Unix.hsc view
@@ -17,7 +17,9 @@ import Network.Socket.Buffer import Network.Socket.Imports-#if !defined(mingw32_HOST_OS)+#if defined(mingw32_HOST_OS)+import Network.Socket.Win32.Cmsg+#else import Network.Socket.Posix.Cmsg #endif import Network.Socket.Types
Network/Socket/Win32/Cmsg.hsc view
@@ -12,6 +12,7 @@ #include "HsNet.h" import Data.ByteString.Internal+import System.Posix.Types (Fd(..)) import Foreign.ForeignPtr import System.IO.Unsafe (unsafeDupablePerformIO) @@ -190,6 +191,9 @@ In6Addr ha6 <- (#peek IN6_PKTINFO, ipi6_addr) p n :: ULONG <- (#peek IN6_PKTINFO, ipi6_ifindex) p return $ IPv6PktInfo (fromIntegral n) ha6++instance ControlMessage Fd where+ controlMessageId = CmsgIdFd cmsgIdBijection :: Bijection CmsgId String cmsgIdBijection =
configure view
@@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles.-# Generated by GNU Autoconf 2.69 for Haskell network package 3.1.2.9.+# Generated by GNU Autoconf 2.69 for Haskell network package 3.1.3.0. # # Report bugs to <libraries@haskell.org>. #@@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Haskell network package' PACKAGE_TARNAME='network'-PACKAGE_VERSION='3.1.2.9'-PACKAGE_STRING='Haskell network package 3.1.2.9'+PACKAGE_VERSION='3.1.3.0'+PACKAGE_STRING='Haskell network package 3.1.3.0' PACKAGE_BUGREPORT='libraries@haskell.org' PACKAGE_URL='' @@ -1234,7 +1234,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF-\`configure' configures Haskell network package 3.1.2.9 to adapt to many kinds of systems.+\`configure' configures Haskell network package 3.1.3.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1299,7 +1299,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in- short | recursive ) echo "Configuration of Haskell network package 3.1.2.9:";;+ short | recursive ) echo "Configuration of Haskell network package 3.1.3.0:";; esac cat <<\_ACEOF @@ -1384,7 +1384,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF-Haskell network package configure 3.1.2.9+Haskell network package configure 3.1.3.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc.@@ -1910,7 +1910,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Haskell network package $as_me 3.1.2.9, which was+It was created by Haskell network package $as_me 3.1.3.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@@@ -4419,7 +4419,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log="-This file was extended by Haskell network package $as_me 3.1.2.9, which was+This file was extended by Haskell network package $as_me 3.1.3.0, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES@@ -4472,7 +4472,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\-Haskell network package config.status 3.1.2.9+Haskell network package config.status 3.1.3.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\"
configure.ac view
@@ -1,5 +1,5 @@ AC_INIT([Haskell network package],- [3.1.2.9],+ [3.1.3.0], [libraries@haskell.org], [network])
include/HsNet.h view
@@ -29,6 +29,7 @@ # include <ws2tcpip.h> # include <mswsock.h> # include "win32defs.h"+# include "afunix_compat.h" # define IPV6_V6ONLY 27 #endif
include/HsNetDef.h view
@@ -10,9 +10,7 @@ #undef PACKAGE_TARNAME #undef PACKAGE_VERSION -#if !defined(mingw32_HOST_OS) && !defined(_WIN32)-# define DOMAIN_SOCKET_SUPPORT 1-#endif+#define DOMAIN_SOCKET_SUPPORT 1 #if defined(HAVE_STRUCT_UCRED) && HAVE_DECL_SO_PEERCRED # define HAVE_STRUCT_UCRED_SO_PEERCRED 1
+ include/afunix_compat.h view
@@ -0,0 +1,23 @@+/* The version of afunix.h provided by the version of MSYS2 included with x86 + * versions of GHC before GHC 9.2 excludes certain components introduced with + * Windows Vista. + */ + +#ifndef AFUNIX_COMPAT_H +#define AFUNIX_COMPAT_H + +#if defined(_AFUNIX_) || !defined(_WIN32) || __GLASGOW_HASKELL__ > 902 +# include <afunix.h> +#else + +#define UNIX_PATH_MAX 108 + +typedef struct sockaddr_un { + ADDRESS_FAMILY sun_family; + char sun_path[UNIX_PATH_MAX]; +} SOCKADDR_UN, *PSOCKADDR_UN; + +#define SIO_AF_UNIX_GETPEERPID _WSAIOR(IOC_VENDOR, 256) + +#endif /* GHC version check */ +#endif /* AFUNIX_COMPAT_H */
network.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: network-version: 3.1.2.9+version: 3.1.3.0 license: BSD3 license-file: LICENSE maintainer: Kazu Yamamoto, Evan Borden@@ -66,6 +66,7 @@ include/HsNetworkConfig.h.in include/HsNet.h include/HsNetDef.h+ include/afunix_compat.h cbits/asyncAccept.c cbits/initWinSock.c cbits/winSockErr.c
tests/Network/SocketSpec.hs view
@@ -12,7 +12,7 @@ import Network.Socket.ByteString import Network.Test.Common import System.Mem (performGC)-import System.IO.Error (tryIOError, isAlreadyInUseError)+import System.IO.Error (tryIOError) import System.IO.Temp (withSystemTempDirectory) import Foreign.C.Types () @@ -70,9 +70,12 @@ bind sock (addrAddress addr) `shouldThrow` anyIOException #endif - it "successfully binds to a unix socket, twice" $ do+ it "successfully binds to a unix socket" $ do withSystemTempDirectory "haskell-network" $ \path -> do let sfile = path ++ "/socket-file"+ -- exist <- doesFileExist sfile+ -- when exist $ removeFile sfile+ -- removeFile sfile let addr = SockAddrUnix sfile when (isSupportedSockAddr addr) $ do sock0 <- socket AF_UNIX Stream defaultProtocol@@ -82,23 +85,10 @@ sock1 <- socket AF_UNIX Stream defaultProtocol tryIOError (bind sock1 addr) >>= \o -> case o of Right () -> error "bind should have failed but succeeded"- Left e | not (isAlreadyInUseError e) -> ioError e- _ -> return ()+ _ -> return () close sock0-- -- Unix systems tend to leave the file existing, which is- -- why our `bind` does its workaround. however if any- -- system in the future does fix this issue, we don't want- -- this test to fail, since that would defeat the purpose- -- of our workaround. but you can uncomment the below lines- -- if you want to play with this on your own system.- --import System.Directory (doesPathExist)- --ex <- doesPathExist sfile- --unless ex $ error "socket file was deleted unexpectedly"-- sock2 <- socket AF_UNIX Stream defaultProtocol- bind sock2 addr+ close sock1 describe "UserTimeout" $ do it "can be set" $ do