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
77e859e0
Commit
77e859e0
authored
Dec 05, 2000
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch from Jeff Ragsdale to fix overlapping POST requests.
parent
ba5be2f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
50 deletions
+60
-50
ZServer/HTTPServer.py
ZServer/HTTPServer.py
+30
-25
lib/python/ZServer/HTTPServer.py
lib/python/ZServer/HTTPServer.py
+30
-25
No files found.
ZServer/HTTPServer.py
View file @
77e859e0
...
...
@@ -138,6 +138,35 @@ header2env={'content-length' : 'CONTENT_LENGTH',
'connection'
:
'CONNECTION_TYPE'
,
}
class
zhttp_collector
:
def
__init__
(
self
,
handler
,
request
,
size
):
self
.
handler
=
handler
self
.
request
=
request
if
size
>
524288
:
# write large upload data to a file
from
tempfile
import
TemporaryFile
self
.
data
=
TemporaryFile
(
'w+b'
)
else
:
self
.
data
=
StringIO
()
request
.
channel
.
set_terminator
(
size
)
request
.
collector
=
self
# put and post collection methods
#
def
collect_incoming_data
(
self
,
data
):
self
.
data
.
write
(
data
)
def
found_terminator
(
self
):
# reset collector
self
.
request
.
channel
.
set_terminator
(
'
\
r
\
n
\
r
\
n
'
)
self
.
request
.
collector
=
None
# finish request
self
.
data
.
seek
(
0
)
r
=
self
.
request
d
=
self
.
data
del
self
.
request
del
self
.
data
self
.
handler
.
continue_request
(
d
,
r
)
class
zhttp_handler
:
"A medusa style handler for zhttp_server"
...
...
@@ -186,15 +215,7 @@ class zhttp_handler:
size
=
get_header
(
CONTENT_LENGTH
,
request
.
header
)
if
size
and
size
!=
'0'
:
size
=
string
.
atoi
(
size
)
if
size
>
524288
:
# write large upload data to a file
from
tempfile
import
TemporaryFile
self
.
data
=
TemporaryFile
(
'w+b'
)
else
:
self
.
data
=
StringIO
()
self
.
request
=
request
request
.
channel
.
set_terminator
(
size
)
request
.
collector
=
self
zhttp_collector
(
self
,
request
,
size
)
else
:
sin
=
StringIO
()
self
.
continue_request
(
sin
,
request
)
...
...
@@ -294,22 +315,6 @@ class zhttp_handler:
</ul>"""
%
(
self
.
module_name
,
self
.
hits
)
)
# put and post collection methods
#
def
collect_incoming_data
(
self
,
data
):
self
.
data
.
write
(
data
)
def
found_terminator
(
self
):
# reset collector
self
.
request
.
channel
.
set_terminator
(
'
\
r
\
n
\
r
\
n
'
)
self
.
request
.
collector
=
None
# finish request
self
.
data
.
seek
(
0
)
r
=
self
.
request
d
=
self
.
data
del
self
.
request
del
self
.
data
self
.
continue_request
(
d
,
r
)
class
zhttp_channel
(
http_channel
):
...
...
lib/python/ZServer/HTTPServer.py
View file @
77e859e0
...
...
@@ -138,6 +138,35 @@ header2env={'content-length' : 'CONTENT_LENGTH',
'connection'
:
'CONNECTION_TYPE'
,
}
class
zhttp_collector
:
def
__init__
(
self
,
handler
,
request
,
size
):
self
.
handler
=
handler
self
.
request
=
request
if
size
>
524288
:
# write large upload data to a file
from
tempfile
import
TemporaryFile
self
.
data
=
TemporaryFile
(
'w+b'
)
else
:
self
.
data
=
StringIO
()
request
.
channel
.
set_terminator
(
size
)
request
.
collector
=
self
# put and post collection methods
#
def
collect_incoming_data
(
self
,
data
):
self
.
data
.
write
(
data
)
def
found_terminator
(
self
):
# reset collector
self
.
request
.
channel
.
set_terminator
(
'
\
r
\
n
\
r
\
n
'
)
self
.
request
.
collector
=
None
# finish request
self
.
data
.
seek
(
0
)
r
=
self
.
request
d
=
self
.
data
del
self
.
request
del
self
.
data
self
.
handler
.
continue_request
(
d
,
r
)
class
zhttp_handler
:
"A medusa style handler for zhttp_server"
...
...
@@ -186,15 +215,7 @@ class zhttp_handler:
size
=
get_header
(
CONTENT_LENGTH
,
request
.
header
)
if
size
and
size
!=
'0'
:
size
=
string
.
atoi
(
size
)
if
size
>
524288
:
# write large upload data to a file
from
tempfile
import
TemporaryFile
self
.
data
=
TemporaryFile
(
'w+b'
)
else
:
self
.
data
=
StringIO
()
self
.
request
=
request
request
.
channel
.
set_terminator
(
size
)
request
.
collector
=
self
zhttp_collector
(
self
,
request
,
size
)
else
:
sin
=
StringIO
()
self
.
continue_request
(
sin
,
request
)
...
...
@@ -294,22 +315,6 @@ class zhttp_handler:
</ul>"""
%
(
self
.
module_name
,
self
.
hits
)
)
# put and post collection methods
#
def
collect_incoming_data
(
self
,
data
):
self
.
data
.
write
(
data
)
def
found_terminator
(
self
):
# reset collector
self
.
request
.
channel
.
set_terminator
(
'
\
r
\
n
\
r
\
n
'
)
self
.
request
.
collector
=
None
# finish request
self
.
data
.
seek
(
0
)
r
=
self
.
request
d
=
self
.
data
del
self
.
request
del
self
.
data
self
.
continue_request
(
d
,
r
)
class
zhttp_channel
(
http_channel
):
...
...
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