From c6097cafddd118baf83eb65a97a9d9805521b118 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 17 May 2010 11:55:24 +0200 Subject: [PATCH] wininet: Deal with reading over the end in NETCON_recv. --- dlls/wininet/netconnection.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index c2560b5da37..bb89517eaa4 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -134,6 +134,7 @@ MAKE_FUNCPTR(SSL_shutdown); MAKE_FUNCPTR(SSL_write); MAKE_FUNCPTR(SSL_read); MAKE_FUNCPTR(SSL_pending); +MAKE_FUNCPTR(SSL_get_error); MAKE_FUNCPTR(SSL_get_ex_new_index); MAKE_FUNCPTR(SSL_get_ex_data); MAKE_FUNCPTR(SSL_set_ex_data); @@ -392,6 +393,7 @@ DWORD NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) DYNSSL(SSL_write); DYNSSL(SSL_read); DYNSSL(SSL_pending); + DYNSSL(SSL_get_error); DYNSSL(SSL_get_ex_new_index); DYNSSL(SSL_get_ex_data); DYNSSL(SSL_set_ex_data); @@ -772,6 +774,12 @@ DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int { #ifdef SONAME_LIBSSL *recvd = pSSL_read(connection->ssl_s, buf, len); + + /* Check if EOF was received */ + if(!*recvd && (pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_ZERO_RETURN + || pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_SYSCALL)) + return ERROR_SUCCESS; + return *recvd > 0 ? ERROR_SUCCESS : ERROR_INTERNET_CONNECTION_ABORTED; #else return ERROR_NOT_SUPPORTED;