summaryrefslogtreecommitdiffstats
path: root/net/url_request
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 22:40:55 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-28 22:40:55 +0000
commit139dd55c937dbad1224571ddca0d13d9e723af0f (patch)
tree5b3057870d7cddfca0f22a24bb8a706056ee3787 /net/url_request
parentc8451d1a68c5897298b1327f100dae13431bc4fa (diff)
downloadchromium_src-139dd55c937dbad1224571ddca0d13d9e723af0f.zip
chromium_src-139dd55c937dbad1224571ddca0d13d9e723af0f.tar.gz
chromium_src-139dd55c937dbad1224571ddca0d13d9e723af0f.tar.bz2
Add histograms for FTP server types encountered by users.
This should help with decision which FTP server types we can safely stop supporting. TEST=none BUG=none Review URL: http://codereview.chromium.org/176020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request')
-rw-r--r--net/url_request/url_request_new_ftp_job.cc37
-rw-r--r--net/url_request/url_request_new_ftp_job.h6
2 files changed, 42 insertions, 1 deletions
diff --git a/net/url_request/url_request_new_ftp_job.cc b/net/url_request/url_request_new_ftp_job.cc
index 16865a1..251602c 100644
--- a/net/url_request/url_request_new_ftp_job.cc
+++ b/net/url_request/url_request_new_ftp_job.cc
@@ -14,6 +14,7 @@
#include "net/base/net_util.h"
#include "net/ftp/ftp_directory_parser.h"
#include "net/ftp/ftp_response_info.h"
+#include "net/ftp/ftp_server_type_histograms.h"
#include "net/ftp/ftp_transaction_factory.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
@@ -243,8 +244,9 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf,
int64 file_size;
std::istringstream iss(std::string(buf->data(), bytes_read));
+ struct net::ListState state;
+ memset(&state, 0, sizeof(state));
while (getline(iss, line)) {
- struct net::ListState state;
struct net::ListResult result;
std::replace(line.begin(), line.end(), '\r', '\0');
net::LineType line_type = ParseFTPLine(line.c_str(), &state, &result);
@@ -270,6 +272,7 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf,
break;
}
}
+ LogFtpServerType(state);
directory_html_.append(file_entry);
size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size),
directory_html_.length());
@@ -280,6 +283,38 @@ int URLRequestNewFtpJob::ProcessFtpDir(net::IOBuffer *buf,
return bytes_to_copy;
}
+void URLRequestNewFtpJob::LogFtpServerType(const net::ListState& list_state) {
+ switch (list_state.lstyle) {
+ case 'E':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_EPLF);
+ break;
+ case 'V':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_VMS);
+ break;
+ case 'C':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_CMS);
+ break;
+ case 'W':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_DOS);
+ break;
+ case 'O':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_OS2);
+ break;
+ case 'U':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_LSL);
+ break;
+ case 'w':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_W16);
+ break;
+ case 'D':
+ net::UpdateFtpServerTypeHistograms(net::SERVER_DLS);
+ break;
+ default:
+ net::UpdateFtpServerTypeHistograms(net::SERVER_UNKNOWN);
+ break;
+ }
+}
+
void URLRequestNewFtpJob::OnStartCompleted(int result) {
// If the request was destroyed, then there is no more work to do.
if (!request_ || !request_->delegate())
diff --git a/net/url_request/url_request_new_ftp_job.h b/net/url_request/url_request_new_ftp_job.h
index d7a9b25..2a66098 100644
--- a/net/url_request/url_request_new_ftp_job.h
+++ b/net/url_request/url_request_new_ftp_job.h
@@ -15,6 +15,10 @@
class URLRequestContext;
+namespace net {
+struct ListState;
+}
+
// A URLRequestJob subclass that is built on top of FtpTransaction. It
// provides an implementation for FTP.
class URLRequestNewFtpJob : public URLRequestJob {
@@ -52,6 +56,8 @@ class URLRequestNewFtpJob : public URLRequestJob {
int ProcessFtpDir(net::IOBuffer *buf, int buf_size, int bytes_read);
+ void LogFtpServerType(const net::ListState& list_state);
+
net::FtpRequestInfo request_info_;
scoped_ptr<net::FtpTransaction> transaction_;
const net::FtpResponseInfo* response_info_;