def _is_internal_request(domain, referer):
    # Different subdomains are treated as different domains.
    return referer is not None and re.match("^https?://%s/" % re.escape(domain), referer)
Returns true if the referring URL is the same domain as the current request.
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/middleware/common.py/_is_internal_request