pythentic.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:dmarc-tester 作者: usnistgov 项目源码 文件源码
def read_milter_data(self):

      """ Callback from asynchat once we have read the milter packet length
      worth of bytes on the socket and it is accumulated in our input buffer
      (which is the milter command + data to send to the dispatcher). """

      import binascii
      inbuff = "".join(self.__input)
      self.__input = []
      if not inbuff.startswith("B"):
        if self.chmilt == "Receiver":
          logging.debug(' read: %s %s', self.chmilt, binascii.b2a_qp(inbuff))
      try:
        response = self.__milter_dispatcher.Dispatch(inbuff)
        #logging.debug(' >>> resp: [%s]', response)
        if type(response) == list:
          for r in response:
            self.__send_response(r)
        elif response:
          self.__send_response(response)

        # rinse and repeat :)
        self.found_terminator = self.read_packetlen
        self.set_terminator(MILTER_LEN_BYTES)
      except kimpf.PpyMilterCloseConnection, e:
        self.close()


  #end class ConnectionHandler(asynchat.async_chat).

#end class AsyncPpyMilterServer(asyncore.dispatcher).

#SN July 13, 2015
#Bring configuration processing inside here, instead of in commons.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号