Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
131a4ee2
Commit
131a4ee2
authored
Dec 18, 2000
by
Evan Simpson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't try to fix user HTML.
parent
5eb1539a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
32 deletions
+36
-32
ZServer/HTTPResponse.py
ZServer/HTTPResponse.py
+18
-16
lib/python/ZServer/HTTPResponse.py
lib/python/ZServer/HTTPResponse.py
+18
-16
No files found.
ZServer/HTTPResponse.py
View file @
131a4ee2
...
...
@@ -92,7 +92,7 @@ and logging duties.
import
time
,
regex
,
string
,
sys
,
tempfile
from
cStringIO
import
StringIO
import
thread
from
ZPublisher.HTTPResponse
import
HTTPResponse
,
end_of_header_search
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
medusa.http_date
import
build_http_date
from
PubCore.ZEvent
import
Wakeup
from
medusa.producers
import
hooked_producer
...
...
@@ -140,21 +140,23 @@ class ZServerHTTPResponse(HTTPResponse):
else
:
c
=
'text/plain'
self
.
setHeader
(
'content-type'
,
c
)
else
:
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
:])
elif
contHTML
:
body
=
'<html><head></head>
\
n
'
+
body
else
:
body
=
'<html><head></head>
\
n
'
+
body
+
'
\
n
</html>
\
n
'
self
.
setBody
(
body
)
body
=
self
.
body
# Don't try to fix user HTML
#else:
# 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:])
# elif contHTML:
# body='<html><head></head>\n' + body
# else:
# body='<html><head></head>\n' + body + '\n</html>\n'
# self.setBody(body)
# body=self.body
# set 204 (no content) status if 200 and response is empty
# and not streaming
...
...
lib/python/ZServer/HTTPResponse.py
View file @
131a4ee2
...
...
@@ -92,7 +92,7 @@ and logging duties.
import
time
,
regex
,
string
,
sys
,
tempfile
from
cStringIO
import
StringIO
import
thread
from
ZPublisher.HTTPResponse
import
HTTPResponse
,
end_of_header_search
from
ZPublisher.HTTPResponse
import
HTTPResponse
from
medusa.http_date
import
build_http_date
from
PubCore.ZEvent
import
Wakeup
from
medusa.producers
import
hooked_producer
...
...
@@ -140,21 +140,23 @@ class ZServerHTTPResponse(HTTPResponse):
else
:
c
=
'text/plain'
self
.
setHeader
(
'content-type'
,
c
)
else
:
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
:])
elif
contHTML
:
body
=
'<html><head></head>
\
n
'
+
body
else
:
body
=
'<html><head></head>
\
n
'
+
body
+
'
\
n
</html>
\
n
'
self
.
setBody
(
body
)
body
=
self
.
body
# Don't try to fix user HTML
#else:
# 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:])
# elif contHTML:
# body='<html><head></head>\n' + body
# else:
# body='<html><head></head>\n' + body + '\n</html>\n'
# self.setBody(body)
# body=self.body
# set 204 (no content) status if 200 and response is empty
# and not streaming
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment