set_read_funcs() breaks I/O on Windows
Description of problem:
GnuTLS code calls
set_read_funcs() at some points. On non-Windows platforms that function is a no-op. On Windows it replaces session push and pull functions with
This means that even if the client code (such as GnuTLS's own
gnutls_transport_set_push_function() to set some custom push function, GnuTLS will later set it back to the defaults. Because
socket_open2() also sets the transport ptr as a pointer to a custom struct that holds, among other things, the socket descriptor, using
system_*() functions with that ptr leads to EBADF errors.
Version of gnutls used:
Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
Steps to Reproduce:
- Build GnuTLS with MinGW
*** Fatal error: Error in the push function. Could not connect to 22.214.171.124:443: Bad file descriptor
It should be noted that
gnutls_init() will also set session push and pull functions to
system_read(). At first glance it doesn't make sense for GnuTLS to do that again later on.