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
7526deca
Commit
7526deca
authored
Apr 19, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #348: decapitate() now recognizes both \r\n and \n\n
to be compliant with the HTTP RFC
parent
a5ab9f75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
7 deletions
+19
-7
lib/python/OFS/DTMLMethod.py
lib/python/OFS/DTMLMethod.py
+19
-7
No files found.
lib/python/OFS/DTMLMethod.py
View file @
7526deca
...
...
@@ -12,7 +12,7 @@
##############################################################################
"""DTML Method objects."""
__version__
=
'$Revision: 1.7
7
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
8
$'
[
11
:
-
2
]
import
History
from
Globals
import
HTML
,
DTMLFile
,
MessageDialog
...
...
@@ -349,28 +349,40 @@ import re
token
=
"[a-zA-Z0-9!#$%&'*+
\
-.
\
\
\
\
^_`|~]+
"
hdr_start = re.compile(r'(%s):(.*)' % token).match
def decapitate(html, RESPONSE=None):
headers = []
spos = 0
spos = 0
eolen = 1
while 1:
m = hdr_start(html, spos)
if not m:
if html[spos:spos+2] == '
\
r
\
n
':
eolen = 2
break
if html[spos:spos+1] == '
\
n
':
eolen = 1
break
return html
header = list(m.groups())
headers.append(header)
spos = m.end() + 1
while spos < len(html) and html[spos] in '
\
t
':
eol = html.find( '
\
n
', spos)
if eol < 0: return html
header.append(html[spos:eol].strip())
spos = eol + 1
eol = find(html, '
\
r
\
n
', spos)
if eol <> -1:
eolen = 2
else:
eol = find(html, '
\
n
', spos)
if eol < 0: return html
eolen = 1
header.append(strip(html[spos:eol]))
spos = eol + eolen
if RESPONSE is not None:
for header in headers:
hkey = header.pop(0)
RESPONSE.setHeader(hkey, ' '.join(header).strip())
return html[spos + 1:]
return html[spos + eolen:]
default_dm_html="""<dtml-var standard_html_header>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
...
...
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