Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "net/ftp/ftp_network_transaction.h" | 5 #include "net/ftp/ftp_network_transaction.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "net/base/connection_type_histograms.h" | 9 #include "net/base/connection_type_histograms.h" |
| 10 #include "net/base/escape.h" | 10 #include "net/base/escape.h" |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 | 515 |
| 516 int FtpNetworkTransaction::DoCtrlRead() { | 516 int FtpNetworkTransaction::DoCtrlRead() { |
| 517 next_state_ = STATE_CTRL_READ_COMPLETE; | 517 next_state_ = STATE_CTRL_READ_COMPLETE; |
| 518 return ctrl_socket_->Read( | 518 return ctrl_socket_->Read( |
| 519 read_ctrl_buf_, | 519 read_ctrl_buf_, |
| 520 kCtrlBufLen, | 520 kCtrlBufLen, |
| 521 &io_callback_); | 521 &io_callback_); |
| 522 } | 522 } |
| 523 | 523 |
| 524 int FtpNetworkTransaction::DoCtrlReadComplete(int result) { | 524 int FtpNetworkTransaction::DoCtrlReadComplete(int result) { |
| 525 if (result == 0) { | |
| 526 // Some servers (for example Pure-FTPd) apparently close the control | |
| 527 // connection when anonymous login is not permitted. For more details | |
| 528 // see http://crbug.com/25023. | |
| 529 if (command_sent_ == COMMAND_USER && username_ == L"anonymous") | |
| 530 response_.needs_auth = true; | |
| 531 return Stop(ERR_EMPTY_RESPONSE); | |
|
wtc
2009/10/31 15:16:48
I think ERR_EMPTY_RESPONSE is fine. We can also a
| |
| 532 } | |
| 525 if (result < 0) | 533 if (result < 0) |
| 526 return Stop(result); | 534 return Stop(result); |
| 527 | 535 |
| 528 ctrl_response_buffer_->ConsumeData(read_ctrl_buf_->data(), result); | 536 ctrl_response_buffer_->ConsumeData(read_ctrl_buf_->data(), result); |
| 529 | 537 |
| 530 if (!ctrl_response_buffer_->ResponseAvailable()) { | 538 if (!ctrl_response_buffer_->ResponseAvailable()) { |
| 531 // Read more data from the control socket. | 539 // Read more data from the control socket. |
| 532 next_state_ = STATE_CTRL_READ; | 540 next_state_ = STATE_CTRL_READ; |
| 533 return OK; | 541 return OK; |
| 534 } | 542 } |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1084 read_data_buf_->data()[0] = 0; | 1092 read_data_buf_->data()[0] = 0; |
| 1085 return data_socket_->Read(read_data_buf_, read_data_buf_len_, | 1093 return data_socket_->Read(read_data_buf_, read_data_buf_len_, |
| 1086 &io_callback_); | 1094 &io_callback_); |
| 1087 } | 1095 } |
| 1088 | 1096 |
| 1089 int FtpNetworkTransaction::DoDataReadComplete(int result) { | 1097 int FtpNetworkTransaction::DoDataReadComplete(int result) { |
| 1090 return result; | 1098 return result; |
| 1091 } | 1099 } |
| 1092 | 1100 |
| 1093 } // namespace net | 1101 } // namespace net |
| OLD | NEW |