From 1aa89e25dd1c578b96dd67771e70174a7e62f8c7 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Mon, 17 Sep 2012 16:26:24 +0200 Subject: [PATCH] Return 0 on reads where the SSL layer needs more data to proceed --- src/SSLSocket.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SSLSocket.m b/src/SSLSocket.m index 5354e5d..1a7d909 100644 --- a/src/SSLSocket.m +++ b/src/SSLSocket.m @@ -270,10 +270,14 @@ ssl_locking_callback(int mode, int n, const char *file, int line) @throw e; } - if ((ret = SSL_read(ssl, buffer, (int)length)) < 0) + if ((ret = SSL_read(ssl, buffer, (int)length)) < 0) { + if (SSL_get_error(ssl, ret) == SSL_ERROR_WANT_READ) + return 0; + @throw [OFReadFailedException exceptionWithClass: [self class] stream: self requestedLength: length]; + } if (ret == 0) atEndOfStream = YES;