Send a file, possibly by using an efficient sendfile() call if the system supports it. Return the total number of bytes sent.
(self, file, offset=0, count=None)
| 1306 | return super().sendall(data, flags) |
| 1307 | |
| 1308 | def sendfile(self, file, offset=0, count=None): |
| 1309 | """Send a file, possibly by using an efficient sendfile() call if |
| 1310 | the system supports it. Return the total number of bytes sent. |
| 1311 | """ |
| 1312 | if self._sslobj is None: |
| 1313 | return super().sendfile(file, offset, count) |
| 1314 | |
| 1315 | if not self._sslobj.uses_ktls_for_send(): |
| 1316 | return self._sendfile_use_send(file, offset, count) |
| 1317 | |
| 1318 | sendfile = getattr(self._sslobj, "sendfile", None) |
| 1319 | if sendfile is None: |
| 1320 | return self._sendfile_use_send(file, offset, count) |
| 1321 | |
| 1322 | try: |
| 1323 | return self._sendfile_zerocopy( |
| 1324 | sendfile, _GiveupOnSSLSendfile, file, offset, count, |
| 1325 | ) |
| 1326 | except _GiveupOnSSLSendfile: |
| 1327 | return self._sendfile_use_send(file, offset, count) |
| 1328 | |
| 1329 | def recv(self, buflen=1024, flags=0): |
| 1330 | self._checkClosed() |
no test coverage detected