| OLD | NEW |
| 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/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 0xFFFF, // Used to block all invalid port numbers (see | 158 0xFFFF, // Used to block all invalid port numbers (see |
| 159 // third_party/WebKit/Source/WebCore/platform/KURLGoogle.cpp, port()) | 159 // third_party/WebKit/Source/WebCore/platform/KURLGoogle.cpp, port()) |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 // FTP overrides the following restricted ports. | 162 // FTP overrides the following restricted ports. |
| 163 static const int kAllowedFtpPorts[] = { | 163 static const int kAllowedFtpPorts[] = { |
| 164 21, // ftp data | 164 21, // ftp data |
| 165 22, // ssh | 165 22, // ssh |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 #if defined(OS_WIN) |
| 168 std::string::size_type CountTrailingChars( | 169 std::string::size_type CountTrailingChars( |
| 169 const std::string& input, | 170 const std::string& input, |
| 170 const std::string::value_type trailing_chars[]) { | 171 const std::string::value_type trailing_chars[]) { |
| 171 const size_t last_good_char = input.find_last_not_of(trailing_chars); | 172 const size_t last_good_char = input.find_last_not_of(trailing_chars); |
| 172 return (last_good_char == std::string::npos) ? | 173 return (last_good_char == std::string::npos) ? |
| 173 input.length() : (input.length() - last_good_char - 1); | 174 input.length() : (input.length() - last_good_char - 1); |
| 174 } | 175 } |
| 176 #endif |
| 175 | 177 |
| 176 // Similar to Base64Decode. Decodes a Q-encoded string to a sequence | 178 // Similar to Base64Decode. Decodes a Q-encoded string to a sequence |
| 177 // of bytes. If input is invalid, return false. | 179 // of bytes. If input is invalid, return false. |
| 178 bool QPDecode(const std::string& input, std::string* output) { | 180 bool QPDecode(const std::string& input, std::string* output) { |
| 179 std::string temp; | 181 std::string temp; |
| 180 temp.reserve(input.size()); | 182 temp.reserve(input.size()); |
| 181 for (std::string::const_iterator it = input.begin(); it != input.end(); | 183 for (std::string::const_iterator it = input.begin(); it != input.end(); |
| 182 ++it) { | 184 ++it) { |
| 183 if (*it == '_') { | 185 if (*it == '_') { |
| 184 temp.push_back(' '); | 186 temp.push_back(' '); |
| (...skipping 2255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2440 | 2442 |
| 2441 NetworkInterface::NetworkInterface(const std::string& name, | 2443 NetworkInterface::NetworkInterface(const std::string& name, |
| 2442 const IPAddressNumber& address) | 2444 const IPAddressNumber& address) |
| 2443 : name(name), address(address) { | 2445 : name(name), address(address) { |
| 2444 } | 2446 } |
| 2445 | 2447 |
| 2446 NetworkInterface::~NetworkInterface() { | 2448 NetworkInterface::~NetworkInterface() { |
| 2447 } | 2449 } |
| 2448 | 2450 |
| 2449 } // namespace net | 2451 } // namespace net |
| OLD | NEW |