Last active
August 29, 2015 13:56
-
-
Save jasonlvhit/9287695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#代码来自Python 2.7 Lib/wsgiref/utils.py | |
#__contains__判断一个字典中是否有key, 等同于has_key | |
_hoppish = { | |
'connection':1, 'keep-alive':1, 'proxy-authenticate':1, | |
'proxy-authorization':1, 'te':1, 'trailers':1, 'transfer-encoding':1, | |
'upgrade':1 | |
}.__contains__ | |
def is_hop_by_hop(header_name): | |
"""Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header""" | |
return _hoppish(header_name.lower()) | |
#帅气的用法 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment