Fix IMAP connection issue with default_socket_timeout < 0 and imap_timeout < 0 (#1489090)