Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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