Index: net/socket/ssl_client_socket_openssl.cc |
diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc |
index 04be9881e170f4ca6289ee17f15c1e99642c4ebf..953f3363806cd25c7977b318804154fa6c49eef5 100644 |
--- a/net/socket/ssl_client_socket_openssl.cc |
+++ b/net/socket/ssl_client_socket_openssl.cc |
@@ -1363,6 +1363,15 @@ int SSLClientSocketOpenSSL::DoPayloadRead() { |
} else if (*next_result < 0) { |
int err = SSL_get_error(ssl_, *next_result); |
*next_result = MapOpenSSLError(err, err_tracer); |
+ |
+ // Many servers do not reliably send a close_notify alert when shutting |
+ // down a connection, and instead terminate the TCP connection. This is |
+ // reported as ERR_CONNECTION_CLOSED. Because of this, map the unclean |
+ // shutdown to a graceful EOF, instead of treating it as an error as it |
+ // should be. |
+ if (*next_result == ERR_CONNECTION_CLOSED) |
+ *next_result = 0; |
+ |
if (rv > 0 && *next_result == ERR_IO_PENDING) { |
// If at least some data was read from SSL_read(), do not treat |
// insufficient data as an error to return in the next call to |