From bb16e47d87bc2ae33b6479ac180b1a87dcdd48d8 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Wed, 23 Jul 2008 07:13:13 +0000
Subject: [PATCH] One more patch: quote the request when logging. This is more
 compatible with apache.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@22622 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/patches/http_server.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/patches/http_server.py b/product/ERP5Type/patches/http_server.py
index 3b475e4e92..ffdf1f5cd5 100644
--- a/product/ERP5Type/patches/http_server.py
+++ b/product/ERP5Type/patches/http_server.py
@@ -25,6 +25,7 @@ from ZPublisher.HTTPRequest import trusted_proxies
 import string
 import base64
 import time
+from urllib import quote
 
 def log (self, bytes):
     # The purpose of this patch is to emit original IP addresses in Z2.log
@@ -63,7 +64,12 @@ def log (self, bytes):
         '- %s [%s] "%s" %d %d "%s" "%s"\n' % (
             name,
             self.log_date_string (time.time()),
-            self.request,
+            # Originally, an unquoted request string was logged, but
+            # it only confuses log analysis programs! Note that Apache
+            # HTTP Server never unquote URIs in the access log.
+            # <patch>
+            quote(self.request),
+            # </patch>
             self.reply_code,
             bytes,
             referer,
-- 
2.30.9