请求损坏(或 Django 中的“损坏链接”报告)?
我收到了奇怪的断开链接报告:
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许可证在此处申请;)):
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尚未修补并且其他损坏的链接
电子邮件是正确的)。
你知道这里可能出了什么问题吗?
I received strange broken link report:
Subject: Broken link on googleads.g.doubleclick.net
Referrer: (url on **my** site!)
Requested URL: /pagead/ads?(...)
User agent: (...)
IP address: (some foreign country)
So I took a look at CommonMiddleware, responsible for sending those reports.
It goes like this (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))
The code is so simple that it's quite obvious that in the email I received Referrer is swapped with host and request URL. I'm not sure what it means - if it was some hack trial, some bug in Django or maybe some bug in my code (FYI: Django hasn't been patched and other broken link
emails are correct).
Do you have any idea what could be wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它没有被交换。引荐来源网址是您的网站,因为您的网站上有点击,例如 http:// /www.reddit.com/domain/googleads.g.doubleclick.net
报告一切正常,也许您只是感到困惑,因为它尝试访问的网址看起来像外部域。这里有一些关于这个主题的帖子,实际上你并不是唯一一个被此类链接击中的人(谷歌“googleads.g.doubleclick.net”得到了超过半百万的结果,大多数网站上都有奇怪的错误)
如果我错了,也许提供一些有关网址的更多详细信息,但我认为这里一切都很好。
http://www.google.com/ support/googleanalytics/bin/answer.py?hlrm=pl&answer=55581
http://www.google. com/support/forum/p/Google+Analytics/thread?tid=200cb2d4021f93ce&hl=en
it's not swapped. the referrer is your site, because there are hits onto your site, like http://www.reddit.com/domain/googleads.g.doubleclick.net
everything is fine with the report, maybe you just got confused because the url it tries to hit looks like an external domain. here are some threads on the subject, actually you are not the only one who got hit with such links (google "googleads.g.doubleclick.net" got over half mil results, most with strange errors on websites)
if i'm wrong, provide maybe some more details on the urls, but i think everything is fine here.
http://www.google.com/support/googleanalytics/bin/answer.py?hlrm=pl&answer=55581
http://www.google.com/support/forum/p/Google+Analytics/thread?tid=200cb2d4021f93ce&hl=en