diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 19:55:41 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-24 19:55:41 +0000 |
commit | 630d1b047c8c4ea54eef06fa24a89ad516457875 (patch) | |
tree | 531ebb2fc14ba3ce52b41bb01bb711776f9b1304 /net/ftp/ftp_network_transaction.h | |
parent | 7c79d2454c5a26b9c6723008aecb32fa871edd14 (diff) | |
download | chromium_src-630d1b047c8c4ea54eef06fa24a89ad516457875.zip chromium_src-630d1b047c8c4ea54eef06fa24a89ad516457875.tar.gz chromium_src-630d1b047c8c4ea54eef06fa24a89ad516457875.tar.bz2 |
Respect typecode in the FTP network transaction.
See RFC 1738.
BUG=31819
TEST=net_unittests
Review URL: http://codereview.chromium.org/1170003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42518 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp/ftp_network_transaction.h')
-rw-r--r-- | net/ftp/ftp_network_transaction.h | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/net/ftp/ftp_network_transaction.h b/net/ftp/ftp_network_transaction.h index 4fbd204..b74f39a 100644 --- a/net/ftp/ftp_network_transaction.h +++ b/net/ftp/ftp_network_transaction.h @@ -96,6 +96,22 @@ class FtpNetworkTransaction : public FtpTransaction { SYSTEM_TYPE_VMS, }; + // Data representation type, see RFC 959 section 3.1.1. Data Types. + // We only support the two most popular data types. + enum DataType { + DATA_TYPE_ASCII, + DATA_TYPE_IMAGE, + }; + + // In FTP we need to issue different commands depending on whether a resource + // is a file or directory. If we don't know that, we're going to autodetect + // it. + enum ResourceType { + RESOURCE_TYPE_UNKNOWN, + RESOURCE_TYPE_FILE, + RESOURCE_TYPE_DIRECTORY, + }; + // Resets the members of the transaction so it can be restarted. void ResetStateForRestart(); @@ -116,6 +132,9 @@ class FtpNetworkTransaction : public FtpTransaction { // will be used as a directory, |is_directory| should be true. std::string GetRequestPathForFtpCommand(bool is_directory) const; + // See if the request URL contains a typecode and make us respect it. + void DetectTypecode(); + // Runs the state transition loop. int DoLoop(int result); @@ -203,6 +222,12 @@ class FtpNetworkTransaction : public FtpTransaction { SystemType system_type_; + // Data type to be used for the TYPE command. + DataType data_type_; + + // Detected resource type (file or directory). + ResourceType resource_type_; + // We get username and password as wstrings in RestartWithAuth, so they are // also kept as wstrings here. std::wstring username_; @@ -212,8 +237,6 @@ class FtpNetworkTransaction : public FtpTransaction { // with any trailing slash removed. std::string current_remote_directory_; - bool retr_failed_; - int data_connection_port_; ClientSocketFactory* socket_factory_; |