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

Side by Side Diff: net/ftp/ftp_network_transaction.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/ftp/ftp_network_transaction.h ('k') | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ftp/ftp_network_transaction.h" 5 #include "net/ftp/ftp_network_transaction.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 if (command_sent_ == COMMAND_QUIT) 313 if (command_sent_ == COMMAND_QUIT)
314 return LOAD_STATE_IDLE; 314 return LOAD_STATE_IDLE;
315 315
316 if (command_sent_ != COMMAND_NONE) 316 if (command_sent_ != COMMAND_NONE)
317 return LOAD_STATE_SENDING_REQUEST; 317 return LOAD_STATE_SENDING_REQUEST;
318 318
319 return LOAD_STATE_IDLE; 319 return LOAD_STATE_IDLE;
320 } 320 }
321 321
322 uint64 FtpNetworkTransaction::GetUploadProgress() const { 322 uint64_t FtpNetworkTransaction::GetUploadProgress() const {
323 return 0; 323 return 0;
324 } 324 }
325 325
326 void FtpNetworkTransaction::ResetStateForRestart() { 326 void FtpNetworkTransaction::ResetStateForRestart() {
327 command_sent_ = COMMAND_NONE; 327 command_sent_ = COMMAND_NONE;
328 user_callback_.Reset(); 328 user_callback_.Reset();
329 response_ = FtpResponseInfo(); 329 response_ = FtpResponseInfo();
330 read_ctrl_buf_ = new IOBuffer(kCtrlBufLen); 330 read_ctrl_buf_ = new IOBuffer(kCtrlBufLen);
331 ctrl_response_buffer_.reset(new FtpCtrlResponseBuffer(net_log_)); 331 ctrl_response_buffer_.reset(new FtpCtrlResponseBuffer(net_log_));
332 read_data_buf_ = NULL; 332 read_data_buf_ = NULL;
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 case ERROR_CLASS_INITIATED: 954 case ERROR_CLASS_INITIATED:
955 return Stop(ERR_INVALID_RESPONSE); 955 return Stop(ERR_INVALID_RESPONSE);
956 case ERROR_CLASS_OK: { 956 case ERROR_CLASS_OK: {
957 int port; 957 int port;
958 if (!ExtractPortFromEPSVResponse(response, &port)) 958 if (!ExtractPortFromEPSVResponse(response, &port))
959 return Stop(ERR_INVALID_RESPONSE); 959 return Stop(ERR_INVALID_RESPONSE);
960 if (IsWellKnownPort(port) || 960 if (IsWellKnownPort(port) ||
961 !IsPortAllowedForScheme(port, url::kFtpScheme)) { 961 !IsPortAllowedForScheme(port, url::kFtpScheme)) {
962 return Stop(ERR_UNSAFE_PORT); 962 return Stop(ERR_UNSAFE_PORT);
963 } 963 }
964 data_connection_port_ = static_cast<uint16>(port); 964 data_connection_port_ = static_cast<uint16_t>(port);
965 next_state_ = STATE_DATA_CONNECT; 965 next_state_ = STATE_DATA_CONNECT;
966 break; 966 break;
967 } 967 }
968 case ERROR_CLASS_INFO_NEEDED: 968 case ERROR_CLASS_INFO_NEEDED:
969 return Stop(ERR_INVALID_RESPONSE); 969 return Stop(ERR_INVALID_RESPONSE);
970 case ERROR_CLASS_TRANSIENT_ERROR: 970 case ERROR_CLASS_TRANSIENT_ERROR:
971 case ERROR_CLASS_PERMANENT_ERROR: 971 case ERROR_CLASS_PERMANENT_ERROR:
972 use_epsv_ = false; 972 use_epsv_ = false;
973 next_state_ = STATE_CTRL_WRITE_PASV; 973 next_state_ = STATE_CTRL_WRITE_PASV;
974 return OK; 974 return OK;
(...skipping 17 matching lines...) Expand all
992 case ERROR_CLASS_INITIATED: 992 case ERROR_CLASS_INITIATED:
993 return Stop(ERR_INVALID_RESPONSE); 993 return Stop(ERR_INVALID_RESPONSE);
994 case ERROR_CLASS_OK: { 994 case ERROR_CLASS_OK: {
995 int port; 995 int port;
996 if (!ExtractPortFromPASVResponse(response, &port)) 996 if (!ExtractPortFromPASVResponse(response, &port))
997 return Stop(ERR_INVALID_RESPONSE); 997 return Stop(ERR_INVALID_RESPONSE);
998 if (IsWellKnownPort(port) || 998 if (IsWellKnownPort(port) ||
999 !IsPortAllowedForScheme(port, url::kFtpScheme)) { 999 !IsPortAllowedForScheme(port, url::kFtpScheme)) {
1000 return Stop(ERR_UNSAFE_PORT); 1000 return Stop(ERR_UNSAFE_PORT);
1001 } 1001 }
1002 data_connection_port_ = static_cast<uint16>(port); 1002 data_connection_port_ = static_cast<uint16_t>(port);
1003 next_state_ = STATE_DATA_CONNECT; 1003 next_state_ = STATE_DATA_CONNECT;
1004 break; 1004 break;
1005 } 1005 }
1006 case ERROR_CLASS_INFO_NEEDED: 1006 case ERROR_CLASS_INFO_NEEDED:
1007 return Stop(ERR_INVALID_RESPONSE); 1007 return Stop(ERR_INVALID_RESPONSE);
1008 case ERROR_CLASS_TRANSIENT_ERROR: 1008 case ERROR_CLASS_TRANSIENT_ERROR:
1009 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); 1009 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
1010 case ERROR_CLASS_PERMANENT_ERROR: 1010 case ERROR_CLASS_PERMANENT_ERROR:
1011 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code)); 1011 return Stop(GetNetErrorCodeForFtpResponseCode(response.status_code));
1012 default: 1012 default:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 } 1061 }
1062 1062
1063 int FtpNetworkTransaction::ProcessResponseSIZE( 1063 int FtpNetworkTransaction::ProcessResponseSIZE(
1064 const FtpCtrlResponse& response) { 1064 const FtpCtrlResponse& response) {
1065 switch (GetErrorClass(response.status_code)) { 1065 switch (GetErrorClass(response.status_code)) {
1066 case ERROR_CLASS_INITIATED: 1066 case ERROR_CLASS_INITIATED:
1067 break; 1067 break;
1068 case ERROR_CLASS_OK: 1068 case ERROR_CLASS_OK:
1069 if (response.lines.size() != 1) 1069 if (response.lines.size() != 1)
1070 return Stop(ERR_INVALID_RESPONSE); 1070 return Stop(ERR_INVALID_RESPONSE);
1071 int64 size; 1071 int64_t size;
1072 if (!base::StringToInt64(response.lines[0], &size)) 1072 if (!base::StringToInt64(response.lines[0], &size))
1073 return Stop(ERR_INVALID_RESPONSE); 1073 return Stop(ERR_INVALID_RESPONSE);
1074 if (size < 0) 1074 if (size < 0)
1075 return Stop(ERR_INVALID_RESPONSE); 1075 return Stop(ERR_INVALID_RESPONSE);
1076 1076
1077 // A successful response to SIZE does not mean the resource is a file. 1077 // A successful response to SIZE does not mean the resource is a file.
1078 // Some FTP servers (for example, the qnx one) send a SIZE even for 1078 // Some FTP servers (for example, the qnx one) send a SIZE even for
1079 // directories. 1079 // directories.
1080 response_.expected_content_size = size; 1080 response_.expected_content_size = size;
1081 break; 1081 break;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 if (!had_error_type[type]) { 1372 if (!had_error_type[type]) {
1373 had_error_type[type] = true; 1373 had_error_type[type] = true;
1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", 1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1375 type, NUM_OF_NET_ERROR_TYPES); 1375 type, NUM_OF_NET_ERROR_TYPES);
1376 } 1376 }
1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", 1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1378 type, NUM_OF_NET_ERROR_TYPES); 1378 type, NUM_OF_NET_ERROR_TYPES);
1379 } 1379 }
1380 1380
1381 } // namespace net 1381 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_network_transaction.h ('k') | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698