I found that
tracd does not work in some cases, specifically when the http header is folded because of its longness. To solve this problem, I modified
/usr/lib/python2.4/site-packages/trac/web/wsgi.py
as following.
- Make
unfold_header
function.
def unfold_header(self):
lineno = 1
while lineno < len(self.headers.headers):
header = self.headers.headers[lineno]
if header.startswith(' ') or header.startswith('\t'):
self.headers.headers[lineno - 1] += header
del(self.headers.headers[lineno])
else:
lineno = lineno + 1
- Call this function from
setup_environ
function in WSGIRequestHandler
class.
length = self.headers.getheader('content-length')
if length:
environ['CONTENT_LENGTH'] = length
# insert this line here.
self.unfold_header()
for name, value in [header.split(':', 1) for header
in self.headers.headers]:
This was my first time to program in Python, so there might be some problems. But this modified tracd is working for now.
No comments:
Post a Comment