コード例 #1
0
 def handle_read(self):
     msg, addr = self.recvfrom(common.BUFFERSIZE)
     parsed_headers = common.parse_headers(msg)
     if parsed_headers:
         raw, first_line, headers, msg = parsed_headers
         method, path, protocol = first_line.split(common.BLANK, 2)
         self.process_msg(method, headers)
コード例 #2
0
 def handle_read(self):
     msg, addr = self.recvfrom(common.BUFFERSIZE)
     if self.sniff:
         print addr, '\n', msg
     else:
         parsed_headers = common.parse_headers(msg)
         if parsed_headers:
             raw, first_line, headers, msg = parsed_headers
             method, path, protocol = first_line.split(common.BLANK, 2)
             st = headers.get("ST")
             if self.is_alive and method == "M-SEARCH" and st in self.SEARCH_TARGETS:
                 t = time.time() * 1000
                 mx = int(headers.get("MX", 3)) * 1000
                 self.queue_msg(random.randint(100, mx), self.search_resp, addr)
             else:
                 self.process_msg(method, headers)
コード例 #3
0
 def handle_read(self):
     msg, addr = self.recvfrom(common.BUFFERSIZE)
     if self.sniff:
         print addr, '\n', msg
     else:
         parsed_headers = common.parse_headers(msg)
         if parsed_headers:
             raw, first_line, headers, msg = parsed_headers
             method, path, protocol = first_line.split(common.BLANK, 2)
             st = headers.get("ST")
             if self.is_alive and method == "M-SEARCH" and st in self.SEARCH_TARGETS:
                 t = time.time() * 1000
                 mx = int(headers.get("MX", 3)) * 1000
                 self.queue_msg(random.randint(100, mx), self.search_resp,
                                addr)
             else:
                 self.process_msg(method, headers)