| 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 |
| 11 #ifndef WEBRTC_BASE_HTTPCOMMON_INL_H__ | 11 #ifndef WEBRTC_BASE_HTTPCOMMON_INL_H__ |
| 12 #define WEBRTC_BASE_HTTPCOMMON_INL_H__ | 12 #define WEBRTC_BASE_HTTPCOMMON_INL_H__ |
| 13 | 13 |
| 14 #include "webrtc/base/arraysize.h" |
| 14 #include "webrtc/base/common.h" | 15 #include "webrtc/base/common.h" |
| 15 #include "webrtc/base/httpcommon.h" | 16 #include "webrtc/base/httpcommon.h" |
| 16 | 17 |
| 17 namespace rtc { | 18 namespace rtc { |
| 18 | 19 |
| 19 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
| 20 // Url | 21 // Url |
| 21 /////////////////////////////////////////////////////////////////////////////// | 22 /////////////////////////////////////////////////////////////////////////////// |
| 22 | 23 |
| 23 template<class CTYPE> | 24 template<class CTYPE> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } else { | 74 } else { |
| 74 ASSERT(val[0] == static_cast<CTYPE>('/')); | 75 ASSERT(val[0] == static_cast<CTYPE>('/')); |
| 75 path_.assign(val, path_length); | 76 path_.assign(val, path_length); |
| 76 } | 77 } |
| 77 query_.assign(query, len - path_length); | 78 query_.assign(query, len - path_length); |
| 78 } | 79 } |
| 79 | 80 |
| 80 template<class CTYPE> | 81 template<class CTYPE> |
| 81 void Url<CTYPE>::do_get_url(string* val) const { | 82 void Url<CTYPE>::do_get_url(string* val) const { |
| 82 CTYPE protocol[9]; | 83 CTYPE protocol[9]; |
| 83 asccpyn(protocol, ARRAY_SIZE(protocol), secure_ ? "https://" : "http://"); | 84 asccpyn(protocol, arraysize(protocol), secure_ ? "https://" : "http://"); |
| 84 val->append(protocol); | 85 val->append(protocol); |
| 85 do_get_address(val); | 86 do_get_address(val); |
| 86 do_get_full_path(val); | 87 do_get_full_path(val); |
| 87 } | 88 } |
| 88 | 89 |
| 89 template<class CTYPE> | 90 template<class CTYPE> |
| 90 void Url<CTYPE>::do_get_address(string* val) const { | 91 void Url<CTYPE>::do_get_address(string* val) const { |
| 91 val->append(host_); | 92 val->append(host_); |
| 92 if (port_ != HttpDefaultPort(secure_)) { | 93 if (port_ != HttpDefaultPort(secure_)) { |
| 93 CTYPE format[5], port[32]; | 94 CTYPE format[5], port[32]; |
| 94 asccpyn(format, ARRAY_SIZE(format), ":%hu"); | 95 asccpyn(format, arraysize(format), ":%hu"); |
| 95 sprintfn(port, ARRAY_SIZE(port), format, port_); | 96 sprintfn(port, arraysize(port), format, port_); |
| 96 val->append(port); | 97 val->append(port); |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 | 100 |
| 100 template<class CTYPE> | 101 template<class CTYPE> |
| 101 void Url<CTYPE>::do_get_full_path(string* val) const { | 102 void Url<CTYPE>::do_get_full_path(string* val) const { |
| 102 val->append(path_); | 103 val->append(path_); |
| 103 val->append(query_); | 104 val->append(query_); |
| 104 } | 105 } |
| 105 | 106 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 122 } | 123 } |
| 123 value->assign(query_.substr(pos, end - pos)); | 124 value->assign(query_.substr(pos, end - pos)); |
| 124 return true; | 125 return true; |
| 125 } | 126 } |
| 126 | 127 |
| 127 /////////////////////////////////////////////////////////////////////////////// | 128 /////////////////////////////////////////////////////////////////////////////// |
| 128 | 129 |
| 129 } // namespace rtc | 130 } // namespace rtc |
| 130 | 131 |
| 131 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ | 132 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ |
| OLD | NEW |