| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 void Url<CTYPE>::do_set_address(const CTYPE* val, size_t len) { | 45 void Url<CTYPE>::do_set_address(const CTYPE* val, size_t len) { |
| 46 if (const CTYPE* at = strchrn(val, len, static_cast<CTYPE>('@'))) { | 46 if (const CTYPE* at = strchrn(val, len, static_cast<CTYPE>('@'))) { |
| 47 // Everything before the @ is a user:password combo, so skip it. | 47 // Everything before the @ is a user:password combo, so skip it. |
| 48 len -= at - val + 1; | 48 len -= at - val + 1; |
| 49 val = at + 1; | 49 val = at + 1; |
| 50 } | 50 } |
| 51 if (const CTYPE* colon = strchrn(val, len, static_cast<CTYPE>(':'))) { | 51 if (const CTYPE* colon = strchrn(val, len, static_cast<CTYPE>(':'))) { |
| 52 host_.assign(val, colon - val); | 52 host_.assign(val, colon - val); |
| 53 // Note: In every case, we're guaranteed that colon is followed by a null, | 53 // Note: In every case, we're guaranteed that colon is followed by a null, |
| 54 // or non-numeric character. | 54 // or non-numeric character. |
| 55 port_ = static_cast<uint16>(::strtoul(colon + 1, NULL, 10)); | 55 port_ = static_cast<uint16_t>(::strtoul(colon + 1, NULL, 10)); |
| 56 // TODO: Consider checking for invalid data following port number. | 56 // TODO: Consider checking for invalid data following port number. |
| 57 } else { | 57 } else { |
| 58 host_.assign(val, len); | 58 host_.assign(val, len); |
| 59 port_ = HttpDefaultPort(secure_); | 59 port_ = HttpDefaultPort(secure_); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 template<class CTYPE> | 63 template<class CTYPE> |
| 64 void Url<CTYPE>::do_set_full_path(const CTYPE* val, size_t len) { | 64 void Url<CTYPE>::do_set_full_path(const CTYPE* val, size_t len) { |
| 65 const CTYPE* query = strchrn(val, len, static_cast<CTYPE>('?')); | 65 const CTYPE* query = strchrn(val, len, static_cast<CTYPE>('?')); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 value->assign(query_.substr(pos, end - pos)); | 123 value->assign(query_.substr(pos, end - pos)); |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 /////////////////////////////////////////////////////////////////////////////// | 127 /////////////////////////////////////////////////////////////////////////////// |
| 128 | 128 |
| 129 } // namespace rtc | 129 } // namespace rtc |
| 130 | 130 |
| 131 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ | 131 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ |
| OLD | NEW |