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

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

Issue 9185036: Handle Z_BUF_ERROR as a non-fatal error while incrementally decompressing (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 11 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 | Annotate | Revision Log
« 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 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't 5 // TODO(rtenhove) clean up frame buffer size calculations so that we aren't
6 // constantly adding and subtracting header sizes; this is ugly and error- 6 // constantly adding and subtracting header sizes; this is ugly and error-
7 // prone. 7 // prone.
8 8
9 #include "net/spdy/spdy_framer.h" 9 #include "net/spdy/spdy_framer.h"
10 10
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 char buffer[kHeaderDataChunkMaxSize]; 1519 char buffer[kHeaderDataChunkMaxSize];
1520 1520
1521 decomp->next_in = reinterpret_cast<Bytef*>(const_cast<char*>(data)); 1521 decomp->next_in = reinterpret_cast<Bytef*>(const_cast<char*>(data));
1522 decomp->avail_in = len; 1522 decomp->avail_in = len;
1523 const SpdyStreamId stream_id = GetControlFrameStreamId(control_frame); 1523 const SpdyStreamId stream_id = GetControlFrameStreamId(control_frame);
1524 DCHECK_LT(0u, stream_id); 1524 DCHECK_LT(0u, stream_id);
1525 while (decomp->avail_in > 0 && processed_successfully) { 1525 while (decomp->avail_in > 0 && processed_successfully) {
1526 decomp->next_out = reinterpret_cast<Bytef*>(buffer); 1526 decomp->next_out = reinterpret_cast<Bytef*>(buffer);
1527 decomp->avail_out = arraysize(buffer); 1527 decomp->avail_out = arraysize(buffer);
1528 int rv = DecompressHeaderBlockInZStream(decomp); 1528 int rv = DecompressHeaderBlockInZStream(decomp);
1529 if (rv != Z_OK) { 1529 if (rv != Z_OK && rv != Z_BUF_ERROR) {
wtc 2012/01/12 23:49:38 Z_BUF_ERROR means "no progress is possible". With
ramant (doing other things) 2012/01/13 00:14:58 Wan-Teh and I had stepped through the code and we
1530 set_error(SPDY_DECOMPRESS_FAILURE); 1530 set_error(SPDY_DECOMPRESS_FAILURE);
1531 DLOG(WARNING) << "inflate failure: " << rv; 1531 DLOG(WARNING) << "inflate failure: " << rv;
1532 processed_successfully = false; 1532 processed_successfully = false;
1533 } else { 1533 } else {
1534 size_t decompressed_len = arraysize(buffer) - decomp->avail_out; 1534 size_t decompressed_len = arraysize(buffer) - decomp->avail_out;
1535 if (decompressed_len > 0) { 1535 if (decompressed_len > 0) {
1536 processed_successfully = visitor_->OnControlFrameHeaderData( 1536 processed_successfully = visitor_->OnControlFrameHeaderData(
1537 control_frame, buffer, decompressed_len); 1537 control_frame, buffer, decompressed_len);
1538 } 1538 }
1539 if (!processed_successfully) { 1539 if (!processed_successfully) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 1718
1719 void SpdyFramer::set_enable_compression_default(bool value) { 1719 void SpdyFramer::set_enable_compression_default(bool value) {
1720 compression_default_ = value; 1720 compression_default_ = value;
1721 } 1721 }
1722 1722
1723 void SpdyFramer::set_validate_control_frame_sizes(bool value) { 1723 void SpdyFramer::set_validate_control_frame_sizes(bool value) {
1724 validate_control_frame_sizes_ = value; 1724 validate_control_frame_sizes_ = value;
1725 } 1725 }
1726 1726
1727 } // namespace spdy 1727 } // namespace spdy
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