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
4345f70c
Commit
4345f70c
authored
Jan 11, 1999
by
Amos Latteier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
this version actually works. Still has a ways to go in terms of efficiency.
parent
d7521118
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
324 additions
and
384 deletions
+324
-384
ZServer/zope_handler.py
ZServer/zope_handler.py
+162
-192
lib/python/ZServer/zope_handler.py
lib/python/ZServer/zope_handler.py
+162
-192
No files found.
ZServer/zope_handler.py
View file @
4345f70c
...
...
@@ -124,20 +124,45 @@ class zope_handler:
def
continue_request
(
self
,
sin
,
request
):
"continue handling request now that we have the stdin"
self
.
request
=
request
request
.
data
=
[]
outpipe
=
handle
(
self
.
module_name
,
self
.
get_environment
(
request
),
sin
,
self
.
finish
)
self
.
get_environment
(
request
),
sin
,(
self
.
more
,(
request
,)))
def
more
(
self
,
request
,
pipe
):
"""packages up the current output from the output pipe.
called repeatedly when there is something in the output pipe"""
# XXX does not stream, probably inefficient.
done
=
None
while
not
done
:
data
=
pipe
.
read
()
if
data
is
None
:
done
=
1
elif
data
==
""
:
done
=
1
self
.
finish
(
request
)
else
:
request
.
data
.
append
(
data
)
def
finish
(
self
,
request
):
"finishes up the response"
def
finish
(
self
):
print
"finish called"
self
.
request
.
reply_code
=
200
self
.
request
[
"Content-type"
]
=
"text/html"
self
.
request
.
push
(
outputpipe_producer
(
outpipe
))
self
.
request
.
done
()
del
self
.
request
# XXX does not stream, probably inefficient to boot
data
=
string
.
join
(
request
.
data
,
''
)
if
string
.
find
(
data
,
"
\
n
\
n
"
):
[
headers
,
html
]
=
string
.
split
(
data
,
"
\
n
\
n
"
,
1
)
headers
=
string
.
split
(
headers
,
"
\
n
"
)
for
line
in
headers
:
[
header
,
header_value
]
=
string
.
split
(
line
,
": "
,
1
)
if
header
==
"Status"
:
[
code
,
message
]
=
string
.
split
(
header_value
,
" "
,
1
)
request
.
reply_code
=
string
.
atoi
(
code
)
else
:
request
[
header
]
=
header_value
request
.
push
(
html
)
request
.
done
()
def
status
(
self
):
return
producers
.
simple_producer
(
"""
...
...
@@ -177,58 +202,3 @@ class input_collector:
del
self
.
handler
del
self
.
request
h
.
continue_request
(
self
.
data
,
r
)
class
outputpipe_producer
:
"producer for outputpipe"
def
__init__
(
self
,
pipe
):
self
.
more
=
pipe
.
read
class
outputpipe_producer2
:
"producer for outputpipe response"
def
__init__
(
self
,
request
,
pipe
):
self
.
request
=
request
self
.
pipe
=
pipe
self
.
data
=
""
self
.
latch
=
None
def
ready
(
self
):
print
"ready called"
if
self
.
latch
is
not
None
:
self
.
read_headers
()
if
self
.
latch
is
not
None
and
(
self
.
data
or
self
.
pipe
.
_buf
):
return
1
else
:
return
0
def
more
(
self
):
print
"more called"
if
self
.
latch
is
not
None
:
if
self
.
data
:
return
self
.
data
else
:
return
self
.
pipe
.
read
()
else
:
self
.
read_headers
()
return
self
.
more
()
def
read_headers
(
self
):
print
"read headers called"
self
.
data
=
self
.
data
+
self
.
pipe
.
read
()
if
string
.
find
(
self
.
data
,
"
\
n
\
n
"
):
print
"headers found"
[
headers
,
html
]
=
string
.
split
(
self
.
data
,
"
\
n
\
n
"
,
1
)
headers
=
string
.
split
(
headers
,
"
\
n
"
)
for
line
in
headers
:
[
header
,
header_value
]
=
string
.
split
(
line
,
": "
,
1
)
if
header
==
"Status"
:
[
code
,
message
]
=
string
.
split
(
header_value
,
" "
,
1
)
self
.
request
.
reply_code
=
string
.
atoi
(
code
)
else
:
self
.
request
[
header
]
=
header_value
self
.
data
=
html
self
.
latch
=
1
\ No newline at end of file
lib/python/ZServer/zope_handler.py
View file @
4345f70c
...
...
@@ -124,20 +124,45 @@ class zope_handler:
def
continue_request
(
self
,
sin
,
request
):
"continue handling request now that we have the stdin"
self
.
request
=
request
request
.
data
=
[]
outpipe
=
handle
(
self
.
module_name
,
self
.
get_environment
(
request
),
sin
,
self
.
finish
)
self
.
get_environment
(
request
),
sin
,(
self
.
more
,(
request
,)))
def
more
(
self
,
request
,
pipe
):
"""packages up the current output from the output pipe.
called repeatedly when there is something in the output pipe"""
# XXX does not stream, probably inefficient.
done
=
None
while
not
done
:
data
=
pipe
.
read
()
if
data
is
None
:
done
=
1
elif
data
==
""
:
done
=
1
self
.
finish
(
request
)
else
:
request
.
data
.
append
(
data
)
def
finish
(
self
,
request
):
"finishes up the response"
def
finish
(
self
):
print
"finish called"
self
.
request
.
reply_code
=
200
self
.
request
[
"Content-type"
]
=
"text/html"
self
.
request
.
push
(
outputpipe_producer
(
outpipe
))
self
.
request
.
done
()
del
self
.
request
# XXX does not stream, probably inefficient to boot
data
=
string
.
join
(
request
.
data
,
''
)
if
string
.
find
(
data
,
"
\
n
\
n
"
):
[
headers
,
html
]
=
string
.
split
(
data
,
"
\
n
\
n
"
,
1
)
headers
=
string
.
split
(
headers
,
"
\
n
"
)
for
line
in
headers
:
[
header
,
header_value
]
=
string
.
split
(
line
,
": "
,
1
)
if
header
==
"Status"
:
[
code
,
message
]
=
string
.
split
(
header_value
,
" "
,
1
)
request
.
reply_code
=
string
.
atoi
(
code
)
else
:
request
[
header
]
=
header_value
request
.
push
(
html
)
request
.
done
()
def
status
(
self
):
return
producers
.
simple_producer
(
"""
...
...
@@ -177,58 +202,3 @@ class input_collector:
del
self
.
handler
del
self
.
request
h
.
continue_request
(
self
.
data
,
r
)
class
outputpipe_producer
:
"producer for outputpipe"
def
__init__
(
self
,
pipe
):
self
.
more
=
pipe
.
read
class
outputpipe_producer2
:
"producer for outputpipe response"
def
__init__
(
self
,
request
,
pipe
):
self
.
request
=
request
self
.
pipe
=
pipe
self
.
data
=
""
self
.
latch
=
None
def
ready
(
self
):
print
"ready called"
if
self
.
latch
is
not
None
:
self
.
read_headers
()
if
self
.
latch
is
not
None
and
(
self
.
data
or
self
.
pipe
.
_buf
):
return
1
else
:
return
0
def
more
(
self
):
print
"more called"
if
self
.
latch
is
not
None
:
if
self
.
data
:
return
self
.
data
else
:
return
self
.
pipe
.
read
()
else
:
self
.
read_headers
()
return
self
.
more
()
def
read_headers
(
self
):
print
"read headers called"
self
.
data
=
self
.
data
+
self
.
pipe
.
read
()
if
string
.
find
(
self
.
data
,
"
\
n
\
n
"
):
print
"headers found"
[
headers
,
html
]
=
string
.
split
(
self
.
data
,
"
\
n
\
n
"
,
1
)
headers
=
string
.
split
(
headers
,
"
\
n
"
)
for
line
in
headers
:
[
header
,
header_value
]
=
string
.
split
(
line
,
": "
,
1
)
if
header
==
"Status"
:
[
code
,
message
]
=
string
.
split
(
header_value
,
" "
,
1
)
self
.
request
.
reply_code
=
string
.
atoi
(
code
)
else
:
self
.
request
[
header
]
=
header_value
self
.
data
=
html
self
.
latch
=
1
\ No newline at end of file
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