proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
HeaderIndexingStrategy.cpp
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
#include <
proxygen/lib/http/codec/compress/HeaderIndexingStrategy.h
>
11
12
namespace
proxygen
{
13
14
const
HeaderIndexingStrategy
*
HeaderIndexingStrategy::getDefaultInstance
() {
15
static
const
HeaderIndexingStrategy
* instance =
new
HeaderIndexingStrategy
();
16
return
instance;
17
}
18
19
bool
HeaderIndexingStrategy::indexHeader
(
const
HPACKHeader
& header)
const
{
20
// Handle all the cases where we want to return false in the switch statement
21
// below; else let the code fall through and return true
22
switch
(header.
name
.
getHeaderCode
()) {
23
case
HTTP_HEADER_COLON_PATH
:
24
if
(header.
value
.
find
(
'='
) != std::string::npos) {
25
return
false
;
26
}
27
if
(header.
value
.
find
(
"jpg"
) != std::string::npos) {
28
return
false
;
29
}
30
break
;
31
32
// The wrapped header should never be HTTP_HEADER_NONE but for completeness
33
// the condition is included below
34
case
HTTP_HEADER_NONE
:
35
case
HTTP_HEADER_CONTENT_LENGTH
:
36
case
HTTP_HEADER_IF_MODIFIED_SINCE
:
37
case
HTTP_HEADER_LAST_MODIFIED
:
38
return
false
;
39
40
default
:
41
break
;
42
}
43
44
return
true
;
45
}
46
47
}
proxygen::HeaderIndexingStrategy
Definition:
HeaderIndexingStrategy.h:16
proxygen::HPACKHeaderName::getHeaderCode
HTTPHeaderCode getHeaderCode() const
Definition:
HPACKHeaderName.h:114
proxygen::HeaderIndexingStrategy::HeaderIndexingStrategy
HeaderIndexingStrategy()
Definition:
HeaderIndexingStrategy.h:24
proxygen::HTTP_HEADER_COLON_PATH
Definition:
HTTPCommonHeaders.h:125
proxygen::HTTP_HEADER_IF_MODIFIED_SINCE
Definition:
HTTPCommonHeaders.h:76
proxygen::HTTP_HEADER_NONE
Definition:
HTTPCommonHeaders.h:24
proxygen::HPACKHeader
Definition:
HPACKHeader.h:20
proxygen::HTTP_HEADER_CONTENT_LENGTH
Definition:
HTTPCommonHeaders.h:49
proxygen::HeaderIndexingStrategy::indexHeader
virtual bool indexHeader(const HPACKHeader &header) const
Definition:
HeaderIndexingStrategy.cpp:19
proxygen::HPACKHeader::name
HPACKHeaderName name
Definition:
HPACKHeader.h:82
folly::basic_fbstring::find
size_type find(const basic_fbstring &str, size_type pos=0) const
Definition:
FBString.h:1724
proxygen::HeaderIndexingStrategy::getDefaultInstance
static const HeaderIndexingStrategy * getDefaultInstance()
Definition:
HeaderIndexingStrategy.cpp:14
proxygen::HTTP_HEADER_LAST_MODIFIED
Definition:
HTTPCommonHeaders.h:68
proxygen::HPACKHeader::value
folly::fbstring value
Definition:
HPACKHeader.h:83
proxygen
Definition:
ExMessageHandler.h:14
HeaderIndexingStrategy.h
proxygen
lib
http
codec
compress
HeaderIndexingStrategy.cpp
Generated by
1.8.11