|
|
087f9f |
From 122c80853a9bd66f21699fc79a689b3028d00d3b Mon Sep 17 00:00:00 2001
|
|
|
087f9f |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
087f9f |
Date: Fri, 17 Aug 2018 13:08:44 +0200
|
|
|
087f9f |
Subject: [PATCH] Move SSL_ERROR_WANT_READ/SSL_ERROR_WANT_WRITE retry from
|
|
|
087f9f |
write_partial()
|
|
|
087f9f |
MIME-Version: 1.0
|
|
|
087f9f |
Content-Type: text/plain; charset=UTF-8
|
|
|
087f9f |
Content-Transfer-Encoding: 8bit
|
|
|
087f9f |
|
|
|
087f9f |
Original OpenSSL 1.1.1 fix broke IO-Socket-SSL-2.058's t/nonblock.t test
|
|
|
087f9f |
because it tests non-blocking socket operations and expects to see
|
|
|
087f9f |
SSL_ERROR_WANT_WRITE errors and to handle them byt itself.
|
|
|
087f9f |
|
|
|
087f9f |
This patch purifies Net::SSLeay::write_partial() to behave exactly as
|
|
|
087f9f |
underlying OpenSSL SSL_write() function. The retry is already
|
|
|
087f9f |
presented in Net::SSLeay::ssl_write_all().
|
|
|
087f9f |
|
|
|
087f9f |
All applications should implement the retry themsleves or use
|
|
|
087f9f |
ssl_*_all() instead.
|
|
|
087f9f |
|
|
|
087f9f |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
087f9f |
---
|
|
|
087f9f |
SSLeay.xs | 16 ++--------------
|
|
|
087f9f |
lib/Net/SSLeay.pod | 3 ++-
|
|
|
087f9f |
2 files changed, 4 insertions(+), 15 deletions(-)
|
|
|
087f9f |
|
|
|
087f9f |
diff --git a/SSLeay.xs b/SSLeay.xs
|
|
|
087f9f |
index 7cb6eab..fc7677f 100644
|
|
|
087f9f |
--- a/SSLeay.xs
|
|
|
087f9f |
+++ b/SSLeay.xs
|
|
|
087f9f |
@@ -2089,20 +2089,8 @@ SSL_write_partial(s,from,count,buf)
|
|
|
087f9f |
if (len < 0) {
|
|
|
087f9f |
croak("from beyound end of buffer");
|
|
|
087f9f |
RETVAL = -1;
|
|
|
087f9f |
- } else {
|
|
|
087f9f |
- int ret;
|
|
|
087f9f |
- int err;
|
|
|
087f9f |
-
|
|
|
087f9f |
- do {
|
|
|
087f9f |
- ret = SSL_write (s, &(buf[from]), (count<=len)?count:len);
|
|
|
087f9f |
- if (ret > 0)
|
|
|
087f9f |
- break;
|
|
|
087f9f |
- err = SSL_get_error(s, ret);
|
|
|
087f9f |
- if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE)
|
|
|
087f9f |
- break;
|
|
|
087f9f |
- } while (1);
|
|
|
087f9f |
- RETVAL = ret;
|
|
|
087f9f |
- }
|
|
|
087f9f |
+ } else
|
|
|
087f9f |
+ RETVAL = SSL_write (s, &(buf[from]), (count<=len)?count:len);
|
|
|
087f9f |
OUTPUT:
|
|
|
087f9f |
RETVAL
|
|
|
087f9f |
|
|
|
087f9f |
diff --git a/lib/Net/SSLeay.pod b/lib/Net/SSLeay.pod
|
|
|
087f9f |
index bca7be4..8b5f738 100644
|
|
|
087f9f |
--- a/lib/Net/SSLeay.pod
|
|
|
087f9f |
+++ b/lib/Net/SSLeay.pod
|
|
|
087f9f |
@@ -4819,7 +4819,8 @@ Check openssl doc L
|
|
|
087f9f |
|
|
|
087f9f |
B<NOTE:> Does not exactly correspond to any low level API function
|
|
|
087f9f |
|
|
|
087f9f |
-Writes a fragment of data in $data from the buffer $data into the specified $ssl connection.
|
|
|
087f9f |
+Writes a fragment of data in $data from the buffer $data into the specified
|
|
|
087f9f |
+$ssl connection. This is a non-blocking function like L<Net::SSLeay::write()>.
|
|
|
087f9f |
|
|
|
087f9f |
my $rv = Net::SSLeay::write_partial($ssl, $from, $count, $data);
|
|
|
087f9f |
# $ssl - value corresponding to openssl's SSL structure
|
|
|
087f9f |
--
|
|
|
087f9f |
2.14.4
|
|
|
087f9f |
|