Example #1
0
 def handle_accept(self):
     newsock, addr = self.accept()
     if self._connIsAllowedFrom(addr[0]):
         logging.debug('Replying to XML dump query from %s' % addr[0])
         writer = XmlWriter()
         newsock.sendall(writer.getXml())
         newsock.close()
     else:
         logging.info('XML dump query from %s rejected by rule' % addr[0])
Example #2
0
 def handle_accept(self):
     newsock, addr = self.accept()
     if self._connIsAllowedFrom(addr[0]):
         logging.debug('Replying to XML dump query from %s' % addr[0])
         writer = XmlWriter()
         newsock.sendall(writer.getXml())
         newsock.close()
     else:
         logging.info('XML dump query from %s rejected by rule' % addr[0])
Example #3
0
 def handle_read(self):
     rbuf = self.recv(1024)
     if rbuf:
         rbuf = rbuf.strip().strip('/')
         if 0 == len(rbuf):
             rbuf = None
         queryargs = None
         if rbuf is not None and -1 != rbuf.find('?'):
             queryargs = {}
             try:
                 rbuf, query = rbuf.split('?')
                 query = query.split('&')
                 for q in query:
                     k,v = q.split('=')
                     queryargs[k] = v
             except ValueError:
                 pass
         writer = XmlWriter()
         self.buffer = writer.getXml(rbuf, queryargs)
         self.amt_to_write = len(self.buffer)
Example #4
0
 def handle_read(self):
     rbuf = self.recv(1024)
     if rbuf:
         rbuf = rbuf.strip().strip('/')
         if 0 == len(rbuf):
             rbuf = None
         queryargs = None
         if rbuf is not None and -1 != rbuf.find('?'):
             queryargs = {}
             try:
                 rbuf, query = rbuf.split('?')
                 query = query.split('&')
                 for q in query:
                     k,v = q.split('=')
                     queryargs[k] = v
             except ValueError:
                 pass
         writer = XmlWriter()
         self.buffer = writer.getXml(rbuf, queryargs)
         self.amt_to_write = len(self.buffer)