Chromium Code Reviews

Side by Side Diff: net/url_request/url_request_new_ftp_job.cc

Issue 207014: Various cleanups FTP-related. (Closed)
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_new_ftp_job.h" 5 #include "net/url_request/url_request_new_ftp_job.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_version_info.h" 8 #include "base/file_version_info.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 282 matching lines...)
293 } 293 }
294 break; 294 break;
295 case '?': // Junk entry. 295 case '?': // Junk entry.
296 case '"': // Comment entry. 296 case '"': // Comment entry.
297 break; 297 break;
298 default: 298 default:
299 NOTREACHED(); 299 NOTREACHED();
300 break; 300 break;
301 } 301 }
302 } 302 }
303 LogFtpServerType(state); 303
304 // We can't recognize server type based on empty directory listings. Only log
305 // server type when we have enough data to recognize one.
306 if (state.parsed_one)
307 LogFtpServerType(state.lstyle);
308
304 directory_html_.append(file_entry); 309 directory_html_.append(file_entry);
305 size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size), 310 size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size),
306 directory_html_.length()); 311 directory_html_.length());
307 if (bytes_to_copy) { 312 if (bytes_to_copy) {
308 memcpy(buf->data(), directory_html_.c_str(), bytes_to_copy); 313 memcpy(buf->data(), directory_html_.c_str(), bytes_to_copy);
309 directory_html_.erase(0, bytes_to_copy); 314 directory_html_.erase(0, bytes_to_copy);
310 } 315 }
311 return bytes_to_copy; 316 return bytes_to_copy;
312 } 317 }
313 318
314 void URLRequestNewFtpJob::LogFtpServerType( 319 void URLRequestNewFtpJob::LogFtpServerType(char server_type) {
wtc 2009/09/18 17:24:39 Nit: may want to name the parameter "list_style" a
315 const struct net::list_state& list_state) { 320 switch (server_type) {
316 // We can't recognize server type based on empty directory listings. Don't log
317 // that as unknown, it's misleading.
318 if (!list_state.parsed_one)
319 return;
320
321 switch (list_state.lstyle) {
322 case 'E': 321 case 'E':
323 net::UpdateFtpServerTypeHistograms(net::SERVER_EPLF); 322 net::UpdateFtpServerTypeHistograms(net::SERVER_EPLF);
324 break; 323 break;
325 case 'V': 324 case 'V':
326 net::UpdateFtpServerTypeHistograms(net::SERVER_VMS); 325 net::UpdateFtpServerTypeHistograms(net::SERVER_VMS);
327 break; 326 break;
328 case 'C': 327 case 'C':
329 net::UpdateFtpServerTypeHistograms(net::SERVER_CMS); 328 net::UpdateFtpServerTypeHistograms(net::SERVER_CMS);
330 break; 329 break;
331 case 'W': 330 case 'W':
(...skipping 101 matching lines...)
433 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( 432 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
434 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); 433 this, &URLRequestNewFtpJob::OnStartCompleted, rv));
435 } 434 }
436 435
437 void URLRequestNewFtpJob::DestroyTransaction() { 436 void URLRequestNewFtpJob::DestroyTransaction() {
438 DCHECK(transaction_.get()); 437 DCHECK(transaction_.get());
439 438
440 transaction_.reset(); 439 transaction_.reset();
441 response_info_ = NULL; 440 response_info_ = NULL;
442 } 441 }
OLDNEW
« chrome/browser/resources/about_credits.html ('K') | « net/url_request/url_request_new_ftp_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine