diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 16:29:53 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 16:29:53 +0000 |
commit | cca048bf67b8a044dc69c54f9fd691ef9143b865 (patch) | |
tree | 8f0ab3fade412b43b73fc98bcd1bf5a160c13ae9 /net/url_request | |
parent | 8b30662b7ca998a481c9dae66d8b6b05db47b38a (diff) | |
download | chromium_src-cca048bf67b8a044dc69c54f9fd691ef9143b865.zip chromium_src-cca048bf67b8a044dc69c54f9fd691ef9143b865.tar.gz chromium_src-cca048bf67b8a044dc69c54f9fd691ef9143b865.tar.bz2 |
Various cleanups FTP-related.
- use better name for FTP LIST parsing code in about:credits
- don't open a second data socket
- add a comment explaining why we close the data socket at one point
TEST=Covered by net_unittests.
BUG=none
Review URL: http://codereview.chromium.org/207014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r-- | net/url_request/url_request_new_ftp_job.cc | 17 | ||||
-rw-r--r-- | net/url_request/url_request_new_ftp_job.h | 2 |
2 files changed, 9 insertions, 10 deletions
diff --git a/net/url_request/url_request_new_ftp_job.cc b/net/url_request/url_request_new_ftp_job.cc index 40b23c4..7755503 100644 --- a/net/url_request/url_request_new_ftp_job.cc +++ b/net/url_request/url_request_new_ftp_job.cc @@ -300,7 +300,12 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf, break; } } - LogFtpServerType(state); + + // We can't recognize server type based on empty directory listings. Only log + // server type when we have enough data to recognize one. + if (state.parsed_one) + LogFtpServerType(state.lstyle); + directory_html_.append(file_entry); size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size), directory_html_.length()); @@ -311,14 +316,8 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf, return bytes_to_copy; } -void URLRequestNewFtpJob::LogFtpServerType( - const struct net::list_state& list_state) { - // We can't recognize server type based on empty directory listings. Don't log - // that as unknown, it's misleading. - if (!list_state.parsed_one) - return; - - switch (list_state.lstyle) { +void URLRequestNewFtpJob::LogFtpServerType(char server_type) { + switch (server_type) { case 'E': net::UpdateFtpServerTypeHistograms(net::SERVER_EPLF); break; diff --git a/net/url_request/url_request_new_ftp_job.h b/net/url_request/url_request_new_ftp_job.h index fade74d..e29687f 100644 --- a/net/url_request/url_request_new_ftp_job.h +++ b/net/url_request/url_request_new_ftp_job.h @@ -56,7 +56,7 @@ class URLRequestNewFtpJob : public URLRequestJob { int ProcessFtpDir(net::IOBuffer *buf, int buf_size, int bytes_read); - void LogFtpServerType(const struct net::list_state& list_state); + void LogFtpServerType(char server_type); net::FtpRequestInfo request_info_; scoped_ptr<net::FtpTransaction> transaction_; |