aio-libs / aioftp

ftp client/server for asyncio (http://aioftp.readthedocs.org)
Apache License 2.0
185 stars 54 forks source link

cannot download file from filezilla server #168

Closed zzl221000 closed 11 months ago

zzl221000 commented 11 months ago

MLSD returns a two-line response, but aioftp.Client parses only one line; the next command parses the rest of the response.

filezilla server log

<Date/Time> Info [Type] Message
<08-11-2023 21:25:43> FTP Session 7 127.0.0.1 yzmdtester [Command] MLSD /realtime_update
<08-11-2023 21:25:43> FTP Session 7 127.0.0.1 yzmdtester [Response] 150 Starting data transfer.
<08-11-2023 21:25:43> FTP Session 7 127.0.0.1 yzmdtester [Response] 226 Operation successful
<08-11-2023 21:25:43> FTP Session 7 127.0.0.1 yzmdtester [Command] TYPE I
<08-11-2023 21:25:43> FTP Session 7 127.0.0.1 yzmdtester [Response] 200 Type set to I

aioftp log

DEBUG:aioftp.client:TYPE I
DEBUG:aioftp.client:200 Type set to I
DEBUG:aioftp.client:PASV
DEBUG:aioftp.client:227 Entering Passive Mode (127,0,0,1,37,11)
DEBUG:aioftp.client:MLSD /realtime_update
DEBUG:aioftp.client:150 Starting data transfer.
DEBUG:aioftp.client:TYPE I
DEBUG:aioftp.client:226 Operation successful
DEBUG:aioftp.client:QUIT
DEBUG:aioftp.client:200 Type set to I
pohmelie commented 11 months ago

Please add code to reproduce such behaviour

zzl221000 commented 11 months ago

@pohmelie

async def test():
    async with aioftp.Client.context(host='127.0.0.1', port=21, user='admin',
                                     password='admin', passive_commands=("pasv",)) as client:
        async def load_all_file():

            async for path, file in client.list('/realtime_update'):
                yield path, file['modify']
        async for path, modify in load_all_file():
            await client.download(path)
zzl221000 commented 11 months ago

lazy list

async for path, info in client.list(): ... # no interaction with client should be here(!)