diff options
Diffstat (limited to 'net/ftp')
-rw-r--r-- | net/ftp/ftp_network_transaction.cc | 3 | ||||
-rw-r--r-- | net/ftp/ftp_network_transaction_unittest.cc | 30 |
2 files changed, 33 insertions, 0 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index bfb526e..1dfc99b 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -282,6 +282,9 @@ int FtpNetworkTransaction::ProcessCtrlResponse() { case COMMAND_RETR: rv = ProcessResponseRETR(response); break; + case COMMAND_LIST: + rv = ProcessResponseLIST(response); + break; default: // Multiple responses for other commands are invalid. return Stop(ERR_INVALID_RESPONSE); diff --git a/net/ftp/ftp_network_transaction_unittest.cc b/net/ftp/ftp_network_transaction_unittest.cc index 95c4e46..9745763 100644 --- a/net/ftp/ftp_network_transaction_unittest.cc +++ b/net/ftp/ftp_network_transaction_unittest.cc @@ -401,6 +401,31 @@ class FtpSocketDataProviderFileDownloadTransferStarting DISALLOW_COPY_AND_ASSIGN(FtpSocketDataProviderFileDownloadTransferStarting); }; +class FtpSocketDataProviderDirectoryListingTransferStarting + : public FtpSocketDataProviderDirectoryListing { + public: + FtpSocketDataProviderDirectoryListingTransferStarting() { + } + + virtual MockWriteResult OnWrite(const std::string& data) { + if (InjectFault()) + return MockWriteResult(true, data.length()); + switch (state()) { + case PRE_LIST: + return Verify("LIST\r\n", data, PRE_QUIT, + "125-Data connection already open.\r\n" + "125 Transfer starting.\r\n" + "226 Transfer complete.\r\n"); + default: + return FtpSocketDataProviderDirectoryListing::OnWrite(data); + } + } + + private: + DISALLOW_COPY_AND_ASSIGN( + FtpSocketDataProviderDirectoryListingTransferStarting); +}; + class FtpSocketDataProviderFileDownloadInvalidResponse : public FtpSocketDataProviderFileDownload { public: @@ -641,6 +666,11 @@ TEST_F(FtpNetworkTransactionTest, DirectoryTransactionVMSRootDirectory) { ExecuteTransaction(&ctrl_socket, "ftp://host", OK); } +TEST_F(FtpNetworkTransactionTest, DirectoryTransactionTransferStarting) { + FtpSocketDataProviderDirectoryListingTransferStarting ctrl_socket; + ExecuteTransaction(&ctrl_socket, "ftp://host", OK); +} + TEST_F(FtpNetworkTransactionTest, DownloadTransaction) { FtpSocketDataProviderFileDownload ctrl_socket; ExecuteTransaction(&ctrl_socket, "ftp://host/file", OK); |