Open eenblam opened 7 years ago
https://www.python.org/dev/peps/pep-0008/
e.g. in peekapp/peekapp/blacklist.py, Blacklist.filter_by_URL has three different return formats.
peekapp/peekapp/blacklist.py
Blacklist.filter_by_URL
def filter_by_URL(self, pkt): # Assume unencrypted HTTP packet try: raw_load = pkt.payload.load except AttributeError: return first = raw_load.split('\r\n')[0].strip() try: # RFC2616 # https://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5 method, identifier, version = first.split() except ValueError: # Wrong number of values to unpack; mal-formed HTTP at best return if method in ['GET', 'HEAD', 'POST', 'PUT', 'OPTIONS', 'DELETE', 'TRACE', 'CONNECT']: for rule in self.URLs: if rule in identifier: return classify_pkt(pkt, 'ILLEGAL_URL', payload=identifier, rule=rule) return None
return return classify_pkt(...) return None
https://www.python.org/dev/peps/pep-0008/
e.g. in
peekapp/peekapp/blacklist.py
,Blacklist.filter_by_URL
has three different return formats.