Back to index

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

List of all members.

Public Member Functions

def __init__
def handle_read
def collect_incoming_data
def found_terminator
def handle_error
def push
def cmd_echo
def cmd_user
def cmd_pass
def cmd_stat
def cmd_list
def cmd_retr
def cmd_dele
def cmd_noop
def cmd_rpop
def cmd_apop
def set_terminator
def get_terminator
def handle_write
def handle_close
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

 in_buffer
 ac_in_buffer
 incoming
 producer_fifo
 terminator
 socket
 family_and_type

Static Public Attributes

 cmd_uidl = cmd_list
 cmd_top = cmd_retr
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'])

Private Member Functions

def _do_ssl_handshake

Private Attributes

 _ssl_accepting

Detailed Description

Definition at line 239 of file test_poplib.py.


Constructor & Destructor Documentation

Reimplemented from test.test_poplib.DummyPOP3Handler.

Definition at line 241 of file test_poplib.py.

00241 
00242         def __init__(self, conn):
00243             asynchat.async_chat.__init__(self, conn)
00244             ssl_socket = ssl.wrap_socket(self.socket, certfile=CERTFILE,
00245                                           server_side=True,
00246                                           do_handshake_on_connect=False)
00247             self.del_channel()
00248             self.set_socket(ssl_socket)
00249             # Must try handshake before calling push()
00250             self._ssl_accepting = True
00251             self._do_ssl_handshake()
00252             self.set_terminator(b"\r\n")
00253             self.in_buffer = []
00254             self.push('+OK dummy pop3 server ready. <timestamp>')

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))

Definition at line 255 of file test_poplib.py.

00255 
00256         def _do_ssl_handshake(self):
00257             try:
00258                 self.socket.do_handshake()
00259             except ssl.SSLError as err:
00260                 if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
00261                                    ssl.SSL_ERROR_WANT_WRITE):
00262                     return
00263                 elif err.args[0] == ssl.SSL_ERROR_EOF:
00264                     return self.handle_close()
00265                 raise
00266             except socket.error as err:
00267                 if err.args[0] == errno.ECONNABORTED:
00268                     return self.handle_close()
00269             else:
00270                 self._ssl_accepting = False

Here is the call graph for this function:

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 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 test.test_poplib.DummyPOP3Handler.cmd_apop (   self,
  arg 
) [inherited]

Definition at line 108 of file test_poplib.py.

00108 
00109     def cmd_apop(self, arg):
00110         self.push('+OK done nothing.')
00111 

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_dele (   self,
  arg 
) [inherited]

Definition at line 99 of file test_poplib.py.

00099 
00100     def cmd_dele(self, arg):
00101         self.push('+OK message marked for deletion.')

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_echo (   self,
  arg 
) [inherited]

Definition at line 67 of file test_poplib.py.

00067 
00068     def cmd_echo(self, arg):
00069         # sends back the received string (used by the test suite)
00070         self.push(arg)

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_list (   self,
  arg 
) [inherited]

Definition at line 84 of file test_poplib.py.

00084 
00085     def cmd_list(self, arg):
00086         if arg:
00087             self.push('+OK %s %s' %(arg, arg))
00088         else:
00089             self.push('+OK')
00090             asynchat.async_chat.push(self, LIST_RESP)

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_noop (   self,
  arg 
) [inherited]

Definition at line 102 of file test_poplib.py.

00102 
00103     def cmd_noop(self, arg):
00104         self.push('+OK done nothing.')

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_pass (   self,
  arg 
) [inherited]

Definition at line 76 of file test_poplib.py.

00076 
00077     def cmd_pass(self, arg):
00078         if arg != "python":
00079             self.push("-ERR wrong password")
00080         self.push('+OK 10 messages')

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_retr (   self,
  arg 
) [inherited]

Definition at line 93 of file test_poplib.py.

00093 
00094     def cmd_retr(self, arg):
00095         self.push('+OK %s bytes' %len(RETR_RESP))
00096         asynchat.async_chat.push(self, RETR_RESP)

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_rpop (   self,
  arg 
) [inherited]

Definition at line 105 of file test_poplib.py.

00105 
00106     def cmd_rpop(self, arg):
00107         self.push('+OK done nothing.')

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_stat (   self,
  arg 
) [inherited]

Definition at line 81 of file test_poplib.py.

00081 
00082     def cmd_stat(self, arg):
00083         self.push('+OK 10 100')

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.cmd_user (   self,
  arg 
) [inherited]

Definition at line 71 of file test_poplib.py.

00071 
00072     def cmd_user(self, arg):
00073         if arg != "guido":
00074             self.push("-ERR no such user")
00075         self.push('+OK password required')

Here is the call graph for this function:

def test.test_poplib.DummyPOP3Handler.collect_incoming_data (   self,
  data 
) [inherited]

Reimplemented from asynchat.async_chat.

Definition at line 42 of file test_poplib.py.

00042 
00043     def collect_incoming_data(self, data):
00044         self.in_buffer.append(data)

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 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()

Reimplemented from asynchat.async_chat.

Definition at line 45 of file test_poplib.py.

00045 
00046     def found_terminator(self):
00047         line = b''.join(self.in_buffer)
00048         line = str(line, 'ISO-8859-1')
00049         self.in_buffer = []
00050         cmd = line.split(' ')[0].lower()
00051         space = line.find(' ')
00052         if space != -1:
00053             arg = line[space + 1:]
00054         else:
00055             arg = ""
00056         if hasattr(self, 'cmd_' + cmd):
00057             method = getattr(self, 'cmd_' + cmd)
00058             method(arg)
00059         else:
00060             self.push('-ERR unrecognized POP3 command "%s".' %cmd)

Here is the call 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:

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

Reimplemented in test.test_ftplib.DummyDTPHandler.

Definition at line 196 of file asynchat.py.

00196 
00197     def handle_close (self):
00198         self.close()

Here is the caller graph for this function:

Definition at line 61 of file test_poplib.py.

00061 
00062     def handle_error(self):
00063         raise

Here is the caller graph for this function:

Reimplemented from asynchat.async_chat.

Definition at line 271 of file test_poplib.py.

00271 
00272         def handle_read(self):
00273             if self._ssl_accepting:
00274                 self._do_ssl_handshake()
00275             else:
00276                 DummyPOP3Handler.handle_read(self)
00277 
    class TestPOP3_SSLClass(TestPOP3Class):

Here is the call 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:

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_poplib.DummyPOP3Handler.push (   self,
  data 
) [inherited]

Reimplemented from asynchat.async_chat.

Definition at line 64 of file test_poplib.py.

00064 
00065     def push(self, data):
00066         asynchat.async_chat.push(self, data.encode("ISO-8859-1") + b'\r\n')

Here is the call graph for this function:

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 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 249 of file test_poplib.py.

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.addr = None [static, inherited]

Reimplemented in smtpd.SMTPChannel.

Definition at line 229 of file asyncore.py.

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

Definition at line 228 of file asyncore.py.

Definition at line 97 of file test_poplib.py.

Definition at line 91 of file test_poplib.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.

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

Definition at line 78 of file asynchat.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.

Reimplemented from test.test_poplib.DummyPOP3Handler.

Definition at line 252 of file test_poplib.py.

Definition at line 90 of file asynchat.py.

Definition at line 94 of file asynchat.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: