query.py 文件源码

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

项目:autoreg 作者: pbeyssac 项目源码 文件源码
def handleclient(self, c, a):
    w = socketwrapper(c)
    sys.stdout = w
    ip, cport, flowinfo, scopeid = a
    c.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
    q = ''
    r = c.recv(256)
    while r:
      q += r
      i = q.find('\r\n')
      if i >= 0:
        q = q[:i]
        if ip.startswith('::ffff:'):
              ip = ip[7:]
        self.log("%s %s" % (ip, q))
        # XXX: the 192.168.0.* check is a terrible hack until the
        # Perl query interface is rewritten.
        query(q, self.dbstring, w,
              remote = (ip != '127.0.0.1' and ip != '::1'
                        and not ip.startswith('192.168.0.')))
        c.shutdown(socket.SHUT_WR)
        break
      r = c.recv(256)
    c.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号