Commit 21c96ce1 authored by 's avatar

Added better handling of content-length header.

parent cd853447
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
############################################################################## ##############################################################################
'''CGI Response Output formatter '''CGI Response Output formatter
$Id: Response.py,v 1.45 1998/12/04 20:15:34 jim Exp $''' $Id: Response.py,v 1.46 1999/01/13 15:15:20 brian Exp $'''
__version__='$Revision: 1.45 $'[11:-2] __version__='$Revision: 1.46 $'[11:-2]
import string, types, sys, regex import string, types, sys, regex
from string import find, rfind, lower, upper, strip, split, join, translate from string import find, rfind, lower, upper, strip, split, join, translate
...@@ -600,14 +600,13 @@ class Response: ...@@ -600,14 +600,13 @@ class Response:
body='<html><head></head>\n' + body body='<html><head></head>\n' + body
self.setBody(body) self.setBody(body)
body=self.body body=self.body
if not headers.has_key('content-length'):
self.setHeader('content-length',len(body))
if not headers.has_key('content-type') and self.status == 200: if not headers.has_key('content-type') and self.status == 200:
self.setStatus('nocontent') self.setStatus('nocontent')
if not headers.has_key('content-length'):
self.setHeader('content-length',len(body))
headersl=[] headersl=[]
append=headersl.append append=headersl.append
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment