Chromium Code Reviews| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 if (priority > LOWEST) { | 140 if (priority > LOWEST) { |
| 141 return static_cast<SpdyPriority>(HIGHEST - priority); | 141 return static_cast<SpdyPriority>(HIGHEST - priority); |
| 142 } else { | 142 } else { |
| 143 return static_cast<SpdyPriority>(HIGHEST - priority - 1); | 143 return static_cast<SpdyPriority>(HIGHEST - priority - 1); |
| 144 } | 144 } |
| 145 } else { | 145 } else { |
| 146 return static_cast<SpdyPriority>(HIGHEST - priority); | 146 return static_cast<SpdyPriority>(HIGHEST - priority); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 NET_EXPORT_PRIVATE RequestPriority ConvertSpdyPriorityToRequestPriority( | |
| 151 SpdyPriority priority, | |
| 152 int protocol_version) { | |
| 153 // Handle invalid values gracefully, and pick LOW to map 2 back | |
|
Ryan Hamilton
2013/03/24 15:08:40
nit: outdent
akalin
2013/03/24 19:24:53
Done.
| |
| 154 // to for SPDY/2. | |
| 155 SpdyPriority idle_cutoff = (protocol_version == 2) ? 3 : 5; | |
| 156 return (priority >= idle_cutoff) ? | |
| 157 IDLE : static_cast<RequestPriority>(HIGHEST - priority); | |
| 158 } | |
| 159 | |
| 150 GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, | 160 GURL GetUrlFromHeaderBlock(const SpdyHeaderBlock& headers, |
| 151 int protocol_version, | 161 int protocol_version, |
| 152 bool pushed) { | 162 bool pushed) { |
| 153 // SPDY 2 server push urls are specified in a single "url" header. | 163 // SPDY 2 server push urls are specified in a single "url" header. |
| 154 if (pushed && protocol_version == 2) { | 164 if (pushed && protocol_version == 2) { |
| 155 std::string url; | 165 std::string url; |
| 156 SpdyHeaderBlock::const_iterator it; | 166 SpdyHeaderBlock::const_iterator it; |
| 157 it = headers.find("url"); | 167 it = headers.find("url"); |
| 158 if (it != headers.end()) | 168 if (it != headers.end()) |
| 159 url = it->second; | 169 url = it->second; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 185 | 195 |
| 186 bool ShouldShowHttpHeaderValue(const std::string& header_name) { | 196 bool ShouldShowHttpHeaderValue(const std::string& header_name) { |
| 187 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 197 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| 188 if (header_name == "proxy-authorization") | 198 if (header_name == "proxy-authorization") |
| 189 return false; | 199 return false; |
| 190 #endif | 200 #endif |
| 191 return true; | 201 return true; |
| 192 } | 202 } |
| 193 | 203 |
| 194 } // namespace net | 204 } // namespace net |
| OLD | NEW |