def __init__(self, req): SharedHandler.__init__(self, req) # Initialize variables self.componentType = 'proxy.broker' self.cachedClientInfo = None # headers - session token self.authChannels = None self.clientServerId = None self.rhnParentXMLRPC = None self.authToken = None self.fullRequestURL = None hostname = '' # should *always* exist and be my ip address my_ip_addr = req.headers_in['SERVER_ADDR'] if req.headers_in.has_key('Host'): # the client has provided a host header try: # When a client with python 2.4 (RHEL 5) uses SSL # the host header is in the 'hostname:port' form # (In python 2.6 RFE #1472176 changed this and 'hostname' # is used). We need to use the 'hostname' part in any case # or we create bogus 'hostname:port' DNS queries host_header = req.headers_in['Host'].split(':')[0] if host_header != my_ip_addr and \ socket.gethostbyname(host_header) == my_ip_addr: # if host header is valid (i.e. not just an /etc/hosts # entry on the client or the hostname of some other # machine (say a load balancer)) then use it hostname = host_header except (socket.gaierror, socket.error, socket.herror, socket.timeout): # hostname probably didn't exist, fine pass if not hostname: # okay, that didn't work, let's do a reverse dns lookup on my # ip address try: hostname = socket.gethostbyaddr(my_ip_addr)[0] except (socket.gaierror, socket.error, socket.herror, socket.timeout): # unknown host, we don't have a hostname? pass if not hostname: # this shouldn't happen # socket.gethostname is a punt. Shouldn't need to do it. hostname = socket.gethostname() log_debug( -1, 'WARNING: no hostname in the incoming headers; ' 'punting: %s' % hostname) hostname = parseUrl(hostname)[1].split(':')[0] self.proxyAuth = proxy.rhnProxyAuth.get_proxy_auth(hostname) self._initConnectionVariables(req)
def __init__(self, req): SharedHandler.__init__(self, req) # Initialize variables self.componentType = 'proxy.broker' self.cachedClientInfo = None # headers - session token self.authChannels = None self.clientServerId = None self.rhnParentXMLRPC = None hostname = '' # should *always* exist and be my ip address my_ip_addr = req.headers_in['SERVER_ADDR'] if req.headers_in.has_key('Host'): # the client has provided a host header try: # When a client with python 2.4 (RHEL 5) uses SSL # the host header is in the 'hostname:port' form # (In python 2.6 RFE #1472176 changed this and 'hostname' # is used). We need to use the 'hostname' part in any case # or we create bogus 'hostname:port' DNS queries host_header = req.headers_in['Host'].split(':')[0] if socket.gethostbyname(host_header) == my_ip_addr: # if host header is valid (i.e. not just an /etc/hosts # entry on the client or the hostname of some other # machine (say a load balancer)) then use it hostname = host_header except (socket.gaierror, socket.error, socket.herror, socket.timeout): # hostname probably didn't exist, fine pass if not hostname: # okay, that didn't work, let's do a reverse dns lookup on my # ip address try: hostname = socket.gethostbyaddr(my_ip_addr)[0] except (socket.gaierror, socket.error, socket.herror, socket.timeout): # unknown host, we don't have a hostname? pass if not hostname: # this shouldn't happen # socket.gethostname is a punt. Shouldn't need to do it. hostname = socket.gethostname() log_debug(-1, 'WARNING: no hostname in the incoming headers; ' 'punting: %s' % hostname) hostname = parseUrl(hostname)[1].split(':')[0] self.proxyAuth = proxy.rhnProxyAuth.get_proxy_auth(hostname) self._initConnectionVariables(req)
def __init__(self, req): SharedHandler.__init__(self, req) # Initialize variables self.componentType = 'proxy.broker' self.cachedClientInfo = None # headers - session token self.authChannels = None self.clientServerId = None self.rhnParentXMLRPC = None hostname = '' # should *always* exist and be my ip address my_ip_addr = req.headers_in['SERVER_ADDR'] if req.headers_in.has_key('Host'): # the client has provided a host header try: if socket.gethostbyname(req.headers_in['Host']) == my_ip_addr: # if host header is valid (i.e. not just an /etc/hosts # entry on the client or the hostname of some other # machine (say a load balancer)) then use it hostname = req.headers_in['Host'] except (socket.gaierror, socket.error, socket.herror, socket.timeout): # hostname probably didn't exist, fine pass if not hostname: # okay, that didn't work, let's do a reverse dns lookup on my # ip address try: hostname = socket.gethostbyaddr(my_ip_addr)[0] except (socket.gaierror, socket.error, socket.herror, socket.timeout): # unknown host, we don't have a hostname? pass if not hostname: # this shouldn't happen # socket.gethostname is a punt. Shouldn't need to do it. hostname = socket.gethostname() log_debug(-1, 'WARNING: no hostname in the incoming headers; ' 'punting: %s' % hostname) hostname = parseUrl(hostname)[1].split(':')[0] self.proxyAuth = proxy.rhnProxyAuth.get_proxy_auth(hostname) self._initConnectionVariables(req)
def __init__(self, req): SharedHandler.__init__(self, req) # Initialize variables self.componentType = 'proxy.broker' self.cachedClientInfo = None # headers - session token self.authChannels = None self.clientServerId = None hostname = '' if req.headers_in.has_key('Host'): hostname = req.headers_in['Host'] or '' if not hostname: # this shouldn't happen # socket.gethostname is a punt. Shouldn't need to do it. hostname = socket.gethostname() log_debug(-1, 'WARNING: no hostname in the incoming headers; ' 'punting: %s' % hostname) hostname = string.split(parseUrl(hostname)[1], ':')[0] self.proxyAuth = proxy.rhnProxyAuth.get_proxy_auth(hostname) self._initConnectionVariables(req)
def __init__(self, req): SharedHandler.__init__(self, req) self.componentType = 'proxy.redirect' self._initConnectionVariables(req) self.rhnParentXMLRPC = None
def __init__(self, req): SharedHandler.__init__(self, req) self.componentType = 'proxy.redirect' self._initConnectionVariables(req) self.rhnParentXMLRPC = None