/usr/lib/python2.6/site-packages/supervisor/medusa
NameSizeModeActions
auth_handler.py47390644editdlrm
auth_handler.pyc45130644editdlrm
auth_handler.pyo45130644editdlrm
chat_server.py45350644editdlrm
chat_server.pyc64270644editdlrm
chat_server.pyo64270644editdlrm
counter.py14400644editdlrm
counter.pyc20390644editdlrm
counter.pyo20390644editdlrm
default_handler.py63310644editdlrm
default_handler.pyc50340644editdlrm
default_handler.pyo50340644editdlrm
event_loop.py29810644editdlrm
event_loop.pyc35130644editdlrm
event_loop.pyo35130644editdlrm
filesys.py112060644editdlrm
filesys.pyc135980644editdlrm
filesys.pyo135980644editdlrm
ftp_server.py405520644editdlrm
ftp_server.pyc347270644editdlrm
ftp_server.pyo347270644editdlrm
http_date.py34150644editdlrm
http_date.pyc34680644editdlrm
http_date.pyo34680644editdlrm
http_server.py252170644editdlrm
http_server.pyc214680644editdlrm
http_server.pyo214680644editdlrm
logger.py80000644editdlrm
logger.pyc109900644editdlrm
logger.pyo109900644editdlrm
medusa_gif.py27720644editdlrm
medusa_gif.pyc11560644editdlrm
medusa_gif.pyo11560644editdlrm
monitor.py110540644editdlrm
monitor.pyc122850644editdlrm
monitor.pyo122850644editdlrm
monitor_client.py32730644editdlrm
monitor_client.pyc53900644editdlrm
monitor_client.pyo53900644editdlrm
monitor_client_win32.py13340644editdlrm
monitor_client_win32.pyc20940644editdlrm
monitor_client_win32.pyo20940644editdlrm
m_syslog.py73510644editdlrm
m_syslog.pyc40060644editdlrm
m_syslog.pyo40060644editdlrm
producers.py94390644editdlrm
producers.pyc116340644editdlrm
producers.pyo116340644editdlrm
put_handler.py33240644editdlrm
put_handler.pyc35110644editdlrm
put_handler.pyo35110644editdlrm
redirecting_handler.py14030644editdlrm
redirecting_handler.pyc21590644editdlrm
redirecting_handler.pyo21590644editdlrm
resolver.py155590644editdlrm
resolver.pyc124010644editdlrm
resolver.pyo124010644editdlrm
rpc_client.py96750644editdlrm
rpc_client.pyc103460644editdlrm
rpc_client.pyo103460644editdlrm
rpc_server.py99530644editdlrm
rpc_server.pyc95360644editdlrm
rpc_server.pyo95360644editdlrm
script_handler.py65540644editdlrm
script_handler.pyc66510644editdlrm
script_handler.pyo66510644editdlrm
setup.py4960644editdlrm
setup.pyc7290644editdlrm
setup.pyo7290644editdlrm
status_handler.py93520644editdlrm
status_handler.pyc96720644editdlrm
status_handler.pyo96720644editdlrm
unix_user_handler.py23120644editdlrm
unix_user_handler.pyc23610644editdlrm
unix_user_handler.pyo23610644editdlrm
virtual_handler.py17240644editdlrm
virtual_handler.pyc31640644editdlrm
virtual_handler.pyo31640644editdlrm
xmlrpc_handler.py29440644editdlrm
xmlrpc_handler.pyc37840644editdlrm
xmlrpc_handler.pyo37840644editdlrm
__init__.py1280644editdlrm
__init__.pyc2770644editdlrm
__init__.pyo2770644editdlrm
Edit: /usr/lib/python2.6/site-packages/supervisor/medusa/put_handler.py (3324B)
# -*- Mode: Python -*- # # Author: Sam Rushing # Copyright 1996-2000 by Sam Rushing # All Rights Reserved. # RCS_ID = '$Id: put_handler.py,v 1.1.1.1 2006/06/26 06:36:05 chrism Exp $' import re import string import default_handler unquote = default_handler.unquote get_header = default_handler.get_header last_request = None class put_handler: def __init__ (self, filesystem, uri_regex): self.filesystem = filesystem if type (uri_regex) == type(''): self.uri_regex = re.compile (uri_regex) else: self.uri_regex = uri_regex def match (self, request): uri = request.uri if request.command == 'PUT': m = self.uri_regex.match (uri) if m and m.end() == len(uri): return 1 return 0 def handle_request (self, request): path, params, query, fragment = request.split_uri() # strip off leading slashes while path and path[0] == '/': path = path[1:] if '%' in path: path = unquote (path) # make sure there's a content-length header cl = get_header (CONTENT_LENGTH, request.header) if not cl: request.error (411) return else: cl = string.atoi (cl) # don't let the try to overwrite a directory if self.filesystem.isdir (path): request.error (405) return is_update = self.filesystem.isfile (path) try: output_file = self.filesystem.open (path, 'wb') except: request.error (405) return request.collector = put_collector (output_file, cl, request, is_update) # no terminator while receiving PUT data request.channel.set_terminator (None) # don't respond yet, wait until we've received the data... class put_collector: def __init__ (self, file, length, request, is_update): self.file = file self.length = length self.request = request self.is_update = is_update self.bytes_in = 0 def collect_incoming_data (self, data): ld = len(data) bi = self.bytes_in if (bi + ld) >= self.length: # last bit of data chunk = self.length - bi self.file.write (data[:chunk]) self.file.close() if chunk != ld: print 'orphaned %d bytes: <%s>' % (ld - chunk, repr(data[chunk:])) # do some housekeeping r = self.request ch = r.channel ch.current_request = None # set the terminator back to the default ch.set_terminator ('\r\n\r\n') if self.is_update: r.reply_code = 204 # No content r.done() else: r.reply_now (201) # Created # avoid circular reference del self.request else: self.file.write (data) self.bytes_in = self.bytes_in + ld def found_terminator (self): # shouldn't be called pass CONTENT_LENGTH = re.compile ('Content-Length: ([0-9]+)', re.IGNORECASE)