def __init__(self, repository, conf): self.__repo__ = repository self.hit_counter = counter() self.login_counter = counter() self.allow_insecure_cookies = conf.get_bool("allow-insecure-login-cookies", false) self.version = repository.get_version()
def __init__ (self, filesystem, urlroot): self.filesystem = filesystem self.urlroot = urlroot # count total hits self.hit_counter = counter() # count file deliveries self.file_counter = counter() # count cache hits self.cache_counter = counter()
def __init__ (self, module, uri_base=None, env=None): """Creates a zope_handler module -- string, the name of the module to publish uri_base -- string, the base uri of the published module defaults to '/<module name>' if not given. env -- dictionary, environment variables to be overridden. Replaces standard variables with supplied ones. """ self.module_name=module self.env_override=env or {} self.hits = counter.counter() # if uri_base is unspecified, assume it # starts with the published module name # if uri_base is None: uri_base='/%s' % module elif uri_base == '': uri_base='/' else: if uri_base[0] != '/': uri_base='/'+uri_base if uri_base[-1] == '/': uri_base=uri_base[:-1] self.uri_base=uri_base uri_regex='%s.*' % self.uri_base self.uri_regex = re.compile(uri_regex)
def __init__(self, logger_object=None, logResponses=True, logRequests=True): SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self, allow_none=True, encoding=None) self.requestCntr = counter.counter() self.logger = logger_object self.logRequests = logRequests self.logResponses = logResponses self.closeCallbacks = []
def __init__(self, module='Main', ip='127.0.0.1', port=None, socket_file=None, pid_file=None, pcgi_file=None, resolver=None, logger_object=None): self.ip = ip asyncore.dispatcher.__init__(self) self.count = counter() if not logger_object: logger_object = logger.file_logger(sys.stdout) if resolver: self.logger = logger.resolving_logger(resolver, logger_object) else: self.logger = logger.unresolving_logger(logger_object) # get configuration self.module = module self.port = port self.pid_file = pid_file self.socket_file = socket_file if pcgi_file is not None: self.read_info(pcgi_file) # write pid file try: f = open(self.pid_file, 'w') f.write(str(os.getpid())) f.close() except IOError: self.log_info("Cannot write PID file.", 'error') # setup sockets if self.port: self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((self.ip, self.port)) self.log_info('PCGI Server started at %s\n' '\tInet socket port: %s' % (time.ctime(time.time()), self.port)) else: try: os.unlink(self.socket_file) except os.error: pass self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(self.socket_file) try: os.chmod(self.socket_file, 0777) except os.error: pass self.log_info('PCGI Server started at %s\n' '\tUnix socket: %s' % (time.ctime(time.time()), self.socket_file)) self.listen(256)
def __init__(self, context, ip=None, port=143, logger=None, stunnel_pid=None): if not ip: self.ip = "0.0.0.0" else: self.ip = ip self.port = port self.mailcontext = context self.logger = logger or unresolving_logger(file_logger(sys.stderr)) self.stunnel_pid = stunnel_pid asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.handlers = [] self.set_reuse_addr() self.bind((ip, port)) # lower this to 5 if your OS complains self.listen(1024) host, port = self.socket.getsockname() if not ip: self.log_info("Computing default hostname", "warning") ip = socket.gethostbyname(socket.gethostname()) try: self.server_name = socket.gethostbyaddr(ip)[0] except socket.error: self.log_info("Cannot do reverse lookup", "warning") self.server_name = ip # use the IP address as the "hostname" self.server_port = port self.total_clients = counter() self.total_requests = counter() self.exceptions = counter() self.bytes_out = counter() self.bytes_in = counter() info = ( "UpLib IMAP (V4r1) started at %s" "\n\tHostname: %s" "\n\tPort: %d" "\n" % (time.ctime(time.time()), self.server_name, port) ) # self.log_info (info, 'info') self.mailcontext.note(info)
def postbind(self): from medusa.counter import counter from medusa.http_server import VERSION_STRING self.listen(1024) self.total_clients = counter() self.total_requests = counter() self.exceptions = counter() self.bytes_out = counter() self.bytes_in = counter() self.log_info ( 'Medusa (V%s) started at %s' '\n\tHostname: %s' '\n\tPort:%s' '\n' % ( VERSION_STRING, time.ctime(time.time()), self.server_name, self.port, ) )
def __init__(self, server, conn, addr): self.collector = None self.outgoing = [] self.channel_number = imap_connection.channel_counter.increment() self.request_counter = counter() asynchat.async_chat.__init__(self, conn) self.clientstate = mailclient(self, STATE_NOT_AUTHENTICATED, False, None) self.server = server self.pending_request = None self.addr = addr self.in_buffer = "" self.creation_time = int(time.time()) self.check_maintenance() self.set_terminator("\r\n") self.greet() note("*** new imap_connection %s", repr(self))
def __init__(self, module='Main', ip='127.0.0.1', port=None, socket_file=None, resolver=None, logger_object=None): self.ip = ip self.count=counter() asyncore.dispatcher.__init__(self) if not logger_object: logger_object = logger.file_logger(sys.stdout) if resolver: self.logger = logger.resolving_logger(resolver, logger_object) else: self.logger = logger.unresolving_logger(logger_object) # get configuration self.module = module self.port = port self.socket_file = socket_file # setup sockets if self.port: self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((self.ip, self.port)) else: try: os.unlink(self.socket_file) except os.error: pass self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(self.socket_file) try: os.chmod(self.socket_file,0777) except os.error: pass self.listen(256) self.log_info('FastCGI Server (V%s) started at %s\n' '\tIP : %s\n' '\tPort : %s\n' '\tSocket path : %s\n' % ('1.0', time.ctime(time.time()), self.ip, self.port, self.socket_file))
def __init__(self, module='Main', ip='127.0.0.1', port=None, socket_file=None, resolver=None, logger_object=None): self.ip = ip self.count=counter() asyncore.dispatcher.__init__(self) if not logger_object: logger_object = logger.file_logger(sys.stdout) if resolver: self.logger = logger.resolving_logger(resolver, logger_object) else: self.logger = logger.unresolving_logger(logger_object) # get configuration self.module = module self.port = port self.socket_file = socket_file # setup sockets if self.port: self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((self.ip, self.port)) else: try: os.unlink(self.socket_file) except os.error: pass self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(self.socket_file) try: os.chmod(self.socket_file,0777) except os.error: pass self.listen(256) self.log_info('FastCGI Server (V%s) started at %s\n' '\tIP : %s\n' '\tPort : %s\n' '\tSocket path : %s\n' % (__version__, time.ctime(time.time()), self.ip, self.port, self.socket_file))
def __init__(self): xmlrpc_handler.xmlrpc_handler.__init__(self) self.commandCounter = counter.counter() self.completedCounter = counter.counter() self.exceptionsCounter = counter.counter() self.seriousExcCounter = counter.counter()
def __init__ (self, request, file): self.buffer = '' self.request = request self.file = file self.got_header = 0 self.bytes_out = counter.counter()
def __init__(self, request, file): self.buffer = '' self.request = request self.file = file self.got_header = 0 self.bytes_out = counter.counter()
def __init__(self, repository): self.__repo__ = repository self.hit_counter = counter() self.action_counter = counter() self.version = repository.get_version()
def __init__(self): igerpc_handler.igerpc_handler.__init__(self) self.seriousExcCounter = counter.counter()
def __init__ (self, module='Main', ip='127.0.0.1', port=None, socket_file=None, pid_file=None, pcgi_file=None, resolver=None, logger_object=None): self.ip = ip asyncore.dispatcher.__init__(self) self.count=counter() if not logger_object: logger_object = logger.file_logger (sys.stdout) if resolver: self.logger = logger.resolving_logger (resolver, logger_object) else: self.logger = logger.unresolving_logger (logger_object) # get configuration self.module=module self.port=port self.pid_file=pid_file self.socket_file=socket_file if pcgi_file is not None: self.read_info(pcgi_file) # write pid file try: f = open(self.pid_file, 'w') f.write(str(os.getpid())) f.close() except IOError: self.log_info("Cannot write PID file.", 'error') # setup sockets if self.port: self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((self.ip, self.port)) self.log_info( 'PCGI Server started at %s\n' '\tInet socket port: %s' % (time.ctime(time.time()), self.port) ) else: try: os.unlink(self.socket_file) except os.error: pass self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM) self.set_reuse_addr() self.bind(self.socket_file) try: os.chmod(self.socket_file,0777) except os.error: pass self.log_info( 'PCGI Server started at %s\n' '\tUnix socket: %s' % (time.ctime(time.time()), self.socket_file) ) self.listen(256)
def __init__ (self, supervisord): self.supervisord = supervisord # count total hits self.hit_counter = counter()