Commit eca3b9e2 authored by Jim Fulton's avatar Jim Fulton

Fixed bug that caused html didling of non-html data

parent 81ce5b5b
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
__doc__='''CGI Response Output formatter __doc__='''CGI Response Output formatter
$Id: Response.py,v 1.11 1996/09/16 14:43:25 jim Exp $''' $Id: Response.py,v 1.12 1997/01/28 22:59:19 jim Exp $'''
# Copyright # Copyright
# #
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne # Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...@@ -55,6 +55,9 @@ $Id: Response.py,v 1.11 1996/09/16 14:43:25 jim Exp $''' ...@@ -55,6 +55,9 @@ $Id: Response.py,v 1.11 1996/09/16 14:43:25 jim Exp $'''
# (540) 371-6909 # (540) 371-6909
# #
# $Log: Response.py,v $ # $Log: Response.py,v $
# Revision 1.12 1997/01/28 22:59:19 jim
# Fixed bug that caused html didling of non-html data
#
# Revision 1.11 1996/09/16 14:43:25 jim # Revision 1.11 1996/09/16 14:43:25 jim
# Changes to make shutdown methods work properly. Now shutdown methods # Changes to make shutdown methods work properly. Now shutdown methods
# can simply sys.exit(0). # can simply sys.exit(0).
...@@ -109,7 +112,7 @@ $Id: Response.py,v 1.11 1996/09/16 14:43:25 jim Exp $''' ...@@ -109,7 +112,7 @@ $Id: Response.py,v 1.11 1996/09/16 14:43:25 jim Exp $'''
# #
# #
# #
__version__='$Revision: 1.11 $'[11:-2] __version__='$Revision: 1.12 $'[11:-2]
import string, types, sys, regex, regsub import string, types, sys, regex, regsub
...@@ -313,6 +316,9 @@ class Response: ...@@ -313,6 +316,9 @@ class Response:
base_re=regex.compile('\(<base[\0- ]+\([^>]+\)>\)', base_re=regex.compile('\(<base[\0- ]+\([^>]+\)>\)',
regex.casefold) regex.casefold)
): ):
if (self.headers.has_key('content-type') and
self.headers['content-type']!='text/html'): return
if self.base: if self.base:
body=self.body body=self.body
if body: if body:
...@@ -542,6 +548,8 @@ class Response: ...@@ -542,6 +548,8 @@ class Response:
else: else:
c='text/plain' c='text/plain'
self.setHeader('content-type',c) self.setHeader('content-type',c)
else:
isHTML = headers['content-type']=='text/html'
if isHTML and end_of_header_re.search(self.body) < 0: if isHTML and end_of_header_re.search(self.body) < 0:
htmlre=regex.compile('<html>',regex.casefold) htmlre=regex.compile('<html>',regex.casefold)
lhtml=htmlre.search(body) lhtml=htmlre.search(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