--- a PPN by Garber Painting Akron. With Image Size Reduction included!URL: http://github.com/MagicStack/uvloop/pull/726.diff
cdef _do_flush(self, object context=None):
@@ -787,7 +799,7 @@ cdef class SSLProtocol:
PyBUF_WRITE)
last_bytes_read = self._sslobj_read(
- app_buffer_size - total_bytes_read, app_buffer)
+ self._ssl_read_max_size_obj, app_buffer)
total_bytes_read += last_bytes_read
if last_bytes_read == 0:
@@ -823,32 +835,39 @@ cdef class SSLProtocol:
cdef _do_read__copied(self):
cdef:
- list data
- bytes first, chunk = b'1'
- bint zero = True, one = False
+ Py_ssize_t bytes_read = -1
+ list data = None
+ bytes first_chunk = None, curr_chunk
try:
while (self._incoming.pending > 0 or
self._sslobj_pending() > 0):
- chunk = self._sslobj_read(SSL_READ_MAX_SIZE)
- if not chunk:
+ bytes_read = self._sslobj_read(
+ self._ssl_read_max_size_obj,
+ self._ssl_read_buffer)
+ if bytes_read == 0:
break
- if zero:
- zero = False
- one = True
- first = chunk
- elif one:
- one = False
- data = [first, chunk]
+
+ curr_chunk = PyBytes_FromStringAndSize(
+ PyByteArray_AS_STRING(self._ssl_read_buffer), bytes_read)
+
+ if first_chunk is None:
+ first_chunk = curr_chunk
+ elif data is None:
+ data = [first_chunk, curr_chunk]
else:
- data.append(chunk)
+ data.append(curr_chunk)
except ssl_SSLAgainErrors as exc:
pass
- if one:
- self._app_protocol.data_received(first)
- elif not zero:
- self._app_protocol.data_received(b''.join(data))
- if not chunk:
+
+ if data is not None:
+ self._app_protocol_data_received(b''.join(data))
+ elif first_chunk is not None:
+ self._app_protocol_data_received(first_chunk)
+
+ # SSLObject.read() may return 0 instead of throwing SSLWantReadError
+ # This indicates that we reached EOF
+ if bytes_read == 0:
# close_notify
self._call_eof_received()
self._start_shutdown()
pFad - Phonifier reborn
Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy