Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size), | 277 size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size), |
| 278 directory_html_.length()); | 278 directory_html_.length()); |
| 279 if (bytes_to_copy) { | 279 if (bytes_to_copy) { |
| 280 memcpy(buf->data(), directory_html_.c_str(), bytes_to_copy); | 280 memcpy(buf->data(), directory_html_.c_str(), bytes_to_copy); |
| 281 directory_html_.erase(0, bytes_to_copy); | 281 directory_html_.erase(0, bytes_to_copy); |
| 282 } | 282 } |
| 283 return bytes_to_copy; | 283 return bytes_to_copy; |
| 284 } | 284 } |
| 285 | 285 |
| 286 void URLRequestNewFtpJob::LogFtpServerType(const net::ListState& list_state) { | 286 void URLRequestNewFtpJob::LogFtpServerType(const net::ListState& list_state) { |
| 287 // We can't recognize server type based on empty directory listings. Don't log | |
| 288 // that as unknown, it's misleading. | |
| 289 if (!list_state.parsed_one) | |
|
eroman
2009/09/08 22:20:14
Style comment:
I recommend doing this at the call
wtc
2009/09/09 01:14:50
I agree. I also suggest that we change
LogFtpServ
| |
| 290 return; | |
| 291 | |
| 287 switch (list_state.lstyle) { | 292 switch (list_state.lstyle) { |
| 288 case 'E': | 293 case 'E': |
| 289 net::UpdateFtpServerTypeHistograms(net::SERVER_EPLF); | 294 net::UpdateFtpServerTypeHistograms(net::SERVER_EPLF); |
| 290 break; | 295 break; |
| 291 case 'V': | 296 case 'V': |
| 292 net::UpdateFtpServerTypeHistograms(net::SERVER_VMS); | 297 net::UpdateFtpServerTypeHistograms(net::SERVER_VMS); |
| 293 break; | 298 break; |
| 294 case 'C': | 299 case 'C': |
| 295 net::UpdateFtpServerTypeHistograms(net::SERVER_CMS); | 300 net::UpdateFtpServerTypeHistograms(net::SERVER_CMS); |
| 296 break; | 301 break; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 404 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 400 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); | 405 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); |
| 401 } | 406 } |
| 402 | 407 |
| 403 void URLRequestNewFtpJob::DestroyTransaction() { | 408 void URLRequestNewFtpJob::DestroyTransaction() { |
| 404 DCHECK(transaction_.get()); | 409 DCHECK(transaction_.get()); |
| 405 | 410 |
| 406 transaction_.reset(); | 411 transaction_.reset(); |
| 407 response_info_ = NULL; | 412 response_info_ = NULL; |
| 408 } | 413 } |
| OLD | NEW |