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

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

Issue 1357953002: Replace the existing SpdyHeaderBlock typedef with a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add NET_EXPORT to fix compile error on win_chromium_compile_dbg_ng. Created 5 years, 2 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 | « net/spdy/hpack/hpack_encoder_test.cc ('k') | net/spdy/spdy_framer_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 (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_framer.h" 5 #include "net/spdy/spdy_framer.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 // manner that resists the length of the compressed data from compromising 1323 // manner that resists the length of the compressed data from compromising
1324 // cookie data. 1324 // cookie data.
1325 void SpdyFramer::WriteHeaderBlockToZ(const SpdyHeaderBlock* headers, 1325 void SpdyFramer::WriteHeaderBlockToZ(const SpdyHeaderBlock* headers,
1326 z_stream* z) const { 1326 z_stream* z) const {
1327 unsigned length_length = 4; 1327 unsigned length_length = 4;
1328 if (protocol_version() < 3) 1328 if (protocol_version() < 3)
1329 length_length = 2; 1329 length_length = 2;
1330 1330
1331 WriteLengthZ(headers->size(), length_length, kZStandardData, z); 1331 WriteLengthZ(headers->size(), length_length, kZStandardData, z);
1332 1332
1333 std::map<std::string, std::string>::const_iterator it; 1333 SpdyHeaderBlock::const_iterator it;
1334 for (it = headers->begin(); it != headers->end(); ++it) { 1334 for (it = headers->begin(); it != headers->end(); ++it) {
1335 WriteLengthZ(it->first.size(), length_length, kZStandardData, z); 1335 WriteLengthZ(it->first.size(), length_length, kZStandardData, z);
1336 WriteZ(it->first, kZStandardData, z); 1336 WriteZ(it->first, kZStandardData, z);
1337 1337
1338 if (it->first == "cookie") { 1338 if (it->first == "cookie") {
1339 // We require the cookie values (save for the last) to end with a 1339 // We require the cookie values (save for the last) to end with a
1340 // semicolon and (save for the first) to start with a space. This is 1340 // semicolon and (save for the first) to start with a space. This is
1341 // typically the format that we are given them in but we reserialize them 1341 // typically the format that we are given them in but we reserialize them
1342 // to be sure. 1342 // to be sure.
1343 1343
(...skipping 1899 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 #else 3243 #else
3244 WriteHeaderBlockToZ(&frame.header_block(), compressor); 3244 WriteHeaderBlockToZ(&frame.header_block(), compressor);
3245 #endif // defined(USE_SYSTEM_ZLIB) 3245 #endif // defined(USE_SYSTEM_ZLIB)
3246 3246
3247 int compressed_size = compressed_max_size - compressor->avail_out; 3247 int compressed_size = compressed_max_size - compressor->avail_out;
3248 builder->Seek(compressed_size); 3248 builder->Seek(compressed_size);
3249 builder->RewriteLength(*this); 3249 builder->RewriteLength(*this);
3250 } 3250 }
3251 3251
3252 } // namespace net 3252 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_encoder_test.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698