Exemplo n.º 1
0
    void
    Session::handleRETR(const std::string& arg)
    {
      int64_t rest_offset = m_rest_offset;
      m_rest_offset = -1;

      Path path = getAbsolutePath(arg);
      if (!path.isFile())
      {
        sendReply(450, "Requested file action not taken.");
        return;
      }

      sendReply(150, "File status okay; about to open data connection.");

      TCPSocket* data = openDataConnection();

      if (!data->writeFile(path.c_str(), path.size() - 1, rest_offset))
        return;

      closeDataConnection(data);
      m_rest_offset = 0;
    }