swift/proxy/controllers/obj.py
def GETorHEAD(self, req):
        """Handle HTTP GET or HEAD requests."""
        container_info = self.container_info(
            self.account_name, self.container_name, req)
        req.acl = container_info['read_acl']
        # pass the policy index to storage nodes via req header
        policy_index = req.headers.get('X-Backend-Storage-Policy-Index',
                                       container_info['storage_policy'])
        policy = POLICIES.get_by_index(policy_index)
        obj_ring = self.app.get_object_ring(policy_index)
        req.headers['X-Backend-Storage-Policy-Index'] = policy_index
        if 'swift.authorize' in req.environ:
            aresp = req.environ['swift.authorize'](req)
            if aresp:
                return aresp
        partition = obj_ring.get_part(
            self.account_name, self.container_name, self.object_name)
        # node_iter 除了包含保存object的几个节点外，还包含其他节点 get_more_nodes()
        node_iter = self.app.iter_nodes(obj_ring, partition, policy=policy)

        resp = self._get_or_head_response(req, node_iter, partition, policy)

        if ';' in resp.headers.get('content-type', ''):
            resp.content_type = clean_content_type(
                resp.headers['content-type'])
        return resp
Handle HTTP GET or HEAD requests.
Handle HTTP GET or HEAD requests.
Handle HTTP GET or HEAD requests .
def GETorHEAD(self, req):
        container_info = self.container_info(
            self.account_name, self.container_name, req)
        req.acl = container_info['read_acl']
        policy_index = req.headers.get('X-Backend-Storage-Policy-Index',
                                       container_info['storage_policy'])
        policy = POLICIES.get_by_index(policy_index)
        obj_ring = self.app.get_object_ring(policy_index)
        req.headers['X-Backend-Storage-Policy-Index'] = policy_index
        if 'swift.authorize' in req.environ:
            aresp = req.environ['swift.authorize'](req)
            if aresp:
                return aresp
        partition = obj_ring.get_part(
            self.account_name, self.container_name, self.object_name)
        node_iter = self.app.iter_nodes(obj_ring, partition, policy=policy)
        resp = self._get_or_head_response(req, node_iter, partition, policy)
        if ';' in resp.headers.get('content-type', ''):
            resp.content_type = clean_content_type(
                resp.headers['content-type'])
        return resp
def GETorHEAD ( self , req ) : container_info = self . container_info ( self . account_name , self . container_name , req ) req . acl = container_info [ 'read_acl' ] policy_index = req . headers . get ( 'X-Backend-Storage-Policy-Index' , container_info [ 'storage_policy' ] ) policy = POLICIES . get_by_index ( policy_index ) obj_ring = self . app . get_object_ring ( policy_index ) req . headers [ 'X-Backend-Storage-Policy-Index' ] = policy_index if 'swift.authorize' in req . environ : aresp = req . environ [ 'swift.authorize' ] ( req ) if aresp : return aresp partition = obj_ring . get_part ( self . account_name , self . container_name , self . object_name ) node_iter = self . app . iter_nodes ( obj_ring , partition , policy = policy ) resp = self . _get_or_head_response ( req , node_iter , partition , policy ) if ';' in resp . headers . get ( 'content-type' , '' ) : resp . content_type = clean_content_type ( resp . headers [ 'content-type' ] ) return resp
Handle HTTP GET or HEAD requests.
Handle HTTP GET or HEAD requests .
"""Handle HTTP GET or HEAD requests.""" # pass the policy index to storage nodes via req header # node_iter 除了包含保存object的几个节点外，还包含其他节点 get_more_nodes()
self
req