28 0, 0, 0, 0, 0, 0, 0, 0,
30 0, 0, 0, 0, 0, 0, 0, 0,
32 0, 0, 0, 0, 0, 0, 0, 0,
34 0, 0, 0, 0, 0, 0, 0, 0,
36 ' ',
'!',
'"',
'#',
'$',
'%',
'&',
'\'',
38 0, 0,
'*',
'+', 0,
'-',
'.',
'/',
40 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
42 '8',
'9', 0, 0, 0, 0, 0, 0,
44 0,
'a',
'b',
'c',
'd',
'e',
'f',
'g',
46 'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
48 'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
50 'x',
'y',
'z', 0, 0, 0,
'^',
'_',
52 '`',
'a',
'b',
'c',
'd',
'e',
'f',
'g',
54 'h',
'i',
'j',
'k',
'l',
'm',
'n',
'o',
56 'p',
'q',
'r',
's',
't',
'u',
'v',
'w',
58 'x',
'y',
'z', 0,
'|',
'}',
'~', 0
68 for (
const auto& encodingQ: *output) {
70 std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower);
72 if (lower ==
"gzip" && encodingQ.second >= 0.001) {
74 }
else if (lower ==
"deflate" && encodingQ.second >= 0.001) {
78 return hasGzip && hasDeflate;
84 std::vector<std::string>& temps) {
85 std::vector<compress::Header> allHeaders;
115 temps.emplace_back(folly::to<std::string>(msg.
getStatusCode()));
132 std::vector<compress::Header>& headers,
134 bool headerToCheckExists =
false;
140 static const std::bitset<256> s_perHopHeaderCodes{[] {
154 if (s_perHopHeaderCodes[code] || name.size() == 0 || name[0] ==
':') {
155 DCHECK_GT(name.size(), 0) <<
"Empty header";
156 DCHECK_NE(name[0],
':') <<
"Invalid header=" <<
name;
163 DCHECK(name !=
"TE" || value ==
"trailers");
165 headers.emplace_back(code, name, value);
167 if (code == headerToCheck) {
168 headerToCheckExists =
true;
172 return headerToCheckExists;
static std::vector< compress::Header > prepareMessageForCompression(const HTTPMessage &msg, std::vector< std::string > &temps)
uint16_t getStatusCode() const
static std::string formatDateHeader()
PUSHMI_INLINE_VAR constexpr detail::transform_fn transform
const std::string & methodToString(HTTPMethod method)
static const char http_tokens[256]
static const char *const value
HTTPHeaders & getHeaders()
const std::string & getMethodString() const
static bool appendHeaders(const HTTPHeaders &inputHeaders, std::vector< compress::Header > &headers, HTTPHeaderCode headerToCheck)
folly::Optional< HTTPMethod > getMethod() const
const std::string & getURL() const
bool isEgressWebsocketUpgrade() const
bool parseQvalues(folly::StringPiece value, std::vector< TokenQPair > &output)
static bool hasGzipAndDeflate(const std::string &value, bool &hasGzip, bool &hasDeflate)