| 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/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 headers->erase("host"); // this is kinda insane, spdy 3 spec. | 123 headers->erase("host"); // this is kinda insane, spdy 3 spec. |
| 124 } | 124 } |
| 125 | 125 |
| 126 } | 126 } |
| 127 | 127 |
| 128 SpdyPriority ConvertRequestPriorityToSpdyPriority( | 128 SpdyPriority ConvertRequestPriorityToSpdyPriority( |
| 129 const RequestPriority priority, | 129 const RequestPriority priority, |
| 130 int protocol_version) { | 130 int protocol_version) { |
| 131 DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES); | 131 DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES); |
| 132 if (protocol_version == 2) { | 132 if (protocol_version == 2) { |
| 133 switch (priority) { | 133 // SPDY 2 only has 2 bits of priority, but we have 5 RequestPriorities. |
| 134 case LOWEST: | 134 if (priority < LOWEST) { |
| 135 return SPDY_PRIORITY_LOWEST - 1; | 135 return priority; |
| 136 case IDLE: | 136 } else { |
| 137 return SPDY_PRIORITY_LOWEST; | 137 DCHECK_GE(4, priority); |
| 138 default: | 138 return priority - 1; |
| 139 return priority; | |
| 140 } | 139 } |
| 141 } else { | 140 } else { |
| 141 DCHECK_GE(7, priority); |
| 142 return priority; | 142 return priority; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, | 146 GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, |
| 147 int protocol_version, | 147 int protocol_version, |
| 148 bool pushed) { | 148 bool pushed) { |
| 149 // SPDY 2 server push urls are specified in a single "url" header. | 149 // SPDY 2 server push urls are specified in a single "url" header. |
| 150 if (pushed && protocol_version == 2) { | 150 if (pushed && protocol_version == 2) { |
| 151 std::string url; | 151 std::string url; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 173 it = headers.find(path_header); | 173 it = headers.find(path_header); |
| 174 if (it != headers.end()) | 174 if (it != headers.end()) |
| 175 path = it->second; | 175 path = it->second; |
| 176 | 176 |
| 177 std::string url = (scheme.empty() || host_port.empty() || path.empty()) | 177 std::string url = (scheme.empty() || host_port.empty() || path.empty()) |
| 178 ? "" : scheme + "://" + host_port + path; | 178 ? "" : scheme + "://" + host_port + path; |
| 179 return GURL(url); | 179 return GURL(url); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace net | 182 } // namespace net |
| OLD | NEW |