| 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/spdy/spdy_http_utils.h" | 5 #include "net/spdy/spdy_http_utils.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 (*headers)[status_key] = std::string(after_version + 1, status_line.end()); | 153 (*headers)[status_key] = std::string(after_version + 1, status_line.end()); |
| 154 | 154 |
| 155 void* iter = NULL; | 155 void* iter = NULL; |
| 156 std::string raw_name, value; | 156 std::string raw_name, value; |
| 157 while (response_headers.EnumerateHeaderLines(&iter, &raw_name, &value)) { | 157 while (response_headers.EnumerateHeaderLines(&iter, &raw_name, &value)) { |
| 158 std::string name = base::StringToLowerASCII(raw_name); | 158 std::string name = base::StringToLowerASCII(raw_name); |
| 159 AddSpdyHeader(name, value, headers); | 159 AddSpdyHeader(name, value, headers); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 static_assert(HIGHEST - LOWEST < 4 && HIGHEST - MINIMUM_PRIORITY < 5, |
| 164 COMPILE_ASSERT(HIGHEST - LOWEST < 4 && | 164 "request priority incompatible with spdy"); |
| 165 HIGHEST - MINIMUM_PRIORITY < 5, | |
| 166 request_priority_incompatible_with_spdy); | |
| 167 | 165 |
| 168 SpdyPriority ConvertRequestPriorityToSpdyPriority( | 166 SpdyPriority ConvertRequestPriorityToSpdyPriority( |
| 169 const RequestPriority priority, | 167 const RequestPriority priority, |
| 170 SpdyMajorVersion protocol_version) { | 168 SpdyMajorVersion protocol_version) { |
| 171 DCHECK_GE(priority, MINIMUM_PRIORITY); | 169 DCHECK_GE(priority, MINIMUM_PRIORITY); |
| 172 DCHECK_LE(priority, MAXIMUM_PRIORITY); | 170 DCHECK_LE(priority, MAXIMUM_PRIORITY); |
| 173 return static_cast<SpdyPriority>(MAXIMUM_PRIORITY - priority); | 171 return static_cast<SpdyPriority>(MAXIMUM_PRIORITY - priority); |
| 174 } | 172 } |
| 175 | 173 |
| 176 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( | 174 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 204 if (it != headers.end()) | 202 if (it != headers.end()) |
| 205 path = it->second; | 203 path = it->second; |
| 206 | 204 |
| 207 std::string url = (scheme.empty() || host_port.empty() || path.empty()) | 205 std::string url = (scheme.empty() || host_port.empty() || path.empty()) |
| 208 ? std::string() | 206 ? std::string() |
| 209 : scheme + "://" + host_port + path; | 207 : scheme + "://" + host_port + path; |
| 210 return GURL(url); | 208 return GURL(url); |
| 211 } | 209 } |
| 212 | 210 |
| 213 } // namespace net | 211 } // namespace net |
| OLD | NEW |