ftp: split ftp_state_use_port into sub functions#20685
ftp: split ftp_state_use_port into sub functions#20685
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the large ftp_state_use_port() function into seven smaller, focused sub-functions to improve code readability and reduce complexity. The refactoring splits the original ~220-line function into logical steps: parsing the FTPPORT string, determining the default host, resolving the host, opening a socket, binding the socket, listening, and sending the FTP command. The main function now orchestrates these steps with clear error handling between each phase.
Changes:
- Extracted parsing logic into
ftp_port_parse_string()to handle the CURLOPT_FTPPORT string format - Extracted socket setup and FTP protocol commands into dedicated helper functions (
ftp_port_open_socket,ftp_port_bind_socket,ftp_port_listen,ftp_port_send_command) - Extracted fallback logic into
ftp_port_default_host()andftp_port_resolve_host()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
augment review |
🤖 Augment PR SummarySummary: Refactors active-mode FTP setup by splitting Changes:
Technical Notes: Error handling/cleanup remains centralized in 🤖 Was this summary useful? React with 👍 or 👎 |
|
augment review |
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
See details in the comment below. Analyzed PR: #20685 at commit |
For readability and reduced complexity. Closes #20685
9dd710c to
21df07a
Compare
For readability and reduced complexity.