Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
test.test_ftplib.DummyTLS_DTPHandler Class Reference
Inheritance diagram for test.test_ftplib.DummyTLS_DTPHandler:
Inheritance graph
[legend]
Collaboration diagram for test.test_ftplib.DummyTLS_DTPHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def secure_connection
def handle_read_event
def handle_write_event
def send
def recv
def handle_error
def close
def __repr__
def add_channel
def del_channel
def create_socket
def set_socket
def handle_read
def handle_close
def push
def handle_error
def collect_incoming_data
def found_terminator
def set_terminator
def get_terminator
def handle_write
def push_with_producer
def readable
def writable
def close_when_done
def initiate_send
def discard_buffers
def __repr__
def add_channel
def del_channel
def create_socket
def set_socket

Public Attributes

 socket
 family_and_type
 baseclass
 ac_in_buffer
 incoming
 producer_fifo
 terminator
 family_and_type

Static Public Attributes

 debug = False
 connected = False
 accepting = False
 closing = False
 addr = None
tuple ignore_log_types = frozenset(['warning'])
 dtp_conn_closed = False
int ac_in_buffer_size = 4096
int ac_out_buffer_size = 4096
int use_encoding = 0
string encoding = 'latin1'
 debug = False
 connected = False
 accepting = False
 closing = False
 addr = None
tuple ignore_log_types = frozenset(['warning'])

Detailed Description

A DummyDTPHandler subclass supporting TLS/SSL.

Definition at line 367 of file test_ftplib.py.


Constructor & Destructor Documentation

def test.test_ftplib.DummyTLS_DTPHandler.__init__ (   self,
  conn,
  baseclass 
)

Reimplemented from test.test_ftplib.DummyDTPHandler.

Definition at line 370 of file test_ftplib.py.

00370 
00371         def __init__(self, conn, baseclass):
00372             DummyDTPHandler.__init__(self, conn, baseclass)
00373             if self.baseclass.secure_data_channel:
00374                 self.secure_connection()
00375 
00376 
    class DummyTLS_FTPHandler(SSLConnection, DummyFTPHandler):

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def asyncore.dispatcher.__repr__ (   self) [inherited]

Definition at line 264 of file asyncore.py.

00264 
00265     def __repr__(self):
00266         status = [self.__class__.__module__+"."+self.__class__.__name__]
00267         if self.accepting and self.addr:
00268             status.append('listening')
00269         elif self.connected:
00270             status.append('connected')
00271         if self.addr is not None:
00272             try:
00273                 status.append('%s:%d' % self.addr)
00274             except TypeError:
00275                 status.append(repr(self.addr))
00276         return '<%s at %#x>' % (' '.join(status), id(self))

def asyncore.dispatcher.__repr__ (   self) [inherited]

Definition at line 264 of file asyncore.py.

00264 
00265     def __repr__(self):
00266         status = [self.__class__.__module__+"."+self.__class__.__name__]
00267         if self.accepting and self.addr:
00268             status.append('listening')
00269         elif self.connected:
00270             status.append('connected')
00271         if self.addr is not None:
00272             try:
00273                 status.append('%s:%d' % self.addr)
00274             except TypeError:
00275                 status.append(repr(self.addr))
00276         return '<%s at %#x>' % (' '.join(status), id(self))

def asyncore.dispatcher.add_channel (   self,
  map = None 
) [inherited]

Definition at line 279 of file asyncore.py.

00279 
00280     def add_channel(self, map=None):
00281         #self.log_info('adding channel %s' % self)
00282         if map is None:
00283             map = self._map
00284         map[self._fileno] = self

Here is the caller graph for this function:

def asyncore.dispatcher.add_channel (   self,
  map = None 
) [inherited]

Definition at line 279 of file asyncore.py.

00279 
00280     def add_channel(self, map=None):
00281         #self.log_info('adding channel %s' % self)
00282         if map is None:
00283             map = self._map
00284         map[self._fileno] = self

Here is the caller graph for this function:

def test.test_ftplib.SSLConnection.close (   self) [inherited]

Definition at line 359 of file test_ftplib.py.

00359 
00360         def close(self):
00361             if (isinstance(self.socket, ssl.SSLSocket) and
00362                 self.socket._sslobj is not None):
00363                 self._do_ssl_shutdown()
00364             else:
00365                 super(SSLConnection, self).close()
00366 
00367 
    class DummyTLS_DTPHandler(SSLConnection, DummyDTPHandler):

Here is the call graph for this function:

Here is the caller graph for this function:

def asynchat.async_chat.close_when_done (   self) [inherited]

Definition at line 224 of file asynchat.py.

00224 
00225     def close_when_done (self):
00226         "automatically close this channel once the outgoing queue is empty"
00227         self.producer_fifo.append(None)

Here is the caller graph for this function:

def asynchat.async_chat.collect_incoming_data (   self,
  data 
) [inherited]

Reimplemented in smtpd.SMTPChannel, test.test_asynchat.echo_client, test.test_ftplib.DummyFTPHandler, and test.test_poplib.DummyPOP3Handler.

Definition at line 97 of file asynchat.py.

00097 
00098     def collect_incoming_data(self, data):
00099         raise NotImplementedError("must be implemented in subclass")

Here is the caller graph for this function:

def asyncore.dispatcher.create_socket (   self,
  family,
  type 
) [inherited]

Definition at line 294 of file asyncore.py.

00294 
00295     def create_socket(self, family, type):
00296         self.family_and_type = family, type
00297         sock = socket.socket(family, type)
00298         sock.setblocking(0)
00299         self.set_socket(sock)

Here is the caller graph for this function:

def asyncore.dispatcher.create_socket (   self,
  family,
  type 
) [inherited]

Definition at line 294 of file asyncore.py.

00294 
00295     def create_socket(self, family, type):
00296         self.family_and_type = family, type
00297         sock = socket.socket(family, type)
00298         sock.setblocking(0)
00299         self.set_socket(sock)

Here is the caller graph for this function:

def asyncore.dispatcher.del_channel (   self,
  map = None 
) [inherited]

Definition at line 285 of file asyncore.py.

00285 
00286     def del_channel(self, map=None):
00287         fd = self._fileno
00288         if map is None:
00289             map = self._map
00290         if fd in map:
00291             #self.log_info('closing channel %d:%s' % (fd, self))
00292             del map[fd]
00293         self._fileno = None

Here is the caller graph for this function:

def asyncore.dispatcher.del_channel (   self,
  map = None 
) [inherited]

Definition at line 285 of file asyncore.py.

00285 
00286     def del_channel(self, map=None):
00287         fd = self._fileno
00288         if map is None:
00289             map = self._map
00290         if fd in map:
00291             #self.log_info('closing channel %d:%s' % (fd, self))
00292             del map[fd]
00293         self._fileno = None

Here is the caller graph for this function:

def asynchat.async_chat.discard_buffers (   self) [inherited]

Definition at line 270 of file asynchat.py.

00270 
00271     def discard_buffers (self):
00272         # Emergencies only!
00273         self.ac_in_buffer = b''
00274         del self.incoming[:]
00275         self.producer_fifo.clear()

def asynchat.async_chat.found_terminator (   self) [inherited]

Reimplemented in smtpd.SMTPChannel, test.test_asynchat.echo_client, test.test_ftplib.DummyFTPHandler, and test.test_poplib.DummyPOP3Handler.

Definition at line 108 of file asynchat.py.

00108 
00109     def found_terminator(self):
00110         raise NotImplementedError("must be implemented in subclass")

Here is the caller graph for this function:

def asynchat.async_chat.get_terminator (   self) [inherited]

Definition at line 117 of file asynchat.py.

00117 
00118     def get_terminator (self):
00119         return self.terminator

Here is the caller graph for this function:

Reimplemented from asynchat.async_chat.

Definition at line 42 of file test_ftplib.py.

00042 
00043     def handle_close(self):
00044         # XXX: this method can be called many times in a row for a single
00045         # connection, including in clear-text (non-TLS) mode.
00046         # (behaviour witnessed with test_data_connection)
00047         if not self.dtp_conn_closed:
00048             self.baseclass.push('226 transfer complete')
00049             self.close()
00050             self.dtp_conn_closed = True

Here is the caller graph for this function:

Definition at line 54 of file test_ftplib.py.

00054 
00055     def handle_error(self):
00056         raise
00057 

Here is the caller graph for this function:

def test.test_ftplib.SSLConnection.handle_error (   self) [inherited]

Definition at line 356 of file test_ftplib.py.

00356 
00357         def handle_error(self):
00358             raise

Here is the caller graph for this function:

Reimplemented from asynchat.async_chat.

Definition at line 39 of file test_ftplib.py.

00039 
00040     def handle_read(self):
00041         self.baseclass.last_received_data += self.recv(1024).decode('ascii')

Here is the call graph for this function:

Definition at line 318 of file test_ftplib.py.

00318 
00319         def handle_read_event(self):
00320             if self._ssl_accepting:
00321                 self._do_ssl_handshake()
00322             elif self._ssl_closing:
00323                 self._do_ssl_shutdown()
00324             else:
00325                 super(SSLConnection, self).handle_read_event()

Here is the call graph for this function:

Here is the caller graph for this function:

def asynchat.async_chat.handle_write (   self) [inherited]

Definition at line 193 of file asynchat.py.

00193 
00194     def handle_write (self):
00195         self.initiate_send()

Here is the call graph for this function:

Definition at line 326 of file test_ftplib.py.

00326 
00327         def handle_write_event(self):
00328             if self._ssl_accepting:
00329                 self._do_ssl_handshake()
00330             elif self._ssl_closing:
00331                 self._do_ssl_shutdown()
00332             else:
00333                 super(SSLConnection, self).handle_write_event()

Here is the call graph for this function:

def asynchat.async_chat.initiate_send (   self) [inherited]

Definition at line 228 of file asynchat.py.

00228 
00229     def initiate_send(self):
00230         while self.producer_fifo and self.connected:
00231             first = self.producer_fifo[0]
00232             # handle empty string/buffer or None entry
00233             if not first:
00234                 del self.producer_fifo[0]
00235                 if first is None:
00236                     ## print("first is None")
00237                     self.handle_close()
00238                     return
00239                 ## print("first is not None")
00240 
00241             # handle classic producer behavior
00242             obs = self.ac_out_buffer_size
00243             try:
00244                 data = buffer(first, 0, obs)
00245             except TypeError:
00246                 data = first.more()
00247                 if data:
00248                     self.producer_fifo.appendleft(data)
00249                 else:
00250                     del self.producer_fifo[0]
00251                 continue
00252 
00253             if isinstance(data, str) and self.use_encoding:
00254                 data = bytes(data, self.encoding)
00255 
00256             # send the data
00257             try:
00258                 num_sent = self.send(data)
00259             except socket.error:
00260                 self.handle_error()
00261                 return
00262 
00263             if num_sent:
00264                 if num_sent < len(data) or obs < len(first):
00265                     self.producer_fifo[0] = first[num_sent:]
00266                 else:
00267                     del self.producer_fifo[0]
00268             # we tried to send some actual data
00269             return

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_ftplib.DummyDTPHandler.push (   self,
  what 
) [inherited]

Reimplemented from asynchat.async_chat.

Definition at line 51 of file test_ftplib.py.

00051 
00052     def push(self, what):
00053         super(DummyDTPHandler, self).push(what.encode('ascii'))

def asynchat.async_chat.push_with_producer (   self,
  producer 
) [inherited]

Definition at line 208 of file asynchat.py.

00208 
00209     def push_with_producer (self, producer):
00210         self.producer_fifo.append(producer)
00211         self.initiate_send()

Here is the call graph for this function:

def asynchat.async_chat.readable (   self) [inherited]

Definition at line 212 of file asynchat.py.

00212 
00213     def readable (self):
00214         "predicate for inclusion in the readable for select()"
00215         # cannot use the old predicate, it violates the claim of the
00216         # set_terminator method.
00217 
00218         # return (len(self.ac_in_buffer) <= self.ac_in_buffer_size)
00219         return 1

def test.test_ftplib.SSLConnection.recv (   self,
  buffer_size 
) [inherited]

Definition at line 344 of file test_ftplib.py.

00344 
00345         def recv(self, buffer_size):
00346             try:
00347                 return super(SSLConnection, self).recv(buffer_size)
00348             except ssl.SSLError as err:
00349                 if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
00350                                    ssl.SSL_ERROR_WANT_WRITE):
00351                     return b''
00352                 if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN):
00353                     self.handle_close()
00354                     return b''
00355                 raise

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 276 of file test_ftplib.py.

00276 
00277         def secure_connection(self):
00278             self.del_channel()
00279             socket = ssl.wrap_socket(self.socket, suppress_ragged_eofs=False,
00280                                      certfile=CERTFILE, server_side=True,
00281                                      do_handshake_on_connect=False,
00282                                      ssl_version=ssl.PROTOCOL_SSLv23)
00283             self.set_socket(socket)
00284             self._ssl_accepting = True

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_ftplib.SSLConnection.send (   self,
  data 
) [inherited]

Definition at line 334 of file test_ftplib.py.

00334 
00335         def send(self, data):
00336             try:
00337                 return super(SSLConnection, self).send(data)
00338             except ssl.SSLError as err:
00339                 if err.args[0] in (ssl.SSL_ERROR_EOF, ssl.SSL_ERROR_ZERO_RETURN,
00340                                    ssl.SSL_ERROR_WANT_READ,
00341                                    ssl.SSL_ERROR_WANT_WRITE):
00342                     return 0
00343                 raise

Here is the caller graph for this function:

def asyncore.dispatcher.set_socket (   self,
  sock,
  map = None 
) [inherited]

Definition at line 300 of file asyncore.py.

00300 
00301     def set_socket(self, sock, map=None):
        self.socket = sock

Here is the call graph for this function:

Here is the caller graph for this function:

def asyncore.dispatcher.set_socket (   self,
  sock,
  map = None 
) [inherited]

Definition at line 300 of file asyncore.py.

00300 
00301     def set_socket(self, sock, map=None):
        self.socket = sock

Here is the call graph for this function:

Here is the caller graph for this function:

def asynchat.async_chat.set_terminator (   self,
  term 
) [inherited]

Definition at line 111 of file asynchat.py.

00111 
00112     def set_terminator (self, term):
00113         "Set the input delimiter.  Can be a fixed string of any length, an integer, or None"
00114         if isinstance(term, str) and self.use_encoding:
00115             term = bytes(term, self.encoding)
00116         self.terminator = term

Here is the caller graph for this function:

def asynchat.async_chat.writable (   self) [inherited]

Definition at line 220 of file asynchat.py.

00220 
00221     def writable (self):
00222         "predicate for inclusion in the writable for select()"
00223         return self.producer_fifo or (not self.connected)


Member Data Documentation

Definition at line 82 of file asynchat.py.

int asynchat.async_chat.ac_in_buffer_size = 4096 [static, inherited]

Definition at line 71 of file asynchat.py.

int asynchat.async_chat.ac_out_buffer_size = 4096 [static, inherited]

Definition at line 72 of file asynchat.py.

asyncore.dispatcher.accepting = False [static, inherited]

Definition at line 227 of file asyncore.py.

asyncore.dispatcher.accepting = False [static, inherited]

Definition at line 227 of file asyncore.py.

asyncore.dispatcher.addr = None [static, inherited]

Reimplemented in smtpd.SMTPChannel.

Definition at line 229 of file asyncore.py.

asyncore.dispatcher.addr = None [static, inherited]

Reimplemented in smtpd.SMTPChannel.

Definition at line 229 of file asyncore.py.

Definition at line 36 of file test_ftplib.py.

asyncore.dispatcher.closing = False [static, inherited]

Definition at line 228 of file asyncore.py.

asyncore.dispatcher.closing = False [static, inherited]

Definition at line 228 of file asyncore.py.

asyncore.dispatcher.connected = False [static, inherited]

Reimplemented in asyncore.file_dispatcher.

Definition at line 226 of file asyncore.py.

asyncore.dispatcher.connected = False [static, inherited]

Reimplemented in asyncore.file_dispatcher.

Definition at line 226 of file asyncore.py.

asyncore.dispatcher.debug = False [static, inherited]

Definition at line 225 of file asyncore.py.

asyncore.dispatcher.debug = False [static, inherited]

Definition at line 225 of file asyncore.py.

Definition at line 32 of file test_ftplib.py.

string asynchat.async_chat.encoding = 'latin1' [static, inherited]

Definition at line 78 of file asynchat.py.

Definition at line 295 of file asyncore.py.

Definition at line 295 of file asyncore.py.

tuple asyncore.dispatcher.ignore_log_types = frozenset(['warning']) [static, inherited]

Definition at line 230 of file asyncore.py.

tuple asyncore.dispatcher.ignore_log_types = frozenset(['warning']) [static, inherited]

Definition at line 230 of file asyncore.py.

Definition at line 90 of file asynchat.py.

Definition at line 94 of file asynchat.py.

Reimplemented from asyncore.dispatcher.

Definition at line 304 of file test_ftplib.py.

Definition at line 115 of file asynchat.py.

int asynchat.async_chat.use_encoding = 0 [static, inherited]

Definition at line 77 of file asynchat.py.


The documentation for this class was generated from the following file: