Browse Source

ftp: use \r\n instead of \n in the protocol msgs

Sergey Alirzaev 4 years ago
parent
commit
bb17f51a1d
1 changed files with 6 additions and 6 deletions
  1. 6 6
      modules/ftp.c

+ 6 - 6
modules/ftp.c

@@ -292,7 +292,7 @@ static void lwftp_control_process(lwftp_session_t *s, struct tcp_pcb *tpcb, stru
         if (response==220) {
           lwftp_send_msg(s, PTRNLEN("USER "));
           lwftp_send_msg(s, s->settings->user, strlen(s->settings->user));
-          lwftp_send_msg(s, PTRNLEN("\n"));
+          lwftp_send_msg(s, PTRNLEN("\r\n"));
           s->control_state = LWFTP_USER_SENT;
         } else {
           s->error = "The server doesn't like us";
@@ -308,7 +308,7 @@ static void lwftp_control_process(lwftp_session_t *s, struct tcp_pcb *tpcb, stru
         if (response==331) {
           lwftp_send_msg(s, PTRNLEN("PASS "));
           lwftp_send_msg(s, s->settings->pass, strlen(s->settings->pass));
-          lwftp_send_msg(s, PTRNLEN("\n"));
+          lwftp_send_msg(s, PTRNLEN("\r\n"));
           s->control_state = LWFTP_PASS_SENT;
         } else if (response==230) {
           goto anonymous;
@@ -322,7 +322,7 @@ static void lwftp_control_process(lwftp_session_t *s, struct tcp_pcb *tpcb, stru
       if (response>0) {
         if (response==230) {
 anonymous:
-          lwftp_send_msg(s, PTRNLEN("TYPE I\n"));
+          lwftp_send_msg(s, PTRNLEN("TYPE I\r\n"));
           s->control_state = LWFTP_TYPE_SENT;
         } else {
           s->error = "Wrong password";
@@ -333,7 +333,7 @@ anonymous:
     case LWFTP_TYPE_SENT:
       if (response>0) {
         if (response==200) {
-          lwftp_send_msg(s, PTRNLEN("PASV\n"));
+          lwftp_send_msg(s, PTRNLEN("PASV\r\n"));
           s->control_state = LWFTP_PASV_SENT;
         } else {
           s->error = "The server doesn't support binary files";
@@ -357,7 +357,7 @@ anonymous:
               s->target_state = LWFTP_QUIT;
             }
           lwftp_send_msg(s, s->settings->remote_path, strlen(s->settings->remote_path));
-          lwftp_send_msg(s, PTRNLEN("\n"));
+          lwftp_send_msg(s, PTRNLEN("\r\n"));
           s->control_state = s->target_state;
         } else {
           s->error = "The server doesn't support PASV";
@@ -427,7 +427,7 @@ anonymous:
   // Handle second step in state machine
   switch ( s->control_state ) {
     case LWFTP_QUIT:
-      lwftp_send_msg(s, PTRNLEN("QUIT\n"));
+      lwftp_send_msg(s, PTRNLEN("QUIT\r\n"));
       s->control_state = LWFTP_QUIT_SENT;
       break;
     case LWFTP_CLOSING: