Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: net/spdy/hpack_encoder.cc

Issue 986713002: Fully qualify std::make_pair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/spdy/hpack_encoder_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/hpack_encoder.h" 5 #include "net/spdy/hpack_encoder.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/spdy/hpack_header_table.h" 10 #include "net/spdy/hpack_header_table.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 Representations* out) { 162 Representations* out) {
163 size_t prior_size = out->size(); 163 size_t prior_size = out->size();
164 164
165 // See Section 8.1.2.5. "Compressing the Cookie Header Field" in the HTTP/2 165 // See Section 8.1.2.5. "Compressing the Cookie Header Field" in the HTTP/2
166 // specification at https://tools.ietf.org/html/draft-ietf-httpbis-http2-14. 166 // specification at https://tools.ietf.org/html/draft-ietf-httpbis-http2-14.
167 // Cookie values are split into individually-encoded HPACK representations. 167 // Cookie values are split into individually-encoded HPACK representations.
168 for (size_t pos = 0;;) { 168 for (size_t pos = 0;;) {
169 size_t end = cookie.second.find(";", pos); 169 size_t end = cookie.second.find(";", pos);
170 170
171 if (end == StringPiece::npos) { 171 if (end == StringPiece::npos) {
172 out->push_back(make_pair( 172 out->push_back(std::make_pair(cookie.first, cookie.second.substr(pos)));
173 cookie.first,
174 cookie.second.substr(pos)));
175 break; 173 break;
176 } 174 }
177 out->push_back(make_pair( 175 out->push_back(
178 cookie.first, 176 std::make_pair(cookie.first, cookie.second.substr(pos, end - pos)));
179 cookie.second.substr(pos, end - pos)));
180 177
181 // Consume next space if present. 178 // Consume next space if present.
182 pos = end + 1; 179 pos = end + 1;
183 if (pos != cookie.second.size() && cookie.second[pos] == ' ') { 180 if (pos != cookie.second.size() && cookie.second[pos] == ' ') {
184 pos++; 181 pos++;
185 } 182 }
186 } 183 }
187 // Sort crumbs and remove duplicates. 184 // Sort crumbs and remove duplicates.
188 std::sort(out->begin() + prior_size, out->end()); 185 std::sort(out->begin() + prior_size, out->end());
189 out->erase(std::unique(out->begin() + prior_size, out->end()), 186 out->erase(std::unique(out->begin() + prior_size, out->end()),
190 out->end()); 187 out->end());
191 } 188 }
192 189
193 // static 190 // static
194 void HpackEncoder::DecomposeRepresentation(const Representation& header_field, 191 void HpackEncoder::DecomposeRepresentation(const Representation& header_field,
195 Representations* out) { 192 Representations* out) {
196 size_t pos = 0; 193 size_t pos = 0;
197 size_t end = 0; 194 size_t end = 0;
198 while (end != StringPiece::npos) { 195 while (end != StringPiece::npos) {
199 end = header_field.second.find('\0', pos); 196 end = header_field.second.find('\0', pos);
200 out->push_back(make_pair(header_field.first, 197 out->push_back(std::make_pair(header_field.first,
201 header_field.second.substr(pos, end - pos))); 198 header_field.second.substr(pos, end - pos)));
202 pos = end + 1; 199 pos = end + 1;
203 } 200 }
204 } 201 }
205 202
206 } // namespace net 203 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/hpack_encoder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698