-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] active mode support #38
Conversation
host = str.join(".", map(str, nums[:4])) | ||
port = (nums[4] << 8) | nums[5] | ||
|
||
if not connection.future.passive_server.done(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't get this check. Passive server already closed and removed from connection above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need connection.futures.passive_server
to pass ConnectionCondition(passive_server_started)
checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see… I think we need to extend ConnectionCondition
logic. Cause making fake passive server is not good, I think.
I believed that i will have time to work on this but seems like not, closing as it's really outdated. |
Don't worry, since I definitely will rewrite aioftp as sioftp (sans-io ftp) with slightly different architecture there will be place for active mode 😉 |
I really need active mode support. |
@ramstein74 Active mode is rarely used. What is the reason you can't use |
I work in a chemical plant and we use automation plc's.
These kind of hardware have a network cable and allows me to connect via
ftp to download the process data every day.
I am forced to set passive as false otherwise it does not connect...
ftplib has passive(False)
regards
2018-02-07 12:36 GMT+00:00 Nikita Melentev <[email protected]>:
… @ramstein74 <https://github.com/ramstein74>
This pull is outdated.
Active mode is rarely used. What is the reason you can't use EPSV/PASV
instead?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABJ56mhHAWMGONdFkq86GUJks4ibgcDiks5tSZjDgaJpZM4Hd9Ik>
.
|
Do you know the reason why |
for this test code:
import asyncio
import aioftp
async def get_file(host, port, login, password):
async with aioftp.ClientSession(host, port, login, password) as client:
for path, info in (await client.list(recursive=True)):
if info["type"] == "file" and path.suffix == ".csv":
await client.download(path)
loop = asyncio.new_event_loop()
tasks = (
get_file("the_ip", 21, "user", "pw"),
)
loop.run_until_complete(asyncio.wait(tasks))
loop.close()
i get this error
Task exception was never retrieved
future: <Task finished coro=<get_file() done, defined at
<ipython-input-1-19f40198515f>:5> exception=StatusCodeError("Waiting
for ('227',) but got 502 [' PASV command not implemented.']",)>
Traceback (most recent call last):
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 941, in get_passive_connection
code, info = await self.command("EPSV", "229")
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 248, in command
self.check_codes(expected_codes, code, info)
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 214, in check_codes
raise errors.StatusCodeError(expected_codes, received_code, info)
aioftp.errors.StatusCodeError: Waiting for ('229',) but got 500 ["
'EPSV': command not understood."]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<ipython-input-1-19f40198515f>", line 7, in get_file
for path, info in (await client.list(recursive=True)):
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\common.py",
line 120, in _to_list
async for item in self:
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 618, in __aiter__
cls.stream = await cls._new_stream(path)
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 615, in _new_stream
return await self.get_stream(command, "1xx")
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 978, in get_stream
reader, writer = await self.get_passive_connection(conn_type)
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 948, in get_passive_connection
code, info = await self.command("PASV", "227")
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 248, in command
self.check_codes(expected_codes, code, info)
File "C:\Users\Ramos\AppData\Local\conda\conda\envs\app1\lib\site-packages\aioftp\client.py",
line 214, in check_codes
raise errors.StatusCodeError(expected_codes, received_code, info)
aioftp.errors.StatusCodeError: Waiting for ('227',) but got 502 ['
PASV command not implemented.']
2018-02-07 13:47 GMT+00:00 Nikita Melentev <[email protected]>:
… Do you know the reason why PASV do not work? How it looks from client
side?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABJ56ped5jlAW2Zuv7QIYrBt1W0bNU4Eks5tSaldgaJpZM4Hd9Ik>
.
|
Ok, so we can see both |
thank u :(
2018-02-07 14:01 GMT+00:00 Nikita Melentev <[email protected]>:
… Ok, so we can see both EPSV and PASV are not implemented. Very uncommon
case, honestly. There is nothing to do with aioftp to make it work right
now. I suggest you to use ftplib, since implement PORT for aioftp is long
road.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#38 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABJ56gMnggwOM0_Bz6Qk7Db02C9MSuoiks5tSay7gaJpZM4Hd9Ik>
.
|
as per #16
this works, but still is far away from being suitable for merge...
TODO:
passive_server
in case of active mode (await asyncio.sleep(0)
is stupid)ConnectionRefusedError
for data connection in active mode