Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock package twisted

This is a one-line change that fixes a regression in the format
of the logs produced by the HTTP server machinery sported by
the python-twisted-web package.

Up to version 13.2.0-1 a log line was looking like:

1.2.3.4 - - [25/Oct/2004:12:31:59 +0000] "GET /dummy HTTP/1.0" 123 - "-" "-"

but starting from 14.0.0-1 it looks like

"1.2.3.4" - - [25/Oct/2004:12:31:59 +0000] "GET /dummy HTTP/1.0" 123 - "-" "-"

Note the double quotes around the IP.

This can break third-party unit tests or code that parses
log files (it happened with a project of mine), and it also
diverges from the combined log format described on the Apache
web site:

​http://httpd.apache.org/docs/1.3/logs.html

As mentioned, the change in actual code is a one-liner, however
the patch is a bit larger to fix unit tests as well.

See Debian bug #772629.

Thanks.

diff -Nru twisted-14.0.2/debian/changelog twisted-14.0.2/debian/changelog
--- twisted-14.0.2/debian/changelog     2014-10-01 13:29:12.000000000 +0200
+++ twisted-14.0.2/debian/changelog     2014-12-09 12:00:32.000000000 +0100
@@ -1,3 +1,10 @@
+twisted (14.0.2-3) unstable; urgency=medium
+
+  * Add debian/combinedlog.patch to fix upstream's bug #7730 and
+    restore the old combined log format. Closes: #772629.
+
+ -- Free Ekanayaka <fr...@debian.org>  Tue, 09 Dec 2014 11:58:50 +0100
+
 twisted (14.0.2-2) unstable; urgency=medium
 
   * Re-add lost 14.0.2-2 upload. Closes: #763581.
diff -Nru twisted-14.0.2/debian/patches/combinedlog.patch 
twisted-14.0.2/debian/patches/combinedlog.patch
--- twisted-14.0.2/debian/patches/combinedlog.patch     1970-01-01 
01:00:00.000000000 +0100
+++ twisted-14.0.2/debian/patches/combinedlog.patch     2014-12-09 
11:58:34.000000000 +0100
@@ -0,0 +1,99 @@
+Description: Don't enclose IPs between double quotes in combined log
+ This is a fix for upstream bug #7730, which restores the combined log
+ format that was in place until version 14.0.0. See also
+
+ https://twistedmatrix.com/trac/ticket/7730
+
+ for more details.
+Author: Free Ekanayaka <fr...@debian.org>
+Bug-Debian: https://bugs.debian.org/772629
+Forwarded: yes
+Last-Update: 2014-11-09
+
+--- twisted-14.0.2.orig/twisted/web/http.py
++++ twisted-14.0.2/twisted/web/http.py
+@@ -1860,7 +1860,7 @@
+     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,
+
+--- twisted-14.0.2.orig/twisted/web/test/test_web.py
++++ twisted-14.0.2twisted/web/test/test_web.py
+@@ -874,7 +874,7 @@
+ 
+         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)
+@@ -974,7 +974,7 @@
+ 
+         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)
+ 
+@@ -1066,7 +1066,7 @@
+         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')
+ 
+ 
+@@ -1078,7 +1078,7 @@
+             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')
+ 
+ 
+@@ -1090,7 +1090,7 @@
+             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')
+ 
+ 
+@@ -1102,7 +1102,7 @@
+             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')
+ 
+ 
+@@ -1116,7 +1116,7 @@
+         self.request.headers[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')
+ 
+@@ -1130,7 +1130,7 @@
+             25, 'Oct', 2004, 12, 31, 59)
+         self.request.headers[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')
+ 
+ 
+
diff -Nru twisted-14.0.2/debian/patches/series 
twisted-14.0.2/debian/patches/series
--- twisted-14.0.2/debian/patches/series        2014-09-30 15:21:21.000000000 
+0200
+++ twisted-14.0.2/debian/patches/series        2014-12-09 11:52:09.000000000 
+0100
@@ -1,2 +1,3 @@
 tap2deb.diff
 wxpython3.0.patch
+combinedlog.patch

unblock twisted/14.0.2-3


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to