[Python-modules-commits] [twisted] 07/16: combinedlog
Free Ekanayaka
freee at moszumanska.debian.org
Mon Aug 28 17:40:02 UTC 2017
This is an automated email from the git hooks/post-receive script.
freee pushed a commit to branch patch-queue/master
in repository twisted.
commit bf5e3b941ad252c896f72dacd6564054640f17a6
Author: Matthias Klose <doko at debian.org>
Date: Thu Oct 20 04:34:06 2016 +0000
combinedlog
Preserve backward-compatibility in the way the client IP of a request
is logged by the twisted.web HTTP server.
Bug: https://twistedmatrix.com/trac/ticket/7730
Bug-Debian https://bugs.debian.org/772629
Gbp-Pq: Name 0002-combinedlog.patch
---
src/twisted/web/http.py | 2 +-
src/twisted/web/test/test_web.py | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
index cbef2ab..35e7229 100644
--- a/src/twisted/web/http.py
+++ b/src/twisted/web/http.py
@@ -2472,7 +2472,7 @@ def combinedLogFormatter(timestamp, request):
referrer = _escape(request.getHeader(b"referer") or b"-")
agent = _escape(request.getHeader(b"user-agent") or b"-")
line = (
- u'"%(ip)s" - - %(timestamp)s "%(method)s %(uri)s %(protocol)s" '
+ u'%(ip)s - - %(timestamp)s "%(method)s %(uri)s %(protocol)s" '
u'%(code)d %(length)s "%(referrer)s" "%(agent)s"' % dict(
ip=_escape(request.getClientIP() or b"-"),
timestamp=timestamp,
diff --git a/src/twisted/web/test/test_web.py b/src/twisted/web/test/test_web.py
index 0418f15..03759f0 100644
--- a/src/twisted/web/test/test_web.py
+++ b/src/twisted/web/test/test_web.py
@@ -1183,7 +1183,7 @@ class AccessLogTestsMixin(object):
self.assertEqual(
# Client IP
- b'"1.2.3.4" '
+ b'1.2.3.4 '
# Some blanks we never fill in
b'- - '
# The current time (circa 1234567890)
@@ -1283,7 +1283,7 @@ class CombinedLogFormatterTests(unittest.TestCase):
line = http.combinedLogFormatter(timestamp, request)
self.assertEqual(
- u'"evil x-forwarded-for \\x80" - - [13/Feb/2009:23:31:30 +0000] '
+ u'evil x-forwarded-for \\x80 - - [13/Feb/2009:23:31:30 +0000] '
u'"POS\\x81 /dummy HTTP/1.0" 123 - "evil \\x83" "evil \\x84"',
line)
@@ -1375,7 +1375,7 @@ class LogEscapingTests(unittest.TestCase):
self.site._logDateTime = "[%02d/%3s/%4d:%02d:%02d:%02d +0000]" % (
25, 'Oct', 2004, 12, 31, 59)
self.assertLogs(
- b'"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] '
+ b'1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] '
b'"GET /dummy HTTP/1.0" 123 - "-" "-"\n')
@@ -1387,7 +1387,7 @@ class LogEscapingTests(unittest.TestCase):
25, 'Oct', 2004, 12, 31, 59)
self.request.method = b'G"T'
self.assertLogs(
- b'"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] '
+ b'1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] '
b'"G\\"T /dummy HTTP/1.0" 123 - "-" "-"\n')
@@ -1399,7 +1399,7 @@ class LogEscapingTests(unittest.TestCase):
25, 'Oct', 2004, 12, 31, 59)
self.request.uri = b'/dummy"withquote'
self.assertLogs(
- b'"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] '
+ b'1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] '
b'"GET /dummy\\"withquote HTTP/1.0" 123 - "-" "-"\n')
@@ -1411,7 +1411,7 @@ class LogEscapingTests(unittest.TestCase):
25, 'Oct', 2004, 12, 31, 59)
self.request.clientproto = b'HT"P/1.0'
self.assertLogs(
- b'"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] '
+ b'1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] '
b'"GET /dummy HT\\"P/1.0" 123 - "-" "-"\n')
@@ -1426,7 +1426,7 @@ class LogEscapingTests(unittest.TestCase):
b'referer',
b'http://malicious" ".website.invalid')
self.assertLogs(
- b'"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] '
+ b'1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] '
b'"GET /dummy HTTP/1.0" 123 - '
b'"http://malicious\\" \\".website.invalid" "-"\n')
@@ -1441,7 +1441,7 @@ class LogEscapingTests(unittest.TestCase):
self.request.requestHeaders.addRawHeader(b'user-agent',
b'Malicious Web" Evil')
self.assertLogs(
- b'"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] '
+ b'1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] '
b'"GET /dummy HTTP/1.0" 123 - "-" "Malicious Web\\" Evil"\n')
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/twisted.git
More information about the Python-modules-commits
mailing list