def__call__(self,request):host=request.META.get("HTTP_HOST")origin=request.META.get("HTTP_ORIGIN")# Note: The "Origin" header is not sent on the main page request, so we need to explicitly# handle it being None.iforiginisnotNoneandurllib.parse.urlparse(origin).netloc!=host:returnhttp.HttpResponse(status=401)returnself.get_response(request)