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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 base::Time::FromLocalExploded(result.fe_time))); | 258 base::Time::FromLocalExploded(result.fe_time))); |
259 break; | 259 break; |
260 case net::FTP_TYPE_FILE: | 260 case net::FTP_TYPE_FILE: |
261 if (StringToInt64(result.fe_size, &file_size)) | 261 if (StringToInt64(result.fe_size, &file_size)) |
262 file_entry.append(net::GetDirectoryListingEntry( | 262 file_entry.append(net::GetDirectoryListingEntry( |
263 RawByteSequenceToFilename(result.fe_fname, encoding_), | 263 RawByteSequenceToFilename(result.fe_fname, encoding_), |
264 result.fe_fname, false, file_size, | 264 result.fe_fname, false, file_size, |
265 base::Time::FromLocalExploded(result.fe_time))); | 265 base::Time::FromLocalExploded(result.fe_time))); |
266 break; | 266 break; |
267 case net::FTP_TYPE_SYMLINK: | 267 case net::FTP_TYPE_SYMLINK: |
268 { | |
wtc
2009/09/09 01:25:46
Nit: the braces should be placed like this:
cas
| |
269 std::string filename(result.fe_fname, result.fe_fnlen); | |
270 | |
271 // Parsers for styles 'U' and 'W' handle sequence " -> " themselves. | |
wtc
2009/09/09 01:25:46
What does "handle sequence" mean?
| |
272 if (state.lstyle != 'U' && state.lstyle != 'W') { | |
273 std::string::size_type offset = filename.find(" -> "); | |
274 if (offset != std::string::npos) | |
275 filename = filename.substr(0, offset); | |
276 } | |
277 | |
278 if (StringToInt64(result.fe_size, &file_size)) { | |
wtc
2009/09/09 01:25:46
Do you know if the result.fe_size field makes sens
| |
279 file_entry.append(net::GetDirectoryListingEntry( | |
280 RawByteSequenceToFilename(filename.c_str(), encoding_), | |
281 filename, false, file_size, | |
282 base::Time::FromLocalExploded(result.fe_time))); | |
283 } | |
284 } | |
285 break; | |
268 case net::FTP_TYPE_JUNK: | 286 case net::FTP_TYPE_JUNK: |
269 case net::FTP_TYPE_COMMENT: | 287 case net::FTP_TYPE_COMMENT: |
270 break; | 288 break; |
271 default: | 289 default: |
272 break; | 290 break; |
273 } | 291 } |
274 } | 292 } |
275 LogFtpServerType(state); | 293 LogFtpServerType(state); |
276 directory_html_.append(file_entry); | 294 directory_html_.append(file_entry); |
277 size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size), | 295 size_t bytes_to_copy = std::min(static_cast<size_t>(buf_size), |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
399 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 417 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
400 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); | 418 this, &URLRequestNewFtpJob::OnStartCompleted, rv)); |
401 } | 419 } |
402 | 420 |
403 void URLRequestNewFtpJob::DestroyTransaction() { | 421 void URLRequestNewFtpJob::DestroyTransaction() { |
404 DCHECK(transaction_.get()); | 422 DCHECK(transaction_.get()); |
405 | 423 |
406 transaction_.reset(); | 424 transaction_.reset(); |
407 response_info_ = NULL; | 425 response_info_ = NULL; |
408 } | 426 } |
OLD | NEW |