Module: wine Branch: master Commit: c6097cafddd118baf83eb65a97a9d9805521b118 URL: http://source.winehq.org/git/wine.git/?a=commit;h=c6097cafddd118baf83eb65a97...
Author: Piotr Caban piotr@codeweavers.com Date: Mon May 17 11:55:24 2010 +0200
wininet: Deal with reading over the end in NETCON_recv.
---
dlls/wininet/netconnection.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index c2560b5..bb89517 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;