我收到了奇怪的断开链接报告:
Subject: Broken link on googleads.g.doubleclick.net
Referrer: (url on **my** site!)
Requested URL: /pagead/ads?(...)
User agent: (...)
IP address: (some foreign country)
所以我看了一下负责发送这些报告的 CommonMiddleware。它是这样的(Django 1.1 license apply here ;)):
if response.status_code == 404:
if settings.SEND_BROKEN_LINK_EMAILS:
# If the referrer was from an internal link or a non-search-engine site,
# send a note to the managers.
domain = request.get_host()
referer = request.META.get('HTTP_REFERER', None)
is_internal = _is_internal_request(domain, referer)
path = request.get_full_path()
if referer and not _is_ignorable_404(path) and (is_internal or '?' not in referer):
ua = request.META.get('HTTP_USER_AGENT', '<none>')
ip = request.META.get('REMOTE_ADDR', '<none>')
mail_managers("Broken %slink on %s" % ((is_internal and 'INTERNAL ' or ''), domain),
"Referrer: %s\nRequested URL: %s\nUser agent: %s\nIP address: %s\n" \
% (referer, request.get_full_path(), ua, ip))
代码非常简单,很明显,在我收到的电子邮件中,Referrer与主机和请求 URL交换了。我不确定这意味着什么——如果是一些黑客试验、Django 中的一些错误或者我的代码中的一些错误(仅供参考:Django 尚未修补,其他broken link
电子邮件是正确的)。
你知道这里有什么问题吗?