yet simpler header logic, thanks Anthony and Niphlod
This commit is contained in:
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user