[Zope-dev] Re: Passive ftp for zope.
Chris Withers
chrisw@nipltd.com
Tue, 24 Sep 2002 10:25:13 +0100
Hi Mark,
Sorry for the long delay.
To be honest, I'm probably not the best person to speak to. I think the work
you've done is excellent, and I'm CC'ing this message to the zope-dev@zope.org
list. That list is for the discussion of the development of Zope and the people
there should be able to help you both with ironing out the remaining problems
and getting your changes integrated into the core Zope distribution if appropriate.
cheers,
Chris
Mark Simpson wrote:
> I've come up with something that works.
>
> The problem is, the error checking doesn't, and I'd like to change it into a
> configuration variable rather than hard code it. I'm a Unix/C/Java
> programmer by trade, and though I'm zope friendly I'm not too knowledgable
> about python yet (though I know about network programming in other languagew,
> hence the patch).
>
> Here's the diff. It's for ZServer/medusa/ftp_server.py
>
> When I said error checking doesn't work, I mean, if I tried to raise an error
> on the ftp/control connection, it didn't send the message back to the client.
> I was using self.respond. Really it should raise an error if there's no
> passive connections left. Though this will work. I think the problem may
> have been inheritance, i.e. what object self.respond was. ANyhow, this
> works fine, it's just will need alteration to be upto the standard to put in
> the zope core. The change is in the __init__ method in class
> "passive_acceptor"
>
> I also, don't know how to get it integrated into the zope core distribution
> so everyone can benefit from it.
>
> 818,834c818,823
> < # self.bind ((
> < # self.control_channel.getsockname()[0],
> < # 0
> < # ))
> < # 52901 because it calculates between 52700 and 52901 (not
> < # including 52901
> < for zport in range (52700,52901):
> < try:
> < self.bind ((
> < self.control_channel.getsockname()[0],
> < zport
> < ))
> < self.addr = self.getsockname()
> < self.listen (1)
> < except socket.error, why:
> < continue
> < break
> ---
>
>> self.bind ((
>> self.control_channel.getsockname()[0],
>> 0
>> ))
>> self.addr = self.getsockname()
>> self.listen (1)