Package proxy :: Package broker :: Module rhnBroker :: Class BrokerHandler
[hide private]
[frames] | no frames]

Class BrokerHandler

source code


Spacewalk Proxy broker specific handler code called by rhnApache.

Workflow is: Client -> Apache:Broker -> Squid -> Apache:Redirect -> Satellite

Broker handler get request from clients from outside. Some request (POST and HEAD) bypass cache so, it is passed directly to parent. For everything else we transform destination to localhost:80 (which is handled by Redirect handler) and set proxy as local squid. This way we got all request cached localy by squid.

Instance Methods [hide private]
 
__init__(self, req)
init with http request object
source code
 
_initConnectionVariables(self, req)
set connection variables NOTE: self.{caChain,rhnParent,httpProxy*} are initialized in SharedHandler
source code
 
handler(self)
Main handler to handle all requests pumped through this server.
source code
 
_prepHandler(self)
prep handler and check PROXY_AUTH's expiration.
source code
 
__handleAction(self, headers) source code
 
__local_GET_handler(self, req)
GETs: authenticate user, and service local GETs.
source code
 
__cacheClientSessionToken(self, headers)
pull session token from headers and push to caching daemon.
source code
 
__callLocalRepository(self, req_type, identifier, funct, params)
Contacts the local repository and retrieves files
source code
 
__checkAuthSessionTokenCache(self, token, channel)
Authentication / authorize the channel
source code
Static Methods [hide private]
 
_split_ks_url(req)
read kickstart options from incoming url...
source code
 
_split_url(req)
read url from incoming url and return (req_type, channel, action, params) URI should look something like: /GET-REQ/rhel-i386-server-5/getPackage/autofs-5.0.1-0.rc2.143.el5_5.6.i386.rpm
source code
 
__getSessionToken()
Get/test-for session token in headers (rhnFlags)
source code
Method Details [hide private]

__init__(self, req)
(Constructor)

source code 

init with http request object

Overrides: rhnShared.SharedHandler.__init__
(inherited documentation)

_initConnectionVariables(self, req)

source code 
set connection variables
NOTE: self.{caChain,rhnParent,httpProxy*} are initialized
      in SharedHandler

rules:
    - GET requests:
          . are non-SSLed (potentially SSLed by the redirect)
          . use the local cache
          . CFG.HTTP_PROXY or CFG.USE_SSL:
              . use the SSL Redirect
                (i.e., parent is now 127.0.0.1)
              . NOTE: the reason we use the SSL Redirect if we
                      are going through an outside HTTP_PROXY:
                      o CFG.HTTP_PROXY is ONLY used by an SSL
                        redirect - maybe should rethink that.
          . not CFG.USE_SSL and not CFG.HTTP_PROXY:
              . bypass the SSL Redirect (performance)
    - POST and HEAD requests (not GET) bypass both the local cache
           and SSL redirect (we SSL it directly)

_prepHandler(self)

source code 

prep handler and check PROXY_AUTH's expiration.

Overrides: rhnShared.SharedHandler._prepHandler

_split_ks_url(req)
Static Method

source code 
read kickstart options from incoming url
URIs we care about look something like:
/ks/dist/session/2xfe7113bc89f359001280dee1f4a020bc/
    ks-rhel-x86_64-server-6-6.5/Packages/rhnsd-4.9.3-2.el6.x86_64.rpm
/ks/dist/ks-rhel-x86_64-server-6-6.5/Packages/
    rhnsd-4.9.3-2.el6.x86_64.rpm
/ks/dist/org/1/ks-rhel-x86_64-server-6-6.5/Packages/
    rhnsd-4.9.3-2.el6.x86_64.rpm
/ks/dist/ks-rhel-x86_64-server-6-6.5/child/sherr-child-1/Packages/
    rhnsd-4.9.3-2.el6.x86_64.rpm

__local_GET_handler(self, req)

source code 

GETs: authenticate user, and service local GETs. if not a local fetch, return None