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

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

Issue 654253004: Update HTTP/2 DATA frame padding to 0x00. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Nit. Created 6 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 | « no previous file | 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 "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/stats_counters.h" 9 #include "base/metrics/stats_counters.h"
10 #include "base/third_party/valgrind/memcheck.h" 10 #include "base/third_party/valgrind/memcheck.h"
(...skipping 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 const size_t size_with_padding = num_padding_fields + 2307 const size_t size_with_padding = num_padding_fields +
2308 data_ir.data().length() + data_ir.padding_payload_len() + 2308 data_ir.data().length() + data_ir.padding_payload_len() +
2309 GetDataFrameMinimumSize(); 2309 GetDataFrameMinimumSize();
2310 SpdyFrameBuilder builder(size_with_padding, protocol_version()); 2310 SpdyFrameBuilder builder(size_with_padding, protocol_version());
2311 builder.WriteDataFrameHeader(*this, data_ir.stream_id(), flags); 2311 builder.WriteDataFrameHeader(*this, data_ir.stream_id(), flags);
2312 if (data_ir.padded()) { 2312 if (data_ir.padded()) {
2313 builder.WriteUInt8(data_ir.padding_payload_len() & 0xff); 2313 builder.WriteUInt8(data_ir.padding_payload_len() & 0xff);
2314 } 2314 }
2315 builder.WriteBytes(data_ir.data().data(), data_ir.data().length()); 2315 builder.WriteBytes(data_ir.data().data(), data_ir.data().length());
2316 if (data_ir.padding_payload_len() > 0) { 2316 if (data_ir.padding_payload_len() > 0) {
2317 string padding = string(data_ir.padding_payload_len(), '0'); 2317 string padding(data_ir.padding_payload_len(), 0);
2318 builder.WriteBytes(padding.data(), padding.length()); 2318 builder.WriteBytes(padding.data(), padding.length());
2319 } 2319 }
2320 DCHECK_EQ(size_with_padding, builder.length()); 2320 DCHECK_EQ(size_with_padding, builder.length());
2321 return builder.take(); 2321 return builder.take();
2322 } else { 2322 } else {
2323 const size_t size = GetDataFrameMinimumSize() + data_ir.data().length(); 2323 const size_t size = GetDataFrameMinimumSize() + data_ir.data().length();
2324 SpdyFrameBuilder builder(size, protocol_version()); 2324 SpdyFrameBuilder builder(size, protocol_version());
2325 builder.WriteDataFrameHeader(*this, data_ir.stream_id(), flags); 2325 builder.WriteDataFrameHeader(*this, data_ir.stream_id(), flags);
2326 builder.WriteBytes(data_ir.data().data(), data_ir.data().length()); 2326 builder.WriteBytes(data_ir.data().data(), data_ir.data().length());
2327 DCHECK_EQ(size, builder.length()); 2327 DCHECK_EQ(size, builder.length());
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 builder->Seek(compressed_size); 3243 builder->Seek(compressed_size);
3244 builder->RewriteLength(*this); 3244 builder->RewriteLength(*this);
3245 3245
3246 pre_compress_bytes.Add(uncompressed_len); 3246 pre_compress_bytes.Add(uncompressed_len);
3247 post_compress_bytes.Add(compressed_size); 3247 post_compress_bytes.Add(compressed_size);
3248 3248
3249 compressed_frames.Increment(); 3249 compressed_frames.Increment();
3250 } 3250 }
3251 3251
3252 } // namespace net 3252 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698