5
我正在使用BaseHTTPRequestHandler类写入脚本。在do_GET(self)
方法中,我需要从HTTP请求中获取Host
字段的内容。我可以通过重新编译str(self.headers)
来达到这个目的:Determine site domain in BaseHTTPServer,但它有点丑,我想知道是否有更干净的方法来做到这一点。在BaseHTTPRequestHandler中从HTTP请求获取主机字段
在此先感谢。
Here http://docs.python.org/library/rfc822.html#rfc822.Message – skrat 2011-04-21 13:46:38