mirror of https://github.com/django/django.git
Added client IP address to the e-mail that is sent when an internal
broken link is detected. This is to help with filtering out misbehaving bots. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
eb107e1ae9
commit
9f180a1bc5
|
@ -66,8 +66,10 @@ class CommonMiddleware(object):
|
|||
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\n" % (referer, request.get_full_path(), ua))
|
||||
"Referrer: %s\nRequested URL: %s\nUser agent: %s\nIP address: %s\n" \
|
||||
% (referer, request.get_full_path(), ua, ip))
|
||||
return response
|
||||
|
||||
# Use ETags, if requested.
|
||||
|
|
Loading…
Reference in New Issue