def __init__(self, http_archive_fetch, custom_handlers, rules,
               host='localhost', port=80, use_delays=False, is_ssl=False,
               protocol='HTTP',
               down_bandwidth='0', up_bandwidth='0', delay_ms='0'):
    if platformsettings.SupportsFdLimitControl():
      # BaseHTTPServer opens a new thread and two fds for each connection.
      # Check that the process can open at least 1000 fds.
      soft_limit, hard_limit = platformsettings.GetFdLimit()
      # Add some wiggle room since there are probably fds not associated with
      # connections.
      wiggle_room = 100
      desired_limit = 2 * HttpProxyServer.connection_limit + wiggle_room
      if soft_limit < desired_limit:
        assert desired_limit <= hard_limit, (
            'The hard limit for number of open files per process is %s which '
            'is lower than the desired limit of %s.' %
            (hard_limit, desired_limit))
        platformsettings.AdjustFdLimit(desired_limit, hard_limit)

    try:
      BaseHTTPServer.HTTPServer.__init__(self, (host, port), self.HANDLER)
    except Exception, e:
      raise HttpProxyServerError('Could not start HTTPServer on port %d: %s' %
                                 (port, e))
    self.http_archive_fetch = http_archive_fetch
    self.custom_handlers = custom_handlers
    self.use_delays = use_delays
    self.is_ssl = is_ssl
    self.traffic_shaping_down_bps = proxyshaper.GetBitsPerSecond(down_bandwidth)
    self.traffic_shaping_up_bps = proxyshaper.GetBitsPerSecond(up_bandwidth)
    self.traffic_shaping_delay_ms = int(delay_ms)
    self.num_active_requests = 0
    self.num_active_connections = 0
    self.total_request_time = 0
    self.protocol = protocol
    self.log_url = rules.Find('log_url')

    # Note: This message may be scraped. Do not change it.
    logging.warning(
        '%s server started on %s:%d' % (self.protocol, self.server_address[0],
                                        self.server_address[1]))
Start HTTP server.
dataset/ETHPy150Open chromium/web-page-replay/httpproxy.py/HttpProxyServer.__init__