Commit 2fd740aa authored by Amos Latteier's avatar Amos Latteier

Synch Zope's medusa http and ftp modules with Sam's latest versions.

parent 5b536f7c
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# If you are interested in using this software in a commercial context, # If you are interested in using this software in a commercial context,
# or in purchasing support, please contact the author. # or in purchasing support, please contact the author.
RCS_ID = '$Id: ftp_server.py,v 1.7 1999/07/26 07:08:43 amos Exp $' RCS_ID = '$Id: ftp_server.py,v 1.8 1999/11/15 21:53:56 amos Exp $'
# An extensible, configurable, asynchronous FTP server. # An extensible, configurable, asynchronous FTP server.
# #
...@@ -174,6 +174,7 @@ class ftp_channel (asynchat.async_chat): ...@@ -174,6 +174,7 @@ class ftp_channel (asynchat.async_chat):
self.passive_acceptor.close() self.passive_acceptor.close()
if self.client_dc: if self.client_dc:
self.client_dc.close() self.client_dc.close()
self.server.closed_sessions.increment()
asynchat.async_chat.close (self) asynchat.async_chat.close (self)
# -------------------------------------------------- # --------------------------------------------------
...@@ -335,13 +336,6 @@ class ftp_channel (asynchat.async_chat): ...@@ -335,13 +336,6 @@ class ftp_channel (asynchat.async_chat):
self.current_mode = t self.current_mode = t
self.respond ('200 Type set to %s.' % self.type_map[t]) self.respond ('200 Type set to %s.' % self.type_map[t])
closed = 0
def close (self):
if not self.closed:
self.closed = 1
asynchat.async_chat.close (self)
self.server.closed_sessions.increment()
def cmd_quit (self, line): def cmd_quit (self, line):
'terminate session' 'terminate session'
self.respond ('221 Goodbye.') self.respond ('221 Goodbye.')
...@@ -857,7 +851,7 @@ class xmit_channel (asynchat.async_chat): ...@@ -857,7 +851,7 @@ class xmit_channel (asynchat.async_chat):
def readable (self): def readable (self):
return 0 return 0
def handle_connect(self): def log(self, *args):
pass pass
def writable (self): def writable (self):
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# interested in using this software in a commercial context, or in # interested in using this software in a commercial context, or in
# purchasing support, please contact the author. # purchasing support, please contact the author.
RCS_ID = '$Id: http_server.py,v 1.12 1999/09/22 22:06:42 petrilli Exp $' RCS_ID = '$Id: http_server.py,v 1.13 1999/11/15 21:53:56 amos Exp $'
# python modules # python modules
import os import os
...@@ -448,6 +448,18 @@ class http_channel (asynchat.async_chat): ...@@ -448,6 +448,18 @@ class http_channel (asynchat.async_chat):
# -------------------------------------------------- # --------------------------------------------------
# crack the request header # crack the request header
# -------------------------------------------------- # --------------------------------------------------
while lines and not lines[0]:
# as per the suggestion of http-1.1 section 4.1, (and
# Eric Parker <eparker@zyvex.com>), ignore a leading
# blank lines (buggy browsers tack it onto the end of
# POST requests)
lines = lines[1:]
if not lines:
self.close_when_done()
return
request = lines[0] request = lines[0]
try: try:
command, uri, version = crack_request (request) command, uri, version = crack_request (request)
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# If you are interested in using this software in a commercial context, # If you are interested in using this software in a commercial context,
# or in purchasing support, please contact the author. # or in purchasing support, please contact the author.
RCS_ID = '$Id: ftp_server.py,v 1.7 1999/07/26 07:08:43 amos Exp $' RCS_ID = '$Id: ftp_server.py,v 1.8 1999/11/15 21:53:56 amos Exp $'
# An extensible, configurable, asynchronous FTP server. # An extensible, configurable, asynchronous FTP server.
# #
...@@ -174,6 +174,7 @@ class ftp_channel (asynchat.async_chat): ...@@ -174,6 +174,7 @@ class ftp_channel (asynchat.async_chat):
self.passive_acceptor.close() self.passive_acceptor.close()
if self.client_dc: if self.client_dc:
self.client_dc.close() self.client_dc.close()
self.server.closed_sessions.increment()
asynchat.async_chat.close (self) asynchat.async_chat.close (self)
# -------------------------------------------------- # --------------------------------------------------
...@@ -335,13 +336,6 @@ class ftp_channel (asynchat.async_chat): ...@@ -335,13 +336,6 @@ class ftp_channel (asynchat.async_chat):
self.current_mode = t self.current_mode = t
self.respond ('200 Type set to %s.' % self.type_map[t]) self.respond ('200 Type set to %s.' % self.type_map[t])
closed = 0
def close (self):
if not self.closed:
self.closed = 1
asynchat.async_chat.close (self)
self.server.closed_sessions.increment()
def cmd_quit (self, line): def cmd_quit (self, line):
'terminate session' 'terminate session'
self.respond ('221 Goodbye.') self.respond ('221 Goodbye.')
...@@ -857,7 +851,7 @@ class xmit_channel (asynchat.async_chat): ...@@ -857,7 +851,7 @@ class xmit_channel (asynchat.async_chat):
def readable (self): def readable (self):
return 0 return 0
def handle_connect(self): def log(self, *args):
pass pass
def writable (self): def writable (self):
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# interested in using this software in a commercial context, or in # interested in using this software in a commercial context, or in
# purchasing support, please contact the author. # purchasing support, please contact the author.
RCS_ID = '$Id: http_server.py,v 1.12 1999/09/22 22:06:42 petrilli Exp $' RCS_ID = '$Id: http_server.py,v 1.13 1999/11/15 21:53:56 amos Exp $'
# python modules # python modules
import os import os
...@@ -448,6 +448,18 @@ class http_channel (asynchat.async_chat): ...@@ -448,6 +448,18 @@ class http_channel (asynchat.async_chat):
# -------------------------------------------------- # --------------------------------------------------
# crack the request header # crack the request header
# -------------------------------------------------- # --------------------------------------------------
while lines and not lines[0]:
# as per the suggestion of http-1.1 section 4.1, (and
# Eric Parker <eparker@zyvex.com>), ignore a leading
# blank lines (buggy browsers tack it onto the end of
# POST requests)
lines = lines[1:]
if not lines:
self.close_when_done()
return
request = lines[0] request = lines[0]
try: try:
command, uri, version = crack_request (request) command, uri, version = crack_request (request)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment