diff --git a/lib/dict.c b/lib/dict.c
index 8c5540264a4d870e75e1c5a31d10f7b437a780b6..241781ab924f1255104ff204654c2daf8949fb88 100644
--- a/lib/dict.c
+++ b/lib/dict.c
@@ -31,17 +31,18 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#ifdef WIN32
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
@@ -60,9 +61,6 @@
 #include <sys/select.h>
 #endif
 
-
-#endif
-
 #include "urldata.h"
 #include <curl/curl.h>
 #include "transfer.h"
diff --git a/lib/easy.c b/lib/easy.c
index 37b19554386ec7263bedf1c595db734e4c3b829d..30daf15854f62a0ec3d7d311b4ad441dbbe5f86a 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -29,11 +29,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include "strequal.h"
-
-#ifdef WIN32
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -60,8 +55,7 @@
 #include <sys/param.h>
 #endif
 
-#endif  /* WIN32 ... */
-
+#include "strequal.h"
 #include "urldata.h"
 #include <curl/curl.h>
 #include "transfer.h"
diff --git a/lib/file.c b/lib/file.c
index 8df6f37feb1909481f22c51d98adb0152be1ccc9..c29b0c9f81400e83c24722ab18fa71a9cdbf7038 100644
--- a/lib/file.c
+++ b/lib/file.c
@@ -30,10 +30,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#ifdef WIN32
-#include <io.h>
-#include <fcntl.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -64,8 +60,6 @@
 #include <fcntl.h>
 #endif
 
-#endif /* WIN32 */
-
 #include "strtoofft.h"
 #include "urldata.h"
 #include <curl/curl.h>
diff --git a/lib/gopher.c b/lib/gopher.c
index 8447d3fa4cf8073590240782e406c28d5bd0300c..dc9c134b5acd286e1cc24f8810caa11396d2df90 100644
--- a/lib/gopher.c
+++ b/lib/gopher.c
@@ -31,17 +31,18 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#ifdef WIN32
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
@@ -60,9 +61,6 @@
 #include <sys/select.h>
 #endif
 
-
-#endif
-
 #include "urldata.h"
 #include <curl/curl.h>
 #include "transfer.h"
diff --git a/lib/http.c b/lib/http.c
index cc01636c2afec5595ee63ebc7d2a229083fbc3ee..be0149cb92f78fde5a07743f3c6a920f070fa18e 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -30,9 +30,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#ifdef WIN32
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -60,8 +57,6 @@
 #include <sys/param.h>
 #endif
 
-#endif
-
 #include "urldata.h"
 #include <curl/curl.h>
 #include "transfer.h"
diff --git a/lib/ssh.c b/lib/ssh.c
index 841caa9688d8438e9f20ab9972c719a11c5b0ee8..dff1e128668e8a1ff640ed6af36f6486d38912aa 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -25,6 +25,7 @@
 #include "setup.h"
 
 #ifdef USE_LIBSSH2
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -45,7 +46,6 @@
 #include <fcntl.h>
 #endif
 
-#ifndef WIN32
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -65,7 +65,6 @@
 #include <in.h>
 #include <inet.h>
 #endif
-#endif /* !WIN32 */
 
 #if (defined(NETWARE) && defined(__NOVELL_LIBC__))
 #undef in_addr_t
diff --git a/lib/telnet.c b/lib/telnet.c
index 2ae6e0ce2aa7d457d8f477adcaa1fb38da82a0c8..5835e00cb8a529e408d220ea5983bf057d6dae34 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -30,17 +30,18 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#if defined(WIN32)
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
@@ -55,8 +56,6 @@
 #include <sys/param.h>
 #endif
 
-#endif  /* WIN32 */
-
 #include "urldata.h"
 #include <curl/curl.h>
 #include "transfer.h"
diff --git a/lib/tftp.c b/lib/tftp.c
index 5bb0bd5b3f27c6e6096b957a57024e8d33cef34a..73ce7aa08f95dd1864960d5a2aa631aaa533578c 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -29,17 +29,18 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#if defined(WIN32)
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
+#ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
+#endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#ifdef HAVE_NETDB_H
 #include <netdb.h>
+#endif
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
@@ -54,8 +55,6 @@
 #include <sys/param.h>
 #endif
 
-#endif /* WIN32 */
-
 #include "urldata.h"
 #include <curl/curl.h>
 #include "transfer.h"
diff --git a/lib/transfer.c b/lib/transfer.c
index 656e5ccb1f688fc2f99e952d1684d9ce6880effe..718507e1b8ca5e20f57e6ee0c63a503d5c07d2d9 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -33,9 +33,6 @@
 #include "strequal.h"
 #include "rawstr.h"
 
-#ifdef WIN32
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -73,8 +70,6 @@
 #error "We can't compile without socket() support!"
 #endif
 
-#endif  /* WIN32 */
-
 #include "urldata.h"
 #include <curl/curl.h>
 #include "netrc.h"
diff --git a/lib/url.c b/lib/url.c
index f2bd6a0c7401500212771da42d6c186ed6c63dce..39e9bab5da58a6e63a6a876b8983272403f27f00 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -30,9 +30,6 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#ifdef WIN32
-#include <io.h>
-#else
 #ifdef HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -68,8 +65,6 @@
 #error "We can't compile without socket() support!"
 #endif
 
-#endif  /* WIN32 */
-
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif