Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1144)

Side by Side Diff: net/ftp/ftp_network_transaction.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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/load_log.h" 10 #include "net/base/load_log.h"
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 return Stop(ERR_FAILED); 858 return Stop(ERR_FAILED);
859 return ERR_FAILED; // TODO(ibrar): Retry here. 859 return ERR_FAILED; // TODO(ibrar): Retry here.
860 case ERROR_CLASS_PERMANENT_ERROR: 860 case ERROR_CLASS_PERMANENT_ERROR:
861 // Code 550 means "Failed to open file". Other codes are unrelated, 861 // Code 550 means "Failed to open file". Other codes are unrelated,
862 // like "Not logged in" etc. 862 // like "Not logged in" etc.
863 if (response.status_code != 550) 863 if (response.status_code != 550)
864 return Stop(ERR_FAILED); 864 return Stop(ERR_FAILED);
865 865
866 DCHECK(!retr_failed_); // Should not get here twice. 866 DCHECK(!retr_failed_); // Should not get here twice.
867 retr_failed_ = true; 867 retr_failed_ = true;
868 next_state_ = STATE_CTRL_WRITE_PASV; 868
869 // It's possible that RETR failed because the path is a directory.
870 // Try CWD next, to see if that's the case.
871 next_state_ = STATE_CTRL_WRITE_CWD;
869 break; 872 break;
870 default: 873 default:
871 NOTREACHED(); 874 NOTREACHED();
872 return Stop(ERR_UNEXPECTED); 875 return Stop(ERR_UNEXPECTED);
873 } 876 }
874 return OK; 877 return OK;
875 } 878 }
876 879
877 // MDMT command 880 // MDMT command
878 int FtpNetworkTransaction::DoCtrlWriteMDTM() { 881 int FtpNetworkTransaction::DoCtrlWriteMDTM() {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 } 1019 }
1017 return OK; 1020 return OK;
1018 } 1021 }
1019 1022
1020 int FtpNetworkTransaction::DoDataRead() { 1023 int FtpNetworkTransaction::DoDataRead() {
1021 DCHECK(read_data_buf_); 1024 DCHECK(read_data_buf_);
1022 DCHECK_GT(read_data_buf_len_, 0); 1025 DCHECK_GT(read_data_buf_len_, 0);
1023 1026
1024 if (data_socket_ == NULL || !data_socket_->IsConnected()) { 1027 if (data_socket_ == NULL || !data_socket_->IsConnected()) {
1025 // If we don't destroy the data socket completely, some servers will wait 1028 // If we don't destroy the data socket completely, some servers will wait
1026 // for us (http://crbug.com/21127). 1029 // for us (http://crbug.com/21127). The half-closed TCP connection needs
1030 // to be closed on our side too.
1027 data_socket_.reset(); 1031 data_socket_.reset();
1028 1032
1029 // No more data so send QUIT Command now and wait for response. 1033 // No more data so send QUIT Command now and wait for response.
1030 return Stop(OK); 1034 return Stop(OK);
1031 } 1035 }
1032 1036
1033 next_state_ = STATE_DATA_READ_COMPLETE; 1037 next_state_ = STATE_DATA_READ_COMPLETE;
1034 read_data_buf_->data()[0] = 0; 1038 read_data_buf_->data()[0] = 0;
1035 return data_socket_->Read(read_data_buf_, read_data_buf_len_, 1039 return data_socket_->Read(read_data_buf_, read_data_buf_len_,
1036 &io_callback_); 1040 &io_callback_);
1037 } 1041 }
1038 1042
1039 int FtpNetworkTransaction::DoDataReadComplete(int result) { 1043 int FtpNetworkTransaction::DoDataReadComplete(int result) {
1040 return result; 1044 return result;
1041 } 1045 }
1042 1046
1043 } // namespace net 1047 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698