proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
GzipHeaderCodec.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015-present, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
*/
10
#pragma once
11
12
#include <
folly/Expected.h
>
13
#include <
folly/ThreadLocal.h
>
14
#include <
folly/io/Cursor.h
>
15
#include <
folly/io/IOBuf.h
>
16
#include <map>
17
#include <memory>
18
#include <
proxygen/lib/http/codec/SPDYVersionSettings.h
>
19
#include <
proxygen/lib/http/codec/compress/HeaderCodec.h
>
20
#include <zlib.h>
21
22
namespace
proxygen
{
23
24
enum class
GzipDecodeError
:
uint8_t
{
25
NONE
= 0,
26
BAD_ENCODING
= 1,
27
HEADERS_TOO_LARGE
= 2,
28
INFLATE_DICTIONARY
= 3,
29
EMPTY_HEADER_NAME
= 4,
30
EMPTY_HEADER_VALUE
= 5,
31
INVALID_HEADER_VALUE
= 6
32
};
33
34
class
GzipHeaderCodec
:
public
HeaderCodec
{
35
36
public
:
37
GzipHeaderCodec
(
int
compressionLevel,
38
const
SPDYVersionSettings
& versionSettings);
39
explicit
GzipHeaderCodec
(
int
compressionLevel,
40
SPDYVersion
version
=
SPDYVersion::SPDY3_1
);
41
~
GzipHeaderCodec
()
override
;
42
43
std::unique_ptr<folly::IOBuf>
encode
(
44
std::vector<compress::Header>& headers)
noexcept
;
45
46
folly::Expected<HeaderDecodeResult, GzipDecodeError>
47
decode
(
folly::io::Cursor
& cursor,
uint32_t
length)
noexcept
;
48
52
const
HTTPHeaderSize
&
getDecodedSize
() {
53
return
decodedSize_;
54
}
55
56
private
:
57
folly::IOBuf
& getHeaderBuf();
58
62
folly::Expected<size_t, GzipDecodeError>
63
parseNameValues(
const
folly::IOBuf
& uncompressed,
64
uint32_t
uncompressedLength)
noexcept
;
65
66
const
SPDYVersionSettings
&
versionSettings_
;
67
z_stream
deflater_
;
68
z_stream
inflater_
;
69
compress::HeaderPieceList
outHeaders_
;
70
HTTPHeaderSize
decodedSize_
;
71
};
72
}
folly::IOBuf
Definition:
IOBuf.h:221
proxygen::SPDYVersionSettings
Definition:
SPDYVersionSettings.h:24
proxygen::GzipHeaderCodec::inflater_
z_stream inflater_
Definition:
GzipHeaderCodec.h:68
encode
unique_ptr< IOBuf > encode(vector< HPACKHeader > &headers, HPACKEncoder &encoder)
Definition:
HPACKBenchmark.cpp:22
proxygen::GzipDecodeError::INFLATE_DICTIONARY
IOBuf.h
fizz::decode
TokenBindingMessage decode(folly::io::Cursor &cursor)
Definition:
Types.cpp:132
proxygen::GzipDecodeError::EMPTY_HEADER_VALUE
proxygen::GzipHeaderCodec::deflater_
z_stream deflater_
Definition:
GzipHeaderCodec.h:67
proxygen::GzipHeaderCodec::versionSettings_
const SPDYVersionSettings & versionSettings_
Definition:
GzipHeaderCodec.h:66
proxygen::GzipDecodeError
GzipDecodeError
Definition:
GzipHeaderCodec.h:24
proxygen::HeaderCodec
Definition:
HeaderCodec.h:35
folly::pushmi::__adl::noexcept
requires E e noexcept(noexcept(s.error(std::move(e))))
Definition:
extension_points.h:40
Cursor.h
proxygen::GzipDecodeError::EMPTY_HEADER_NAME
folly::Expected
Definition:
Expected.h:78
proxygen::SPDYVersion
SPDYVersion
Definition:
SPDYVersion.h:14
folly::io::Cursor
Definition:
Cursor.h:721
version
ProtocolVersion version
Definition:
ClientProtocol.cpp:1005
ThreadLocal.h
proxygen::compress::HeaderPieceList
std::deque< HeaderPiece > HeaderPieceList
Definition:
HeaderPiece.h:59
proxygen::GzipDecodeError::NONE
uint8_t
uint8_t
Definition:
ConstexprMathBenchmark.cpp:178
proxygen::GzipHeaderCodec
Definition:
GzipHeaderCodec.h:34
Expected.h
wangle::HTTPHeaderSize
Definition:
TransportInfo.h:38
proxygen::GzipHeaderCodec::decodedSize_
HTTPHeaderSize decodedSize_
Definition:
GzipHeaderCodec.h:70
proxygen::GzipHeaderCodec::outHeaders_
compress::HeaderPieceList outHeaders_
Definition:
GzipHeaderCodec.h:69
proxygen::GzipDecodeError::BAD_ENCODING
proxygen
Definition:
ExMessageHandler.h:14
uint32_t
uint32_t
Definition:
ConstexprMathBenchmark.cpp:186
proxygen::GzipDecodeError::HEADERS_TOO_LARGE
proxygen::SPDYVersion::SPDY3_1
proxygen::GzipHeaderCodec::getDecodedSize
const HTTPHeaderSize & getDecodedSize()
Definition:
GzipHeaderCodec.h:52
SPDYVersionSettings.h
HeaderCodec.h
proxygen::GzipDecodeError::INVALID_HEADER_VALUE
proxygen
lib
http
codec
compress
GzipHeaderCodec.h
Generated by
1.8.11