yet simpler header logic, thanks Anthony and Niphlod

This commit is contained in:
mdipierro
2012-09-11 14:06:44 -05:00
parent 2c509a7bc4
commit 8f7bafb963
3 changed files with 5 additions and 6 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.0.8 (2012-09-11 14:02:50) stable
Version 2.0.8 (2012-09-11 14:06:40) stable
+3 -3
View File
@@ -89,14 +89,14 @@ class HTTP(BaseException):
status = str(status)
if not regex_status.match(status):
status = '500 %s' % (defined_status[500])
if not 'Content-Type' in headers:
headers['Content-Type'] = 'text/html; charset=UTF-8'
headers.setdefault('Content-Type','text/html; charset=UTF-8')
body = self.body
if status[:1] == '4':
if not body:
body = status
if isinstance(body, str):
if len(body)<512 and headers['Content-Type'].startswith('text/html'):
if len(body)<512 and \
headers['Content-Type'].startswith('text/html'):
body += '<!-- %s //-->' % ('x'*512) ### trick IE
headers['Content-Length'] = len(body)
rheaders = []
+1 -2
View File
@@ -556,8 +556,7 @@ def wsgibase(environ, responder):
response.js.replace('\n','')))
for key,value in default_headers:
if not key in rheaders:
rheaders[key] = value
rheaders.setdefault(key,value)
# ##################################################
# store cookies in headers