| 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/arraysize.h" |
| 15 #include "webrtc/base/checks.h" |
| 15 #include "webrtc/base/common.h" | 16 #include "webrtc/base/common.h" |
| 16 #include "webrtc/base/httpcommon.h" | 17 #include "webrtc/base/httpcommon.h" |
| 17 | 18 |
| 18 namespace rtc { | 19 namespace rtc { |
| 19 | 20 |
| 20 /////////////////////////////////////////////////////////////////////////////// | 21 /////////////////////////////////////////////////////////////////////////////// |
| 21 // Url | 22 // Url |
| 22 /////////////////////////////////////////////////////////////////////////////// | 23 /////////////////////////////////////////////////////////////////////////////// |
| 23 | 24 |
| 24 template<class CTYPE> | 25 template<class CTYPE> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 void Url<CTYPE>::do_set_full_path(const CTYPE* val, size_t len) { | 66 void Url<CTYPE>::do_set_full_path(const CTYPE* val, size_t len) { |
| 66 const CTYPE* query = strchrn(val, len, static_cast<CTYPE>('?')); | 67 const CTYPE* query = strchrn(val, len, static_cast<CTYPE>('?')); |
| 67 if (!query) { | 68 if (!query) { |
| 68 query = val + len; | 69 query = val + len; |
| 69 } | 70 } |
| 70 size_t path_length = (query - val); | 71 size_t path_length = (query - val); |
| 71 if (0 == path_length) { | 72 if (0 == path_length) { |
| 72 // TODO: consider failing in this case. | 73 // TODO: consider failing in this case. |
| 73 path_.assign(1, static_cast<CTYPE>('/')); | 74 path_.assign(1, static_cast<CTYPE>('/')); |
| 74 } else { | 75 } else { |
| 75 ASSERT(val[0] == static_cast<CTYPE>('/')); | 76 RTC_DCHECK(val[0] == static_cast<CTYPE>('/')); |
| 76 path_.assign(val, path_length); | 77 path_.assign(val, path_length); |
| 77 } | 78 } |
| 78 query_.assign(query, len - path_length); | 79 query_.assign(query, len - path_length); |
| 79 } | 80 } |
| 80 | 81 |
| 81 template<class CTYPE> | 82 template<class CTYPE> |
| 82 void Url<CTYPE>::do_get_url(string* val) const { | 83 void Url<CTYPE>::do_get_url(string* val) const { |
| 83 CTYPE protocol[9]; | 84 CTYPE protocol[9]; |
| 84 asccpyn(protocol, arraysize(protocol), secure_ ? "https://" : "http://"); | 85 asccpyn(protocol, arraysize(protocol), secure_ ? "https://" : "http://"); |
| 85 val->append(protocol); | 86 val->append(protocol); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 124 } |
| 124 value->assign(query_.substr(pos, end - pos)); | 125 value->assign(query_.substr(pos, end - pos)); |
| 125 return true; | 126 return true; |
| 126 } | 127 } |
| 127 | 128 |
| 128 /////////////////////////////////////////////////////////////////////////////// | 129 /////////////////////////////////////////////////////////////////////////////// |
| 129 | 130 |
| 130 } // namespace rtc | 131 } // namespace rtc |
| 131 | 132 |
| 132 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ | 133 #endif // WEBRTC_BASE_HTTPCOMMON_INL_H__ |
| OLD | NEW |