OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/quic/core/spdy_utils.h" | 5 #include "net/quic/core/spdy_utils.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DVLOG(1) << "Required key '" << kFinalOffsetHeaderKey << "' not present"; | 106 DVLOG(1) << "Required key '" << kFinalOffsetHeaderKey << "' not present"; |
107 return false; | 107 return false; |
108 } | 108 } |
109 // The final offset header is no longer needed. | 109 // The final offset header is no longer needed. |
110 trailers->erase(it->first); | 110 trailers->erase(it->first); |
111 | 111 |
112 // Trailers must not have empty keys, and must not contain pseudo headers. | 112 // Trailers must not have empty keys, and must not contain pseudo headers. |
113 for (const auto& trailer : *trailers) { | 113 for (const auto& trailer : *trailers) { |
114 base::StringPiece key = trailer.first; | 114 base::StringPiece key = trailer.first; |
115 base::StringPiece value = trailer.second; | 115 base::StringPiece value = trailer.second; |
116 if (key.starts_with(":")) { | 116 if (base::StartsWith(key, ":", base::CompareCase::INSENSITIVE_ASCII)) { |
117 DVLOG(1) << "Trailers must not contain pseudo-header: '" << key << "','" | 117 DVLOG(1) << "Trailers must not contain pseudo-header: '" << key << "','" |
118 << value << "'."; | 118 << value << "'."; |
119 return false; | 119 return false; |
120 } | 120 } |
121 | 121 |
122 // TODO(rjshade): Check for other forbidden keys, following the HTTP/2 spec. | 122 // TODO(rjshade): Check for other forbidden keys, following the HTTP/2 spec. |
123 } | 123 } |
124 | 124 |
125 DVLOG(1) << "Successfully parsed Trailers."; | 125 DVLOG(1) << "Successfully parsed Trailers."; |
126 return true; | 126 return true; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 pos = url.find("/", start); | 250 pos = url.find("/", start); |
251 if (pos == string::npos) { | 251 if (pos == string::npos) { |
252 return false; | 252 return false; |
253 } | 253 } |
254 (*headers)[":authority"] = url.substr(start, pos - start); | 254 (*headers)[":authority"] = url.substr(start, pos - start); |
255 (*headers)[":path"] = url.substr(pos); | 255 (*headers)[":path"] = url.substr(pos); |
256 return true; | 256 return true; |
257 } | 257 } |
258 | 258 |
259 } // namespace net | 259 } // namespace net |
OLD | NEW |