Browse files

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: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent eb107e1 commit 9f180a1bc5e6e40c2b97b72ab15395f375861386 @spookylukey spookylukey committed Apr 20, 2007
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/middleware/
@@ -66,8 +66,10 @@ def process_response(self, request, response):
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.

0 comments on commit 9f180a1

Please sign in to comment.