http.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:rpi3-webiopi 作者: thortex 项目源码 文件源码
def __init__(self, host, port, handler, context, docroot, index, auth=None, realm=None):
        try:
            BaseHTTPServer.HTTPServer.__init__(self, ("", port), HTTPHandler)
        except:
            self.address_family = socket.AF_INET
            BaseHTTPServer.HTTPServer.__init__(self, ("", port), HTTPHandler)

        threading.Thread.__init__(self, name="HTTPThread")
        self.host = host
        self.port = port

        if context:
            self.context = context
            if not self.context.startswith("/"):
                self.context = "/" + self.context
            if not self.context.endswith("/"):
                self.context += "/"
        else:
            self.context = "/"

        self.docroot = docroot

        if index:
            self.index = index
        else:
            self.index = "index.html"

        self.handler = handler
        self.auth = auth
        if (realm == None):
            self.authenticateHeader = "Basic realm=webiopi"
        else:
            self.authenticateHeader = "Basic realm=%s" % realm

        self.running = True
        self.start()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号