8000 cc3200/ftp: Add quotes to PWD response and allow FEAT prior to login. · mbtronics/micropython@342dc61 · GitHub
[go: up one dir, main page]

Skip to content

Commit 342dc61

Browse files
VinDuvdpgeorge
authored andcommitted
cc3200/ftp: Add quotes to PWD response and allow FEAT prior to login.
This commit improves some FTP implementation details for better compatibility with FTP clients: * The PWD command now puts quotes around the directory name before returning it. This fixes BBEdit’s FTP client, which performs a PWD after each CWD and gets confused if the returned directory path is not surrounded by quotes. * The FEAT command is now allowed before logging in. This fixes the lftp client, which send FEAT first and gets confused (tries to use TLS) if the server responds with 332.
1 parent 290dc1d commit 342dc61

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ports/cc3200/ftp/ftp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static void ftp_process_cmd (void) {
684684
if (E_FTP_RESULT_OK == (result = ftp_recv_non_blocking(ftp_data.c_sd, ftp_cmd_buffer, FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX, &len))) {
685685
// bufptr is moved as commands are being popped
686686
ftp_cmd_index_t cmd = ftp_pop_command(&bufptr);
687-
if (!ftp_data.loggin.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT)) {
687+
if (!ftp_data.loggin.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT && cmd != E_FTP_CMD_FEAT)) {
688688
ftp_send_reply(332, NULL);
689689
return;
690690
}
@@ -718,7 +718,8 @@ static void ftp_process_cmd (void) {
718718
break;
719719
case E_FTP_CMD_PWD:
720720
case E_FTP_CMD_XPWD:
721-
ftp_send_reply(257, ftp_path);
721+
snprintf((char *)ftp_data.dBuffer, FTP_BUFFER_SIZE, "\"%s\"", ftp_path);
722+
ftp_send_reply(257, (char *)ftp_data.dBuffer);
722723
break;
723724
case E_FTP_CMD_SIZE:
724725
{

0 commit comments

Comments
 (0)
0