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

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

Issue 10874087: Merge 151720 - net: workaround compression leaks (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 3 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 | « net/spdy/buffered_spdy_framer.cc ('k') | net/spdy/spdy_framer.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 #ifndef NET_SPDY_SPDY_FRAMER_H_ 5 #ifndef NET_SPDY_SPDY_FRAMER_H_
6 #define NET_SPDY_SPDY_FRAMER_H_ 6 #define NET_SPDY_SPDY_FRAMER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 // On failure, returns NULL. 379 // On failure, returns NULL.
380 SpdyFrame* CompressFrame(const SpdyFrame& frame); 380 SpdyFrame* CompressFrame(const SpdyFrame& frame);
381 381
382 // Create a copy of a frame. 382 // Create a copy of a frame.
383 // Returned frame must be freed with "delete". 383 // Returned frame must be freed with "delete".
384 SpdyFrame* DuplicateFrame(const SpdyFrame& frame); 384 SpdyFrame* DuplicateFrame(const SpdyFrame& frame);
385 385
386 // Returns true if a frame could be compressed. 386 // Returns true if a frame could be compressed.
387 bool IsCompressible(const SpdyFrame& frame) const; 387 bool IsCompressible(const SpdyFrame& frame) const;
388 388
389 // Returns a new SpdyControlFrame with the compressed payload of |frame|.
390 SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame);
391
392 // Get the minimum size of the control frame for the given control frame 389 // Get the minimum size of the control frame for the given control frame
393 // type. This is useful for validating frame blocks. 390 // type. This is useful for validating frame blocks.
394 static size_t GetMinimumControlFrameSize(int version, SpdyControlType type); 391 static size_t GetMinimumControlFrameSize(int version, SpdyControlType type);
395 392
396 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and 393 // Get the stream ID for the given control frame (SYN_STREAM, SYN_REPLY, and
397 // HEADERS). If the control frame is NULL or of another type, this 394 // HEADERS). If the control frame is NULL or of another type, this
398 // function returns kInvalidStream. 395 // function returns kInvalidStream.
399 static SpdyStreamId GetControlFrameStreamId( 396 static SpdyStreamId GetControlFrameStreamId(
400 const SpdyControlFrame* control_frame); 397 const SpdyControlFrame* control_frame);
401 398
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len, 487 size_t UpdateCurrentFrameBuffer(const char** data, size_t* len,
491 size_t max_bytes); 488 size_t max_bytes);
492 489
493 // Retrieve serialized length of SpdyHeaderBlock. 490 // Retrieve serialized length of SpdyHeaderBlock.
494 size_t GetSerializedLength(const SpdyHeaderBlock* headers) const; 491 size_t GetSerializedLength(const SpdyHeaderBlock* headers) const;
495 492
496 // Serializes a SpdyHeaderBlock. 493 // Serializes a SpdyHeaderBlock.
497 void WriteHeaderBlock(SpdyFrameBuilder* frame, 494 void WriteHeaderBlock(SpdyFrameBuilder* frame,
498 const SpdyHeaderBlock* headers) const; 495 const SpdyHeaderBlock* headers) const;
499 496
497 void WriteHeaderBlockToZ(const SpdyHeaderBlock* headers,
498 z_stream* out) const;
499
500 // Set the error code and moves the framer into the error state. 500 // Set the error code and moves the framer into the error state.
501 void set_error(SpdyError error); 501 void set_error(SpdyError error);
502 502
503 // Given a frame, breakdown the variable payload length, the static header 503 // Given a frame, breakdown the variable payload length, the static header
504 // header length, and variable payload pointer. 504 // header length, and variable payload pointer.
505 bool GetFrameBoundaries(const SpdyFrame& frame, int* payload_length, 505 bool GetFrameBoundaries(const SpdyFrame& frame, int* payload_length,
506 int* header_length, const char** payload) const; 506 int* header_length, const char** payload) const;
507 507
508 // Returns a new SpdyControlFrame with the compressed payload of |frame|.
509 SpdyControlFrame* CompressControlFrame(const SpdyControlFrame& frame,
510 const SpdyHeaderBlock* headers);
511
508 // The size of the control frame buffer. 512 // The size of the control frame buffer.
509 // Since this is only used for control frame headers, the maximum control 513 // Since this is only used for control frame headers, the maximum control
510 // frame header size (SYN_STREAM) is sufficient; all remaining control 514 // frame header size (SYN_STREAM) is sufficient; all remaining control
511 // frame data is streamed to the visitor. 515 // frame data is streamed to the visitor.
512 static const size_t kControlFrameBufferSize; 516 static const size_t kControlFrameBufferSize;
513 517
514 // The maximum size of the control frames that we support. 518 // The maximum size of the control frames that we support.
515 // This limit is arbitrary. We can enforce it here or at the application 519 // This limit is arbitrary. We can enforce it here or at the application
516 // layer. We chose the framing layer, but this can be changed (or removed) 520 // layer. We chose the framing layer, but this can be changed (or removed)
517 // if necessary later down the line. 521 // if necessary later down the line.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 // starts with HTTP. If it does, we likely have an HTTP response. This 570 // starts with HTTP. If it does, we likely have an HTTP response. This
567 // isn't guaranteed though: we could have gotten a settings frame and then 571 // isn't guaranteed though: we could have gotten a settings frame and then
568 // corrupt data that just looks like HTTP, but deterministic checking requires 572 // corrupt data that just looks like HTTP, but deterministic checking requires
569 // a lot more state. 573 // a lot more state.
570 bool probable_http_response_; 574 bool probable_http_response_;
571 }; 575 };
572 576
573 } // namespace net 577 } // namespace net
574 578
575 #endif // NET_SPDY_SPDY_FRAMER_H_ 579 #endif // NET_SPDY_SPDY_FRAMER_H_
OLDNEW
« no previous file with comments | « net/spdy/buffered_spdy_framer.cc ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698