Handle keep-alive during transfers

Closes #123
This commit is contained in:
Michael Theall 2020-11-18 13:19:40 +01:00
parent c7bbb93fd5
commit bc3c096b39

View File

@ -1478,8 +1478,9 @@ void FtpSession::readCommand (int const events_)
else if (m_state != State::COMMAND)
{
// only some commands are available during data transfer
if (::strcasecmp (command, "ABOR") != 0 && ::strcasecmp (command, "STAT") != 0 &&
::strcasecmp (command, "QUIT") != 0)
if (::strcasecmp (command, "ABOR") != 0 && ::strcasecmp (command, "NOOP") != 0 &&
::strcasecmp (command, "PWD") != 0 && ::strcasecmp (command, "QUIT") != 0 &&
::strcasecmp (command, "STAT") != 0 && ::strcasecmp (command, "XPWD") != 0)
{
sendResponse ("503 Invalid command during transfer\r\n");
setState (State::COMMAND, true, true);
@ -2339,6 +2340,9 @@ void FtpSession::PORT (char const *args_)
void FtpSession::PWD (char const *args_)
{
// handle keep-alive
if (m_state == State::COMMAND)
{
setState (State::COMMAND, false, false);
if (!authorized ())
@ -2346,6 +2350,7 @@ void FtpSession::PWD (char const *args_)
sendResponse ("530 Not logged in\r\n");
return;
}
}
auto const path = encodePath (m_cwd);