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
6c4b3aaf
Commit
6c4b3aaf
authored
Sep 25, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace string module calls by string method calls
parent
e0626a9b
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
68 additions
and
72 deletions
+68
-72
ZServer/FTPRequest.py
ZServer/FTPRequest.py
+2
-2
ZServer/FTPServer.py
ZServer/FTPServer.py
+16
-17
ZServer/HTTPResponse.py
ZServer/HTTPResponse.py
+11
-11
ZServer/HTTPServer.py
ZServer/HTTPServer.py
+0
-1
ZServer/WebDAVSrcHandler.py
ZServer/WebDAVSrcHandler.py
+3
-3
ZServer/ZService.py
ZServer/ZService.py
+2
-2
lib/python/ZServer/FTPRequest.py
lib/python/ZServer/FTPRequest.py
+2
-2
lib/python/ZServer/FTPServer.py
lib/python/ZServer/FTPServer.py
+16
-17
lib/python/ZServer/HTTPResponse.py
lib/python/ZServer/HTTPResponse.py
+11
-11
lib/python/ZServer/HTTPServer.py
lib/python/ZServer/HTTPServer.py
+0
-1
lib/python/ZServer/WebDAVSrcHandler.py
lib/python/ZServer/WebDAVSrcHandler.py
+3
-3
lib/python/ZServer/ZService.py
lib/python/ZServer/ZService.py
+2
-2
No files found.
ZServer/FTPRequest.py
View file @
6c4b3aaf
...
...
@@ -94,7 +94,7 @@ from ZPublisher.HTTPRequest import HTTPRequest
from
cStringIO
import
StringIO
import
os
from
base64
import
encodestring
import
string
,
re
import
re
class
FTPRequest
(
HTTPRequest
):
...
...
@@ -192,7 +192,7 @@ class FTPRequest(HTTPRequest):
path
=
apply
(
os
.
path
.
join
,
args
)
path
=
os
.
path
.
normpath
(
path
)
if
os
.
sep
!=
'/'
:
path
=
string
.
replace
(
path
,
os
.
sep
,
'/'
)
path
=
path
.
replace
(
os
.
sep
,
'/'
)
return
path
...
...
ZServer/FTPServer.py
View file @
6c4b3aaf
...
...
@@ -147,7 +147,6 @@ from FTPRequest import FTPRequest
from
ZServer
import
CONNECTION_LIMIT
,
requestCloseOnExec
from
cStringIO
import
StringIO
import
string
import
os
from
mimetypes
import
guess_type
import
marshal
...
...
@@ -174,7 +173,7 @@ class zope_ftp_channel(ftp_channel):
path
=
apply
(
os
.
path
.
join
,
args
)
path
=
os
.
path
.
normpath
(
path
)
if
os
.
sep
!=
'/'
:
path
=
string
.
replace
(
path
,
os
.
sep
,
'/'
)
path
=
path
.
replace
(
os
.
sep
,
'/'
)
return
path
# Overriden async_chat methods
...
...
@@ -210,7 +209,7 @@ class zope_ftp_channel(ftp_channel):
# XXX clean this up, maybe with getopts
if
len
(
line
)
>
1
:
args
=
string
.
split
(
line
[
1
]
)
args
=
line
[
1
].
split
(
)
else
:
args
=
[]
path_args
=
[]
...
...
@@ -220,7 +219,7 @@ class zope_ftp_channel(ftp_channel):
for
i
in
range
(
len
(
args
)):
x
=
args
[
i
]
if
string
.
find
(
x
,
'*'
)
!=-
1
or
string
.
find
(
x
,
'?'
)
!=-
1
:
if
x
.
find
(
'*'
)
!=-
1
or
x
.
find
(
'?'
)
!=-
1
:
self
.
globbing
=
x
args
[
i
]
=
'.'
...
...
@@ -318,7 +317,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_mdtm
(
self
,
line
):
'show last modification time of file'
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
response
=
make_response
(
self
,
self
.
mdtm_completion
)
request
=
FTPRequest
(
line
[
1
],
'MDTM'
,
self
,
response
)
...
...
@@ -345,7 +344,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_size
(
self
,
line
):
'return size of file'
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
response
=
make_response
(
self
,
self
.
size_completion
)
request
=
FTPRequest
(
line
[
1
],
'SIZE'
,
self
,
response
)
...
...
@@ -364,7 +363,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_retr
(
self
,
line
):
if
len
(
line
)
<
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
return
response
=
make_response
(
self
,
self
.
retr_completion
,
line
[
1
])
self
.
_response_producers
=
response
.
stdout
.
_producers
...
...
@@ -398,7 +397,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_stor
(
self
,
line
,
mode
=
'wb'
):
'store a file'
if
len
(
line
)
<
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
return
elif
self
.
restart_position
:
restart_position
=
0
...
...
@@ -442,14 +441,14 @@ class zope_ftp_channel(ftp_channel):
def
cmd_rnfr
(
self
,
line
):
'rename from'
if
len
(
line
)
!=
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
else
:
self
.
fromfile
=
line
[
1
]
self
.
respond
(
'350 RNFR command successful.'
)
def
cmd_rnto
(
self
,
line
):
if
len
(
line
)
!=
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
return
pathf
,
idf
=
os
.
path
.
split
(
self
.
fromfile
)
patht
,
idt
=
os
.
path
.
split
(
line
[
1
])
...
...
@@ -466,7 +465,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_dele
(
self
,
line
):
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
path
,
id
=
os
.
path
.
split
(
line
[
1
])
response
=
make_response
(
self
,
self
.
dele_completion
)
...
...
@@ -475,7 +474,7 @@ class zope_ftp_channel(ftp_channel):
def
dele_completion
(
self
,
response
):
status
=
response
.
getStatus
()
if
status
==
200
and
string
.
find
(
response
.
body
,
'Not Deletable'
)
==-
1
:
if
status
==
200
and
response
.
body
.
find
(
'Not Deletable'
)
==-
1
:
self
.
respond
(
'250 DELE command successful.'
)
elif
status
==
401
:
self
.
respond
(
'530 Unauthorized.'
)
...
...
@@ -484,7 +483,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_mkd
(
self
,
line
):
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
path
,
id
=
os
.
path
.
split
(
line
[
1
])
response
=
make_response
(
self
,
self
.
mkd_completion
)
...
...
@@ -506,7 +505,7 @@ class zope_ftp_channel(ftp_channel):
# XXX should object be checked to see if it's folderish
# before we allow it to be RMD'd?
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
path
,
id
=
os
.
path
.
split
(
line
[
1
])
response
=
make_response
(
self
,
self
.
rmd_completion
)
...
...
@@ -517,7 +516,7 @@ class zope_ftp_channel(ftp_channel):
def
rmd_completion
(
self
,
response
):
status
=
response
.
getStatus
()
if
status
==
200
and
string
.
find
(
response
.
body
,
'Not Deletable'
)
==-
1
:
if
status
==
200
and
response
.
body
.
find
(
'Not Deletable'
)
==-
1
:
self
.
respond
(
'250 RMD command successful.'
)
elif
status
==
401
:
self
.
respond
(
'530 Unauthorized.'
)
...
...
@@ -530,7 +529,7 @@ class zope_ftp_channel(ftp_channel):
self
.
userid
=
line
[
1
]
self
.
respond
(
'331 Password required.'
)
else
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
def
cmd_pass
(
self
,
line
):
'specify password'
...
...
@@ -539,7 +538,7 @@ class zope_ftp_channel(ftp_channel):
else
:
pw
=
line
[
1
]
self
.
password
=
pw
i
=
s
tring
.
find
(
self
.
userid
,
'@'
)
i
=
s
elf
.
userid
.
find
(
'@'
)
if
i
==-
1
:
if
self
.
server
.
limiter
.
check_limit
(
self
):
self
.
respond
(
'230 Login successful.'
)
...
...
ZServer/HTTPResponse.py
View file @
6c4b3aaf
...
...
@@ -89,7 +89,7 @@ The HTTPResponse class takes care of server headers, response munging
and logging duties.
"""
import
time
,
re
,
string
,
sys
,
tempfile
import
time
,
re
,
sys
,
tempfile
from
cStringIO
import
StringIO
import
thread
from
ZPublisher.HTTPResponse
import
HTTPResponse
...
...
@@ -186,20 +186,20 @@ class ZServerHTTPResponse(HTTPResponse):
self
.
setHeader
(
'Connection'
,
'close'
)
for
key
,
val
in
headers
.
items
():
if
string
.
lower
(
key
)
==
key
:
if
key
.
lower
(
)
==
key
:
# only change non-literal header names
key
=
"%s%s"
%
(
string
.
upper
(
key
[:
1
]
),
key
[
1
:])
key
=
"%s%s"
%
(
key
[:
1
].
upper
(
),
key
[
1
:])
start
=
0
l
=
string
.
find
(
key
,
'-'
,
start
)
l
=
key
.
find
(
'-'
,
start
)
while
l
>=
start
:
key
=
"%s-%s%s"
%
(
key
[:
l
],
string
.
upper
(
key
[
l
+
1
:
l
+
2
]
),
key
[
l
+
2
:])
key
=
"%s-%s%s"
%
(
key
[:
l
],
key
[
l
+
1
:
l
+
2
].
upper
(
),
key
[
l
+
2
:])
start
=
l
+
1
l
=
string
.
find
(
key
,
'-'
,
start
)
l
=
key
.
find
(
'-'
,
start
)
append
(
"%s: %s"
%
(
key
,
val
))
if
self
.
cookies
:
headersl
=
headersl
+
self
.
_cookie_list
()
headersl
[
len
(
headersl
):]
=
[
self
.
accumulated_headers
,
body
]
return
string
.
join
(
headersl
,
'
\
r
\
n
'
)
return
"
\
r
\
n
"
.
join
(
headersl
)
_tempfile
=
None
_templock
=
None
...
...
@@ -226,7 +226,7 @@ class ZServerHTTPResponse(HTTPResponse):
l
=
self
.
headers
.
get
(
'content-length'
,
None
)
if
l
is
not
None
:
try
:
if
type
(
l
)
is
type
(
''
):
l
=
string
.
atoi
(
l
)
if
type
(
l
)
is
type
(
''
):
l
=
int
(
l
)
if
l
>
128000
:
self
.
_tempfile
=
tempfile
.
TemporaryFile
()
self
.
_templock
=
thread
.
allocate_lock
()
...
...
@@ -356,7 +356,7 @@ class ChannelPipe:
'exceptions.SystemExit'
:
r
=
response
.
headers
.
get
(
'bobo-exception-value'
,
'0'
)
try
:
r
=
string
.
atoi
(
r
)
try
:
r
=
int
(
r
)
except
:
r
=
r
and
1
or
0
self
.
_shutdown
=
r
,
if
response
.
headers
.
get
(
'connection'
,
''
)
==
'close'
or
\
...
...
@@ -371,8 +371,8 @@ def make_response(request, headers):
response
=
ZServerHTTPResponse
(
stdout
=
ChannelPipe
(
request
),
stderr
=
StringIO
())
response
.
_http_version
=
request
.
version
response
.
_http_connection
=
string
.
lower
(
http_server
.
get_header
(
http_server
.
CONNECTION
,
request
.
header
))
response
.
_http_connection
=
(
http_server
.
get_header
(
http_server
.
CONNECTION
,
request
.
header
))
.
lower
()
response
.
_server_version
=
request
.
channel
.
server
.
SERVER_IDENT
return
response
...
...
ZServer/HTTPServer.py
View file @
6c4b3aaf
...
...
@@ -105,7 +105,6 @@ changes from Medusa's http_server
"""
import
sys
import
re
import
string
import
os
import
types
import
thread
...
...
ZServer/WebDAVSrcHandler.py
View file @
6c4b3aaf
...
...
@@ -92,7 +92,7 @@
__version__
=
"1.0"
from
HTTPServer
import
zhttp_handler
import
string
,
os
import
os
class
WebDAVSrcHandler
(
zhttp_handler
):
"""
...
...
@@ -112,7 +112,7 @@ class WebDAVSrcHandler( zhttp_handler ):
path_info
=
os
.
path
.
join
(
path_info
,
'manage_FTPget'
)
path_info
=
os
.
path
.
normpath
(
path_info
)
if
os
.
sep
!=
'/'
:
path_info
=
string
.
replace
(
path_info
,
os
.
sep
,
'/'
)
path_info
=
path_info
.
replace
(
os
.
sep
,
'/'
)
env
[
'PATH_INFO'
]
=
path_info
...
...
@@ -121,7 +121,7 @@ class WebDAVSrcHandler( zhttp_handler ):
# We check the user-agent and remove a trailing dot for PATH_INFO
# and PATH_TRANSLATED
if
string
.
find
(
env
.
get
(
"HTTP_USER_AGENT"
,
""
),
"Microsoft Data Access Internet Publishing Provider"
)
>-
1
:
if
env
.
get
(
"HTTP_USER_AGENT"
,
""
).
find
(
"Microsoft Data Access Internet Publishing Provider"
)
>-
1
:
if
env
[
"PATH_INFO"
][
-
1
]
==
'.'
:
env
[
"PATH_INFO"
]
=
env
[
"PATH_INFO"
][:
-
1
]
...
...
ZServer/ZService.py
View file @
6c4b3aaf
...
...
@@ -183,7 +183,7 @@ TODO:
This script does for NT the same sort of thing zdaemon.py does for UNIX.
Requires Python win32api extensions.
"""
import
sys
,
os
,
string
,
time
,
imp
import
sys
,
os
,
time
,
imp
# Some fancy path footwork is required here because we
# may be run from python.exe or lib/win32/PythonService.exe
...
...
@@ -236,7 +236,7 @@ class ZServerService(win32serviceutil.ServiceFramework):
path
=
os
.
path
.
join
(
home
,
'ZServer'
,
'svcname.txt'
)
file
=
open
(
path
,
'r'
)
_svc_name_
=
string
.
strip
(
file
.
readline
()
)
_svc_name_
=
file
.
readline
().
strip
(
)
file
.
close
()
_svc_display_name_
=
"Zope (%s)"
%
_svc_name_
...
...
lib/python/ZServer/FTPRequest.py
View file @
6c4b3aaf
...
...
@@ -94,7 +94,7 @@ from ZPublisher.HTTPRequest import HTTPRequest
from
cStringIO
import
StringIO
import
os
from
base64
import
encodestring
import
string
,
re
import
re
class
FTPRequest
(
HTTPRequest
):
...
...
@@ -192,7 +192,7 @@ class FTPRequest(HTTPRequest):
path
=
apply
(
os
.
path
.
join
,
args
)
path
=
os
.
path
.
normpath
(
path
)
if
os
.
sep
!=
'/'
:
path
=
string
.
replace
(
path
,
os
.
sep
,
'/'
)
path
=
path
.
replace
(
os
.
sep
,
'/'
)
return
path
...
...
lib/python/ZServer/FTPServer.py
View file @
6c4b3aaf
...
...
@@ -147,7 +147,6 @@ from FTPRequest import FTPRequest
from
ZServer
import
CONNECTION_LIMIT
,
requestCloseOnExec
from
cStringIO
import
StringIO
import
string
import
os
from
mimetypes
import
guess_type
import
marshal
...
...
@@ -174,7 +173,7 @@ class zope_ftp_channel(ftp_channel):
path
=
apply
(
os
.
path
.
join
,
args
)
path
=
os
.
path
.
normpath
(
path
)
if
os
.
sep
!=
'/'
:
path
=
string
.
replace
(
path
,
os
.
sep
,
'/'
)
path
=
path
.
replace
(
os
.
sep
,
'/'
)
return
path
# Overriden async_chat methods
...
...
@@ -210,7 +209,7 @@ class zope_ftp_channel(ftp_channel):
# XXX clean this up, maybe with getopts
if
len
(
line
)
>
1
:
args
=
string
.
split
(
line
[
1
]
)
args
=
line
[
1
].
split
(
)
else
:
args
=
[]
path_args
=
[]
...
...
@@ -220,7 +219,7 @@ class zope_ftp_channel(ftp_channel):
for
i
in
range
(
len
(
args
)):
x
=
args
[
i
]
if
string
.
find
(
x
,
'*'
)
!=-
1
or
string
.
find
(
x
,
'?'
)
!=-
1
:
if
x
.
find
(
'*'
)
!=-
1
or
x
.
find
(
'?'
)
!=-
1
:
self
.
globbing
=
x
args
[
i
]
=
'.'
...
...
@@ -318,7 +317,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_mdtm
(
self
,
line
):
'show last modification time of file'
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
response
=
make_response
(
self
,
self
.
mdtm_completion
)
request
=
FTPRequest
(
line
[
1
],
'MDTM'
,
self
,
response
)
...
...
@@ -345,7 +344,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_size
(
self
,
line
):
'return size of file'
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
response
=
make_response
(
self
,
self
.
size_completion
)
request
=
FTPRequest
(
line
[
1
],
'SIZE'
,
self
,
response
)
...
...
@@ -364,7 +363,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_retr
(
self
,
line
):
if
len
(
line
)
<
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
return
response
=
make_response
(
self
,
self
.
retr_completion
,
line
[
1
])
self
.
_response_producers
=
response
.
stdout
.
_producers
...
...
@@ -398,7 +397,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_stor
(
self
,
line
,
mode
=
'wb'
):
'store a file'
if
len
(
line
)
<
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
return
elif
self
.
restart_position
:
restart_position
=
0
...
...
@@ -442,14 +441,14 @@ class zope_ftp_channel(ftp_channel):
def
cmd_rnfr
(
self
,
line
):
'rename from'
if
len
(
line
)
!=
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
else
:
self
.
fromfile
=
line
[
1
]
self
.
respond
(
'350 RNFR command successful.'
)
def
cmd_rnto
(
self
,
line
):
if
len
(
line
)
!=
2
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
return
pathf
,
idf
=
os
.
path
.
split
(
self
.
fromfile
)
patht
,
idt
=
os
.
path
.
split
(
line
[
1
])
...
...
@@ -466,7 +465,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_dele
(
self
,
line
):
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
path
,
id
=
os
.
path
.
split
(
line
[
1
])
response
=
make_response
(
self
,
self
.
dele_completion
)
...
...
@@ -475,7 +474,7 @@ class zope_ftp_channel(ftp_channel):
def
dele_completion
(
self
,
response
):
status
=
response
.
getStatus
()
if
status
==
200
and
string
.
find
(
response
.
body
,
'Not Deletable'
)
==-
1
:
if
status
==
200
and
response
.
body
.
find
(
'Not Deletable'
)
==-
1
:
self
.
respond
(
'250 DELE command successful.'
)
elif
status
==
401
:
self
.
respond
(
'530 Unauthorized.'
)
...
...
@@ -484,7 +483,7 @@ class zope_ftp_channel(ftp_channel):
def
cmd_mkd
(
self
,
line
):
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
path
,
id
=
os
.
path
.
split
(
line
[
1
])
response
=
make_response
(
self
,
self
.
mkd_completion
)
...
...
@@ -506,7 +505,7 @@ class zope_ftp_channel(ftp_channel):
# XXX should object be checked to see if it's folderish
# before we allow it to be RMD'd?
if
len
(
line
)
!=
2
:
self
.
command
.
not_understood
(
string
.
join
(
line
))
self
.
command
.
not_understood
(
' '
.
join
(
line
))
return
path
,
id
=
os
.
path
.
split
(
line
[
1
])
response
=
make_response
(
self
,
self
.
rmd_completion
)
...
...
@@ -517,7 +516,7 @@ class zope_ftp_channel(ftp_channel):
def
rmd_completion
(
self
,
response
):
status
=
response
.
getStatus
()
if
status
==
200
and
string
.
find
(
response
.
body
,
'Not Deletable'
)
==-
1
:
if
status
==
200
and
response
.
body
.
find
(
'Not Deletable'
)
==-
1
:
self
.
respond
(
'250 RMD command successful.'
)
elif
status
==
401
:
self
.
respond
(
'530 Unauthorized.'
)
...
...
@@ -530,7 +529,7 @@ class zope_ftp_channel(ftp_channel):
self
.
userid
=
line
[
1
]
self
.
respond
(
'331 Password required.'
)
else
:
self
.
command_not_understood
(
string
.
join
(
line
))
self
.
command_not_understood
(
' '
.
join
(
line
))
def
cmd_pass
(
self
,
line
):
'specify password'
...
...
@@ -539,7 +538,7 @@ class zope_ftp_channel(ftp_channel):
else
:
pw
=
line
[
1
]
self
.
password
=
pw
i
=
s
tring
.
find
(
self
.
userid
,
'@'
)
i
=
s
elf
.
userid
.
find
(
'@'
)
if
i
==-
1
:
if
self
.
server
.
limiter
.
check_limit
(
self
):
self
.
respond
(
'230 Login successful.'
)
...
...
lib/python/ZServer/HTTPResponse.py
View file @
6c4b3aaf
...
...
@@ -89,7 +89,7 @@ The HTTPResponse class takes care of server headers, response munging
and logging duties.
"""
import
time
,
re
,
string
,
sys
,
tempfile
import
time
,
re
,
sys
,
tempfile
from
cStringIO
import
StringIO
import
thread
from
ZPublisher.HTTPResponse
import
HTTPResponse
...
...
@@ -186,20 +186,20 @@ class ZServerHTTPResponse(HTTPResponse):
self
.
setHeader
(
'Connection'
,
'close'
)
for
key
,
val
in
headers
.
items
():
if
string
.
lower
(
key
)
==
key
:
if
key
.
lower
(
)
==
key
:
# only change non-literal header names
key
=
"%s%s"
%
(
string
.
upper
(
key
[:
1
]
),
key
[
1
:])
key
=
"%s%s"
%
(
key
[:
1
].
upper
(
),
key
[
1
:])
start
=
0
l
=
string
.
find
(
key
,
'-'
,
start
)
l
=
key
.
find
(
'-'
,
start
)
while
l
>=
start
:
key
=
"%s-%s%s"
%
(
key
[:
l
],
string
.
upper
(
key
[
l
+
1
:
l
+
2
]
),
key
[
l
+
2
:])
key
=
"%s-%s%s"
%
(
key
[:
l
],
key
[
l
+
1
:
l
+
2
].
upper
(
),
key
[
l
+
2
:])
start
=
l
+
1
l
=
string
.
find
(
key
,
'-'
,
start
)
l
=
key
.
find
(
'-'
,
start
)
append
(
"%s: %s"
%
(
key
,
val
))
if
self
.
cookies
:
headersl
=
headersl
+
self
.
_cookie_list
()
headersl
[
len
(
headersl
):]
=
[
self
.
accumulated_headers
,
body
]
return
string
.
join
(
headersl
,
'
\
r
\
n
'
)
return
"
\
r
\
n
"
.
join
(
headersl
)
_tempfile
=
None
_templock
=
None
...
...
@@ -226,7 +226,7 @@ class ZServerHTTPResponse(HTTPResponse):
l
=
self
.
headers
.
get
(
'content-length'
,
None
)
if
l
is
not
None
:
try
:
if
type
(
l
)
is
type
(
''
):
l
=
string
.
atoi
(
l
)
if
type
(
l
)
is
type
(
''
):
l
=
int
(
l
)
if
l
>
128000
:
self
.
_tempfile
=
tempfile
.
TemporaryFile
()
self
.
_templock
=
thread
.
allocate_lock
()
...
...
@@ -356,7 +356,7 @@ class ChannelPipe:
'exceptions.SystemExit'
:
r
=
response
.
headers
.
get
(
'bobo-exception-value'
,
'0'
)
try
:
r
=
string
.
atoi
(
r
)
try
:
r
=
int
(
r
)
except
:
r
=
r
and
1
or
0
self
.
_shutdown
=
r
,
if
response
.
headers
.
get
(
'connection'
,
''
)
==
'close'
or
\
...
...
@@ -371,8 +371,8 @@ def make_response(request, headers):
response
=
ZServerHTTPResponse
(
stdout
=
ChannelPipe
(
request
),
stderr
=
StringIO
())
response
.
_http_version
=
request
.
version
response
.
_http_connection
=
string
.
lower
(
http_server
.
get_header
(
http_server
.
CONNECTION
,
request
.
header
))
response
.
_http_connection
=
(
http_server
.
get_header
(
http_server
.
CONNECTION
,
request
.
header
))
.
lower
()
response
.
_server_version
=
request
.
channel
.
server
.
SERVER_IDENT
return
response
...
...
lib/python/ZServer/HTTPServer.py
View file @
6c4b3aaf
...
...
@@ -105,7 +105,6 @@ changes from Medusa's http_server
"""
import
sys
import
re
import
string
import
os
import
types
import
thread
...
...
lib/python/ZServer/WebDAVSrcHandler.py
View file @
6c4b3aaf
...
...
@@ -92,7 +92,7 @@
__version__
=
"1.0"
from
HTTPServer
import
zhttp_handler
import
string
,
os
import
os
class
WebDAVSrcHandler
(
zhttp_handler
):
"""
...
...
@@ -112,7 +112,7 @@ class WebDAVSrcHandler( zhttp_handler ):
path_info
=
os
.
path
.
join
(
path_info
,
'manage_FTPget'
)
path_info
=
os
.
path
.
normpath
(
path_info
)
if
os
.
sep
!=
'/'
:
path_info
=
string
.
replace
(
path_info
,
os
.
sep
,
'/'
)
path_info
=
path_info
.
replace
(
os
.
sep
,
'/'
)
env
[
'PATH_INFO'
]
=
path_info
...
...
@@ -121,7 +121,7 @@ class WebDAVSrcHandler( zhttp_handler ):
# We check the user-agent and remove a trailing dot for PATH_INFO
# and PATH_TRANSLATED
if
string
.
find
(
env
.
get
(
"HTTP_USER_AGENT"
,
""
),
"Microsoft Data Access Internet Publishing Provider"
)
>-
1
:
if
env
.
get
(
"HTTP_USER_AGENT"
,
""
).
find
(
"Microsoft Data Access Internet Publishing Provider"
)
>-
1
:
if
env
[
"PATH_INFO"
][
-
1
]
==
'.'
:
env
[
"PATH_INFO"
]
=
env
[
"PATH_INFO"
][:
-
1
]
...
...
lib/python/ZServer/ZService.py
View file @
6c4b3aaf
...
...
@@ -183,7 +183,7 @@ TODO:
This script does for NT the same sort of thing zdaemon.py does for UNIX.
Requires Python win32api extensions.
"""
import
sys
,
os
,
string
,
time
,
imp
import
sys
,
os
,
time
,
imp
# Some fancy path footwork is required here because we
# may be run from python.exe or lib/win32/PythonService.exe
...
...
@@ -236,7 +236,7 @@ class ZServerService(win32serviceutil.ServiceFramework):
path
=
os
.
path
.
join
(
home
,
'ZServer'
,
'svcname.txt'
)
file
=
open
(
path
,
'r'
)
_svc_name_
=
string
.
strip
(
file
.
readline
()
)
_svc_name_
=
file
.
readline
().
strip
(
)
file
.
close
()
_svc_display_name_
=
"Zope (%s)"
%
_svc_name_
...
...
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