def __init__(self, nagcat, conf):
        super(HTTPQuery, self).__init__(nagcat, conf)

        self.agent = "NagCat" # Add more info?
        self.conf['addr'] = self.addr
        self.conf['port'] = int(conf.get('port', self.port))
        self.conf['path'] = conf.get('path', '/')
        self.conf['data'] = conf.get('data', None)
        headers = conf.get('headers', {})
        if headers:
            headers.expand()

        # path should always start with a / so insert one to be nice
        if not self.conf['path'].startswith('/'):
            self.conf['path'] = '/%s' % self.conf['path']

        # Some versions of twisted will send Host twice if it is in the
        # headers dict. Instead we set factory.host.
        if self.conf['port'] == self.port:
            self.headers_host = self.host
        else:
            self.headers_host = (self.host, self.conf['port']) % "%s:%s"

        # We need to make sure headers is a dict.
        self.headers = InsensitiveDict()
        for (key, val) in headers.iteritems():
            if key.lower() == 'host':
                self.headers_host = val
            else:
                self.headers[key] = val

        # Set the Authorization header if user/pass are provided
        user = conf.get('username', None)
        if user is not None:
            auth = b64encode("%s:%s" % (user, conf['password']))
            self.headers['Authorization'] = "Basic %s" % auth

        # Also convert to a lower-case only dict for self.conf so
        # that queries that differ only by case are still shared.
        self.conf['headers'] = InsensitiveDict(preserve=0)
        self.conf['headers']['host'] = self.headers_host
        self.conf['headers'].update(self.headers)

        if self.conf['data'] is not None:
            method = "POST"
        else:
            method = "GET"

        self.conf['method'] = conf.get('method', method)

        self.request_url = urlparse.urlunsplit((self.scheme,
                self.headers_host, self.conf['path'], None, None))
dataset/ETHPy150Open marineam/nagcat/python/nagcat/plugins/query_http.py/HTTPQuery.__init__/swapped operands of `%`