Commit 078345ed authored by Amos Latteier's avatar Amos Latteier

Fix for corrupted large FTP downloads. Thanks to Adam Karpierz.

parent dd44bff7
...@@ -347,6 +347,7 @@ class zope_ftp_channel(ftp_channel): ...@@ -347,6 +347,7 @@ class zope_ftp_channel(ftp_channel):
self.command_not_understood (string.join (line)) self.command_not_understood (string.join (line))
return return
response=make_response(self, self.retr_completion, line[1]) response=make_response(self, self.retr_completion, line[1])
self._response_producers = response.stdout._producers
request=FTPRequest(line[1],'RETR',self,response) request=FTPRequest(line[1],'RETR',self,response)
handle(self.module,request,response) handle(self.module,request,response)
...@@ -357,8 +358,9 @@ class zope_ftp_channel(ftp_channel): ...@@ -357,8 +358,9 @@ class zope_ftp_channel(ftp_channel):
if not response._wrote: if not response._wrote:
self.client_dc.push(response.body) self.client_dc.push(response.body)
else: else:
for producer in response.stdout._producers: for producer in self._response_producers:
self.client_dc.push_with_producer(producer) self.client_dc.push_with_producer(producer)
self._response_producers = None
self.client_dc.close_when_done() self.client_dc.close_when_done()
self.respond( self.respond(
"150 Opening %s mode data connection for file '%s'" % ( "150 Opening %s mode data connection for file '%s'" % (
......
...@@ -347,6 +347,7 @@ class zope_ftp_channel(ftp_channel): ...@@ -347,6 +347,7 @@ class zope_ftp_channel(ftp_channel):
self.command_not_understood (string.join (line)) self.command_not_understood (string.join (line))
return return
response=make_response(self, self.retr_completion, line[1]) response=make_response(self, self.retr_completion, line[1])
self._response_producers = response.stdout._producers
request=FTPRequest(line[1],'RETR',self,response) request=FTPRequest(line[1],'RETR',self,response)
handle(self.module,request,response) handle(self.module,request,response)
...@@ -357,8 +358,9 @@ class zope_ftp_channel(ftp_channel): ...@@ -357,8 +358,9 @@ class zope_ftp_channel(ftp_channel):
if not response._wrote: if not response._wrote:
self.client_dc.push(response.body) self.client_dc.push(response.body)
else: else:
for producer in response.stdout._producers: for producer in self._response_producers:
self.client_dc.push_with_producer(producer) self.client_dc.push_with_producer(producer)
self._response_producers = None
self.client_dc.close_when_done() self.client_dc.close_when_done()
self.respond( self.respond(
"150 Opening %s mode data connection for file '%s'" % ( "150 Opening %s mode data connection for file '%s'" % (
......
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