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()
评论列表
文章目录