Exemple #1
0
    def __init__(self, shutdown_event):
        host = config.get('http', 'host')
        port = config.getint('http', 'port')

        self._set_address_family(host)
        HTTPServer.__init__(self, (host, port), YuRequestHandler)

        if config.has_option('http', 'hostname'):
            hostname = config.get('http', 'hostname')
            if port != 80:
                hostname = '%s:%s' % (hostname, port)
        else:
            # TODO we could get the hostname from the IP the server is
            # bound to if we want this, for now we use a stupid fallback
            hostname = 'yaturl.net'

        # store important information here to be able to access it in the request handler
        self.hostname = hostname
        self.resolve_clients = config.getboolean('http', 'resolve_clients')
        self.log_ip_activated = config.getboolean('main', 'log_ip_activated')
        self._shutdown = shutdown_event
        self._logger = get_logger()
Exemple #2
0
    def __init__(self, shutdown_event):
        host = config.get('http', 'host')
        port = config.getint('http', 'port')

        self._set_address_family(host)
        HTTPServer.__init__(self, (host, port), YuRequestHandler)

        if config.has_option('http', 'hostname'):
            hostname = config.get('http', 'hostname')
            if port != 80:
                hostname = '%s:%s' % (hostname, port)
        else:
            # TODO we could get the hostname from the IP the server is
            # bound to if we want this, for now we use a stupid fallback
            hostname = 'yaturl.net'

        # store important information here to be able to access it in the request handler
        self.hostname = hostname
        self.resolve_clients = config.getboolean('http', 'resolve_clients')
        self.log_ip_activated = config.getboolean('main', 'log_ip_activated')
        self._shutdown = shutdown_event
        self._logger = get_logger()
Exemple #3
0
    def _set_min_url_lenth(self):
        if config.has_option('main', 'min_url_length'):
            self._min_url_length = config.getint('main', 'min_url_length')

        if not self._min_url_length or self._min_url_length < 1:
            self._min_url_length = 4