TCPKeepAliveAdapter will be broken on Windows
See also: https://bugs.launchpad.net/python-keystoneclient/+bug/1483696
In short, there are some socket constants not defined on Windows.
Grrrr, Windows!
Even more fun, you can control this stuff on Windows with SIO_SOCKET_VALS (if I'm remembering the constant correctly), but you can't set that with socket.set_option you have to use socket.ioctl which means urllib3's socket_options wouldn't work for this.
Looks like you can get around the adapter breaking in windows by monkey patching these two variables:
socket.TCP_KEEPINTVL = 10
socket.TCP_KEEPCNT = 20
socket_options.TCPKeepAliveAdapter()
(Not to confuse anyone, it still doesn't seem to work on Windows!)
Anyone aware of a way to configure this socket behavior in the code without having established a socket? I've avoided delving into requests thus far, and so the only way I have found is the following (REF):
this_socket = socket.fromfd(response.raw.fileno(), socket.AF_INET, socket.SOCK_STREAM)
this_socket.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 10000, 3000))
This appears to manually send the keep alive if anyone is interested.
this_socket.send(b'00', socket.MSG_OOB | socket.MSG_DONTROUTE)
This is a good link for reference on Windows behaviors: https://blogs.technet.microsoft.com/nettracer/2010/06/03/things-that-you-may-want-to-know-about-tcp-keepalives