Commit 2540487f by Edward Thomson

Merge pull request #3108 from libgit2/cmn/ssl-no-want

openssl: don't try to handle WANT_READ or WANT_WRITE
parents ca183d27 77bffc2c
...@@ -291,19 +291,14 @@ ssize_t openssl_write(git_stream *stream, const char *data, size_t len, int flag ...@@ -291,19 +291,14 @@ ssize_t openssl_write(git_stream *stream, const char *data, size_t len, int flag
{ {
openssl_stream *st = (openssl_stream *) stream; openssl_stream *st = (openssl_stream *) stream;
int ret; int ret;
size_t off = 0;
GIT_UNUSED(flags); GIT_UNUSED(flags);
while (off < len) { if ((ret = SSL_write(st->ssl, data, len)) <= 0) {
ret = SSL_write(st->ssl, data + off, len - off); return ssl_set_error(st->ssl, ret);
if (ret <= 0 && ret != SSL_ERROR_WANT_WRITE) }
return ssl_set_error(st->ssl, ret);
off += ret;
}
return off; return ret;
} }
ssize_t openssl_read(git_stream *stream, void *data, size_t len) ssize_t openssl_read(git_stream *stream, void *data, size_t len)
...@@ -311,14 +306,8 @@ ssize_t openssl_read(git_stream *stream, void *data, size_t len) ...@@ -311,14 +306,8 @@ ssize_t openssl_read(git_stream *stream, void *data, size_t len)
openssl_stream *st = (openssl_stream *) stream; openssl_stream *st = (openssl_stream *) stream;
int ret; int ret;
do { if ((ret = SSL_read(st->ssl, data, len)) <= 0)
ret = SSL_read(st->ssl, data, len);
} while (SSL_get_error(st->ssl, ret) == SSL_ERROR_WANT_READ);
if (ret < 0) {
ssl_set_error(st->ssl, ret); ssl_set_error(st->ssl, ret);
return -1;
}
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment