Skip to content

Commit

Permalink
WSAPoll: disabled on all windows builds
Browse files Browse the repository at this point in the history
Due to WSAPoll bugs, libcurl does not work as intended. When the cURL
library is used to setup a connection to an incorrect port, normally the
result is CURLE_COULDNT_CONNECT, /* 7 */, but due to the bug in WSAPoll,
the result now is CURLE_OPERATION_TIMEDOUT, /* 28 - the timeout time was
reached */.

On August 1, Jan Koen Annot opened a case for this to Microsoft Premier
Online (https://premier.microsoft.com/).  The support engineer handling
the case wrote that the case description is quite clear.  He will try to
reproduce the issue and then proceed with troubleshooting it.

Reported by: Jan Koen Annot
Bug: http://curl.haxx.se/mail/lib-2012-07/0310.html
  • Loading branch information
bagder committed Aug 7, 2012
1 parent f0d611d commit 8bad5f2
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions lib/select.h
Expand Up @@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
Expand All @@ -30,24 +30,6 @@
#include <poll.h>
#endif

/*
* poll() function on Windows Vista and later is called WSAPoll()
*/

#if defined(USE_WINSOCK) && (USE_WINSOCK > 1) && \
defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
# undef HAVE_POLL
# define HAVE_POLL 1
# undef HAVE_POLL_FINE
# define HAVE_POLL_FINE 1
# define poll(x,y,z) WSAPoll((x),(y),(z))
# if defined(_MSC_VER) && defined(POLLRDNORM)
# undef POLLPRI
# define POLLPRI POLLRDBAND
# define HAVE_STRUCT_POLLFD 1
# endif
#endif

/*
* Definition of pollfd struct and constants for platforms lacking them.
*/
Expand Down

4 comments on commit 8bad5f2

@pliu6
Copy link

@pliu6 pliu6 commented on 8bad5f2 Jul 15, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, has the bug of WSAPoll() been fixed?

@bagder
Copy link
Member Author

@bagder bagder commented on 8bad5f2 Jul 16, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The buggy WSAPoll() is provided by Microsoft and they won't fix it. I have no intention of writing a work-around (partly because I don't use windows and can't test such a change myself), although it should probably be possible for someone to do it.

@chen3feng
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the recent Microsoft document, it is fixed:
https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll

Note As of Windows 10 version 2004, when a TCP socket fails to connect, (POLLHUP | POLLERR | POLLWRNORM) is indicated.

@bagder
Copy link
Member Author

@bagder bagder commented on 8bad5f2 Oct 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out. "Someone" should do some extensive tests to see if we can switch to WSAPoll() given the right circumstances.

Please sign in to comment.