'For requests for an image file, we check the local image
cache. If present, we return the image file, appending
the image metadata in headers. If not present, we pass
the request on to the next application in the pipeline.'

def process_request(self, request):

    match = self._match_request(request)
    try:
        (version, method, image_id) = match
    except TypeError:
        return None
    self._stash_request_info(request, image_id, method, version)
    if (request.headers.get('Content-Range') or request.headers.get('Range')):
        return None
    if ((request.method != 'GET') or (not self.cache.is_cached(image_id))):
        return None
    method = getattr(self, ('_get_%s_image_metadata' % version))
    image_metadata = method(request, image_id)
    if (image_metadata['status'] == 'deactivated'):
        return None
    try:
        self._enforce(request, 'download_image', target=image_metadata)
    except exception.Forbidden:
        return None
    LOG.debug("Cache    hit    for    image    '%s'", image_id)
    image_iterator = self.get_from_cache(image_id)
    method = getattr(self, ('_process_%s_request' % version))
    try:
        return method(request, image_id, image_iterator, image_metadata)
    except exception.ImageNotFound:
        msg = (_LE("Image    cache    contained    image    file    for    image    '%s',    however    the    registry    did    not    contain    metadata    for    that    image!") % image_id)
        LOG.error(msg)
        self.cache.delete_cached_image(image_id)
