Skip to content

Commit

Permalink
server: use single line pasv response (fix #142)
Browse files Browse the repository at this point in the history
  • Loading branch information
pohmelie committed Dec 13, 2024
1 parent 10f551e commit 85f769f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aioftp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,9 +1467,9 @@ async def handler(reader, writer):
except errors.NoAvailablePort:
connection.response("421", ["no free ports"])
return False
code, info = "227", ["listen socket created"]
code, info_template = "227", "listen socket created {address}"
else:
code, info = "227", ["listen socket already exists"]
code, info_template = "227", "listen socket already exists {address}"

for sock in connection.passive_server.sockets:
if sock.family == socket.AF_INET:
Expand All @@ -1485,7 +1485,7 @@ async def handler(reader, writer):
return False

nums = tuple(map(int, host.split("."))) + (port >> 8, port & 0xFF)
info.append(f"({','.join(map(str, nums))})")
info = [info_template.format(address=f"({','.join(map(str, nums))})")]
if connection.future.data_connection.done():
connection.data_connection.close()
del connection.data_connection
Expand Down

0 comments on commit 85f769f

Please sign in to comment.