| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 void Url<CTYPE>::do_set_address(const CTYPE* val, size_t len) { | 46 void Url<CTYPE>::do_set_address(const CTYPE* val, size_t len) { |
| 47 if (const CTYPE* at = strchrn(val, len, static_cast<CTYPE>('@'))) { | 47 if (const CTYPE* at = strchrn(val, len, static_cast<CTYPE>('@'))) { |
| 48 // Everything before the @ is a user:password combo, so skip it. | 48 // Everything before the @ is a user:password combo, so skip it. |
| 49 len -= at - val + 1; | 49 len -= at - val + 1; |
| 50 val = at + 1; | 50 val = at + 1; |
| 51 } | 51 } |
| 52 if (const CTYPE* colon = strchrn(val, len, static_cast<CTYPE>(':'))) { | 52 if (const CTYPE* colon = strchrn(val, len, static_cast<CTYPE>(':'))) { |
| 53 host_.assign(val, colon - val); | 53 host_.assign(val, colon - val); |
| 54 // Note: In every case, we're guaranteed that colon is followed by a null, | 54 // Note: In every case, we're guaranteed that colon is followed by a null, |
| 55 // or non-numeric character. | 55 // or non-numeric character. |
| 56 port_ = static_cast<uint16_t>(::strtoul(colon + 1, NULL, 10)); | 56 port_ = static_cast<uint16_t>(::strtoul(colon + 1, nullptr, 10)); |
| 57 // TODO: Consider checking for invalid data following port number. | 57 // TODO: Consider checking for invalid data following port number. |
| 58 } else { | 58 } else { |
| 59 host_.assign(val, len); | 59 host_.assign(val, len); |
| 60 port_ = HttpDefaultPort(secure_); | 60 port_ = HttpDefaultPort(secure_); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 template<class CTYPE> | 64 template<class CTYPE> |
| 65 void Url<CTYPE>::do_set_full_path(const CTYPE* val, size_t len) { | 65 void Url<CTYPE>::do_set_full_path(const CTYPE* val, size_t len) { |
| 66 const CTYPE* query = strchrn(val, len, static_cast<CTYPE>('?')); | 66 const CTYPE* query = strchrn(val, len, static_cast<CTYPE>('?')); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 value->assign(query_.substr(pos, end - pos)); | 124 value->assign(query_.substr(pos, end - pos)); |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 | 127 |
| 128 /////////////////////////////////////////////////////////////////////////////// | 128 /////////////////////////////////////////////////////////////////////////////// |
| 129 | 129 |
| 130 } // namespace rtc | 130 } // namespace rtc |
| 131 | 131 |
| 132 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ | 132 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ |
| OLD | NEW |