diff --git a/CFtpHandler.cpp b/CFtpHandler.cpp index d6556ca..96a8765 100644 --- a/CFtpHandler.cpp +++ b/CFtpHandler.cpp @@ -125,11 +125,14 @@ int CFtpHandler::getDataSocket() { bool CFtpHandler::handleRequest(char *buff) { stringstream recvStream; recvStream<>command; - + + /* allow client input lowercast commond */ + std::transform(command.begin(), command.end(), command.begin(),::toupper); + bool isClose = false; string msg; //username @@ -259,7 +262,7 @@ bool CFtpHandler::handleRequest(char *buff) { struct tm tm = *gmtime(&s.st_mtime); //list with -l param if (param == "-l") { - stream<d_name<d_name<d_name< #include #include #include #include #include +#include #include #include #include -#include #include #include /************************************** * FTP Commond List *************************************/ - #define COMMAND_PORT "PORT" #define COMMAND_PASSIVE "PASV" #define COMMAND_LIST "LIST" @@ -50,7 +50,6 @@ /************************************** * FTP Response Codes *************************************/ - #define TS_FTP_STATUS_READY "220 TS FTP Server ready...\r\n" #define TS_FTP_STATUS_OPEN_DATA_CHANNEL "150 Opening data channel for directory list." @@ -72,6 +71,7 @@ #define TS_FTP_STATUS_DELETE "250 DELE command successful." #define TS_FTP_STATUS_CUR_DIR(x) "257 \""+x+"\" is current directory." #define TS_FTP_STATUS_PWD_REQ(x) "331 Password required for "+x +#define TS_FTP_STATUS_CMD_ERROR "500 Syntax error, command unrecognized." #define TS_FTP_STATUS_PWD_ERROR "530 Not logged in,password error." #define TS_FTP_STATUS_FILE_NOT_FOUND "550 File not found" #define TS_FTP_STATUS_CWD_FAILED(x) "550 CWD command failed. \"" +x+ "\": directory not found."