Commit 032ffbaa authored by 's avatar

Merged bug fix from 2.2 branch

parent def215cc
......@@ -132,7 +132,7 @@ class ZServerHTTPResponse(HTTPResponse):
headers=self.headers
body=self.body
if body:
isHTML=self.isHTML(body)
isHTML=contHTML=self.isHTML(body)
if not headers.has_key('content-type'):
if isHTML:
c='text/html'
......@@ -140,14 +140,17 @@ class ZServerHTTPResponse(HTTPResponse):
c='text/plain'
self.setHeader('content-type',c)
else:
isHTML = headers['content-type']=='text/html'
isHTML = string.split(headers.get('content_type', ''),
';')[0] == 'text/html'
if isHTML and end_of_header_search(self.body) < 0:
lhtml=html_search(body)
if lhtml >= 0:
lhtml=lhtml+6
body='%s<head></head>\n%s' % (body[:lhtml],body[lhtml:])
else:
elif contHTML:
body='<html><head></head>\n' + body
else:
body='<html><head></head>\n' + body + '\n</html>\n'
self.setBody(body)
body=self.body
......
......@@ -132,7 +132,7 @@ class ZServerHTTPResponse(HTTPResponse):
headers=self.headers
body=self.body
if body:
isHTML=self.isHTML(body)
isHTML=contHTML=self.isHTML(body)
if not headers.has_key('content-type'):
if isHTML:
c='text/html'
......@@ -140,14 +140,17 @@ class ZServerHTTPResponse(HTTPResponse):
c='text/plain'
self.setHeader('content-type',c)
else:
isHTML = headers['content-type']=='text/html'
isHTML = string.split(headers.get('content_type', ''),
';')[0] == 'text/html'
if isHTML and end_of_header_search(self.body) < 0:
lhtml=html_search(body)
if lhtml >= 0:
lhtml=lhtml+6
body='%s<head></head>\n%s' % (body[:lhtml],body[lhtml:])
else:
elif contHTML:
body='<html><head></head>\n' + body
else:
body='<html><head></head>\n' + body + '\n</html>\n'
self.setBody(body)
body=self.body
......
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