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

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

Issue 1827893002: Fix handling of escaped slashes ("%2f") in FTP paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove accidentally included test code Created 4 years, 9 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) 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 std::string::size_type pos = gurl_path.rfind(';'); 480 std::string::size_type pos = gurl_path.rfind(';');
481 if (pos != std::string::npos) 481 if (pos != std::string::npos)
482 gurl_path.resize(pos); 482 gurl_path.resize(pos);
483 483
484 path.append(gurl_path); 484 path.append(gurl_path);
485 } 485 }
486 // Make sure that if the path is expected to be a file, it won't end 486 // Make sure that if the path is expected to be a file, it won't end
487 // with a trailing slash. 487 // with a trailing slash.
488 if (!is_directory && path.length() > 1 && path.back() == '/') 488 if (!is_directory && path.length() > 1 && path.back() == '/')
489 path.erase(path.length() - 1); 489 path.erase(path.length() - 1);
490 UnescapeRule::Type unescape_rules = UnescapeRule::SPACES | 490 UnescapeRule::Type unescape_rules =
491 UnescapeRule::URL_SPECIAL_CHARS; 491 UnescapeRule::SPACES |
492 UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS;
492 // This may unescape to non-ASCII characters, but we allow that. See the 493 // This may unescape to non-ASCII characters, but we allow that. See the
493 // comment for IsValidFTPCommandString. 494 // comment for IsValidFTPCommandString.
494 path = UnescapeURLComponent(path, unescape_rules); 495 path = UnescapeURLComponent(path, unescape_rules);
495 496
496 if (system_type_ == SYSTEM_TYPE_VMS) { 497 if (system_type_ == SYSTEM_TYPE_VMS) {
497 if (is_directory) 498 if (is_directory)
498 path = FtpUtil::UnixDirectoryPathToVMS(path); 499 path = FtpUtil::UnixDirectoryPathToVMS(path);
499 else 500 else
500 path = FtpUtil::UnixFilePathToVMS(path); 501 path = FtpUtil::UnixFilePathToVMS(path);
501 } 502 }
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 if (!had_error_type[type]) { 1373 if (!had_error_type[type]) {
1373 had_error_type[type] = true; 1374 had_error_type[type] = true;
1374 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened", 1375 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorHappened",
1375 type, NUM_OF_NET_ERROR_TYPES); 1376 type, NUM_OF_NET_ERROR_TYPES);
1376 } 1377 }
1377 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount", 1378 UMA_HISTOGRAM_ENUMERATION("Net.FtpDataConnectionErrorCount",
1378 type, NUM_OF_NET_ERROR_TYPES); 1379 type, NUM_OF_NET_ERROR_TYPES);
1379 } 1380 }
1380 1381
1381 } // namespace net 1382 } // namespace net
OLDNEW
« no previous file with comments | « content/child/ftp_directory_listing_response_delegate.cc ('k') | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698