'Process the given request'

def process_request(self, request):

    asset_path = request.path
    if self.is_asset_request(request):
        if (AssetLocator.CANONICAL_NAMESPACE in asset_path):
            asset_path = asset_path.replace('block/', 'block@', 1)
        requested_digest = None
        if StaticContent.is_versioned_asset_path(asset_path):
            (requested_digest, asset_path) = StaticContent.parse_versioned_asset_path(asset_path)
        try:
            loc = StaticContent.get_location_from_path(asset_path)
        except (InvalidLocationError, InvalidKeyError):
            return HttpResponseBadRequest()
        actual_digest = None
        try:
            content = self.load_asset_from_location(loc)
            actual_digest = getattr(content, 'content_digest', None)
        except (ItemNotFoundError, NotFoundError):
            return HttpResponseNotFound()
        if ((requested_digest is not None) and (actual_digest is not None) and (actual_digest != requested_digest)):
            actual_asset_path = StaticContent.add_version_to_asset_path(asset_path, actual_digest)
            return HttpResponsePermanentRedirect(actual_asset_path)
        safe_course_key = loc.course_key
        if (safe_course_key.run is None):
            safe_course_key = safe_course_key.replace(run='only')
        if newrelic:
            newrelic.agent.add_custom_parameter('course_id', safe_course_key)
            newrelic.agent.add_custom_parameter('org', loc.org)
            newrelic.agent.add_custom_parameter('contentserver.path', loc.path)
            is_from_cdn = StaticContentServer.is_cdn_request(request)
            newrelic.agent.add_custom_parameter('contentserver.from_cdn', is_from_cdn)
            locked = self.is_content_locked(content)
            newrelic.agent.add_custom_parameter('contentserver.locked', locked)
        if (not self.is_user_authorized(request, content, loc)):
            return HttpResponseForbidden('Unauthorized')
        last_modified_at_str = content.last_modified_at.strftime(HTTP_DATE_FORMAT)
        if ('HTTP_IF_MODIFIED_SINCE' in request.META):
            if_modified_since = request.META['HTTP_IF_MODIFIED_SINCE']
            if (if_modified_since == last_modified_at_str):
                return HttpResponseNotModified()
        response = None
        if request.META.get('HTTP_RANGE'):
            if isinstance(content, StaticContent):
                content = AssetManager.find(loc, as_stream=True)
            header_value = request.META['HTTP_RANGE']
            try:
                (unit, ranges) = parse_range_header(header_value, content.length)
            except ValueError as exception:
                log.exception(u'%s    in    Range    header:    %s    for    content:    %s', exception.message, header_value, unicode(loc))
            else:
                if (unit != 'bytes'):
                    log.warning(u'Unknown    unit    in    Range    header:    %s    for    content:    %s', header_value, unicode(loc))
                elif (len(ranges) > 1):
                    log.warning(u'More    than    1    ranges    in    Range    header:    %s    for    content:    %s', header_value, unicode(loc))
                else:
                    (first, last) = ranges[0]
                    if (0 <= first <= last < content.length):
                        response = HttpResponse(content.stream_data_in_range(first, last))
                        response['Content-Range'] = 'bytes    {first}-{last}/{length}'.format(first=first, last=last, length=content.length)
                        response['Content-Length'] = str(((last - first) + 1))
                        response.status_code = 206
                        if newrelic:
                            newrelic.agent.add_custom_parameter('contentserver.ranged', True)
                    else:
                        log.warning(u'Cannot    satisfy    ranges    in    Range    header:    %s    for    content:    %s', header_value, unicode(loc))
                        return HttpResponse(status=416)
        if (response is None):
            response = HttpResponse(content.stream_data())
            response['Content-Length'] = content.length
        if newrelic:
            newrelic.agent.add_custom_parameter('contentserver.content_len', content.length)
            newrelic.agent.add_custom_parameter('contentserver.content_type', content.content_type)
        response['Accept-Ranges'] = 'bytes'
        response['Content-Type'] = content.content_type
        self.set_caching_headers(content, response)
        return response
