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
0ea180a2
Commit
0ea180a2
authored
Aug 04, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for retrying requests.
parent
95f9afd9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
10 deletions
+64
-10
ZServer/FTPRequest.py
ZServer/FTPRequest.py
+16
-5
ZServer/HTTPResponse.py
ZServer/HTTPResponse.py
+16
-0
lib/python/ZServer/FTPRequest.py
lib/python/ZServer/FTPRequest.py
+16
-5
lib/python/ZServer/HTTPResponse.py
lib/python/ZServer/HTTPResponse.py
+16
-0
No files found.
ZServer/FTPRequest.py
View file @
0ea180a2
...
...
@@ -99,11 +99,13 @@ import string
class
FTPRequest
(
HTTPRequest
):
def
__init__
(
self
,
path
,
command
,
channel
,
response
,
stdin
=
None
):
if
stdin
is
None
:
stdin
=
StringIO
()
env
=
self
.
_get_env
(
path
,
command
,
channel
,
stdin
)
HTTPRequest
.
__init__
(
self
,
stdin
,
env
,
response
,
clean
=
1
)
def
__init__
(
self
,
path
,
command
,
channel
,
response
,
stdin
=
None
,
environ
=
None
):
if
stdin
is
None
:
stdin
=
StringIO
()
if
environ
is
None
:
environ
=
self
.
_get_env
(
path
,
command
,
channel
,
stdin
)
self
.
_orig_env
=
environ
HTTPRequest
.
__init__
(
self
,
stdin
,
environ
,
response
,
clean
=
1
)
# support for cookies and cookie authentication
self
.
cookies
=
channel
.
cookies
...
...
@@ -114,6 +116,15 @@ class FTPRequest(HTTPRequest):
if
not
self
.
other
.
has_key
(
k
):
self
.
other
[
k
]
=
v
def
retry
(
self
):
r
=
self
.
__class__
(
stdin
=
self
.
stdin
,
environ
=
self
.
_orig_env
,
response
=
self
.
response
.
retry
(),
channel
=
self
,
# For my cookies
)
r
.
_held
=
self
.
_held
return
r
def
_get_env
(
self
,
path
,
command
,
channel
,
stdin
):
"Returns a CGI style environment"
env
=
{}
...
...
ZServer/HTTPResponse.py
View file @
0ea180a2
...
...
@@ -264,6 +264,21 @@ class ChannelPipe:
self
.
_close
=
1
self
.
_request
.
reply_code
=
response
.
status
def
retry
(
self
):
"""Return a request object to be used in a retry attempt
"""
# This implementation is a bit lame, because it assumes that
# only stdout stderr were passed to the constructor. OTOH, I
# think that that's all that is ever passed.
r
=
self
.
__class__
(
stdout
=
self
.
stdout
,
stderr
=
self
.
stderr
)
response
.
_http_version
=
self
.
_http_version
response
.
_http_connection
=
self
.
_http_connection
response
.
_server_version
=
self
.
_server_version
return
r
def
make_response
(
request
,
headers
):
"Simple http response factory"
...
...
@@ -276,3 +291,4 @@ def make_response(request, headers):
response
.
_server_version
=
request
.
channel
.
server
.
SERVER_IDENT
return
response
lib/python/ZServer/FTPRequest.py
View file @
0ea180a2
...
...
@@ -99,11 +99,13 @@ import string
class
FTPRequest
(
HTTPRequest
):
def
__init__
(
self
,
path
,
command
,
channel
,
response
,
stdin
=
None
):
if
stdin
is
None
:
stdin
=
StringIO
()
env
=
self
.
_get_env
(
path
,
command
,
channel
,
stdin
)
HTTPRequest
.
__init__
(
self
,
stdin
,
env
,
response
,
clean
=
1
)
def
__init__
(
self
,
path
,
command
,
channel
,
response
,
stdin
=
None
,
environ
=
None
):
if
stdin
is
None
:
stdin
=
StringIO
()
if
environ
is
None
:
environ
=
self
.
_get_env
(
path
,
command
,
channel
,
stdin
)
self
.
_orig_env
=
environ
HTTPRequest
.
__init__
(
self
,
stdin
,
environ
,
response
,
clean
=
1
)
# support for cookies and cookie authentication
self
.
cookies
=
channel
.
cookies
...
...
@@ -114,6 +116,15 @@ class FTPRequest(HTTPRequest):
if
not
self
.
other
.
has_key
(
k
):
self
.
other
[
k
]
=
v
def
retry
(
self
):
r
=
self
.
__class__
(
stdin
=
self
.
stdin
,
environ
=
self
.
_orig_env
,
response
=
self
.
response
.
retry
(),
channel
=
self
,
# For my cookies
)
r
.
_held
=
self
.
_held
return
r
def
_get_env
(
self
,
path
,
command
,
channel
,
stdin
):
"Returns a CGI style environment"
env
=
{}
...
...
lib/python/ZServer/HTTPResponse.py
View file @
0ea180a2
...
...
@@ -264,6 +264,21 @@ class ChannelPipe:
self
.
_close
=
1
self
.
_request
.
reply_code
=
response
.
status
def
retry
(
self
):
"""Return a request object to be used in a retry attempt
"""
# This implementation is a bit lame, because it assumes that
# only stdout stderr were passed to the constructor. OTOH, I
# think that that's all that is ever passed.
r
=
self
.
__class__
(
stdout
=
self
.
stdout
,
stderr
=
self
.
stderr
)
response
.
_http_version
=
self
.
_http_version
response
.
_http_connection
=
self
.
_http_connection
response
.
_server_version
=
self
.
_server_version
return
r
def
make_response
(
request
,
headers
):
"Simple http response factory"
...
...
@@ -276,3 +291,4 @@ def make_response(request, headers):
response
.
_server_version
=
request
.
channel
.
server
.
SERVER_IDENT
return
response
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