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
17961fe6
Commit
17961fe6
authored
Jun 19, 2000
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged fix for bug 1322 (base tag wrecks <head> references).
parent
e64be072
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
lib/python/ZPublisher/HTTPResponse.py
lib/python/ZPublisher/HTTPResponse.py
+13
-10
No files found.
lib/python/ZPublisher/HTTPResponse.py
View file @
17961fe6
...
...
@@ -84,10 +84,10 @@
##############################################################################
'''CGI Response Output formatter
$Id: HTTPResponse.py,v 1.
29 2000/06/02 20:07:05 jim
Exp $'''
__version__
=
'$Revision: 1.
29
$'
[
11
:
-
2
]
$Id: HTTPResponse.py,v 1.
30 2000/06/19 21:54:52 brian
Exp $'''
__version__
=
'$Revision: 1.
30
$'
[
11
:
-
2
]
import
string
,
types
,
sys
,
regex
import
string
,
types
,
sys
,
regex
,
re
from
string
import
find
,
rfind
,
lower
,
upper
,
strip
,
split
,
join
,
translate
from
types
import
StringType
,
InstanceType
from
BaseResponse
import
BaseResponse
...
...
@@ -159,6 +159,8 @@ status_codes['keyerror']=503
status_codes
[
'redirect'
]
=
300
start_of_header_search
=
re
.
compile
(
'(<head[^>]*>)'
,
re
.
IGNORECASE
).
search
end_of_header_search
=
regex
.
compile
(
'</head>'
,
regex
.
casefold
).
search
accumulate_header
=
{
'set-cookie'
:
1
}.
has_key
...
...
@@ -332,14 +334,15 @@ class HTTPResponse(BaseResponse):
if self.base:
body=self.body
if body:
e=end_of_header_search(body)
if e >= 0:
b=base_re_search(body)
if b < 0:
self.body=('
%
s
\
t
<
base
href
=
"%s"
>
\
n
%
s
' %
(body[:e],self.base,body[e:]))
match=start_of_header_search(body)
if match is not None:
index=match.start(0) + len(match.group(0))
ibase=base_re_search(body)
if ibase < 0:
self.body=('
%
s
\
n
<
base
href
=
"%s"
>
\
n
%
s
' %
(body[:index], self.base, body[index:]))
self.setHeader('
content
-
length
', len(self.body))
def appendCookie(self, name, value):
'''
\
Returns an HTTP header that sets a cookie on cookie-enabled
...
...
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