Example #1
0
 def sendall(self, data, flags=0):
     try:
         socket.sendall(self, data)
     except _socket_timeout as ex:
         if self.timeout == 0.0:
             # Python 2 simply *hangs* in this case, which is bad, but
             # Python 3 raises SSLWantWriteError. We do the same.
             raise SSLError(SSL_ERROR_WANT_WRITE)
         # Convert the socket.timeout back to the sslerror
         raise SSLError(*ex.args)
Example #2
0
    def sendall(self, data, flags=0):
        self._checkClosed()
        self.__check_flags('sendall', flags)

        try:
            socket.sendall(self, data)
        except _socket_timeout as ex:
            if self.timeout == 0.0:
                # Python 2 simply *hangs* in this case, which is bad, but
                # Python 3 raises SSLWantWriteError. We do the same.
                raise SSLWantWriteError("The operation did not complete (write)")
            # Convert the socket.timeout back to the sslerror
            raise SSLError(*ex.args)
Example #3
0
 def sendall(self, data, flags=0):
     self._checkClosed()
     if self._sslobj:
         if flags != 0:
             raise ValueError("non-zero flags not allowed in calls to sendall() on %s" % self.__class__)
         amount = len(data)
         count = 0
         while count < amount:
             v = self.send(data[count:])
             count += v
         return amount
     else:
         return socket.sendall(self, data, flags)
Example #4
0
    def sendall(self, data, flags=0):
        self._checkClosed()
        if self._sslobj:
            if flags != 0:
                raise ValueError(
                    "non-zero flags not allowed in calls to sendall() on %s" %
                    self.__class__)

        try:
            return socket.sendall(self, data, flags)
        except _socket_timeout:
            if self.timeout == 0.0:
                # Raised by the stdlib on non-blocking sockets
                raise SSLWantWriteError("The operation did not complete (write)")
            raise
Example #5
0
    def sendall(self, data, flags=0):
        self._checkClosed()
        if self._sslobj:
            if flags != 0:
                raise ValueError(
                    "non-zero flags not allowed in calls to sendall() on %s" %
                    self.__class__)

        try:
            return socket.sendall(self, data, flags)
        except _socket_timeout:
            if self.timeout == 0.0:
                # Raised by the stdlib on non-blocking sockets
                raise SSLWantWriteError("The operation did not complete (write)")
            raise