Commit 9672bc32 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

src: Remove unused functions

parent b68be1e1
...@@ -768,51 +768,6 @@ void index_header(HeaderIndex &hdidx, int32_t token, size_t idx) { ...@@ -768,51 +768,6 @@ void index_header(HeaderIndex &hdidx, int32_t token, size_t idx) {
hdidx[token] = idx; hdidx[token] = idx;
} }
bool check_http2_request_pseudo_header(const HeaderIndex &hdidx,
int32_t token) {
switch (token) {
case HD__AUTHORITY:
case HD__METHOD:
case HD__PATH:
case HD__SCHEME:
return hdidx[token] == -1;
default:
return false;
}
}
bool check_http2_response_pseudo_header(const HeaderIndex &hdidx,
int32_t token) {
switch (token) {
case HD__STATUS:
return hdidx[token] == -1;
default:
return false;
}
}
bool http2_header_allowed(int32_t token) {
switch (token) {
case HD_CONNECTION:
case HD_KEEP_ALIVE:
case HD_PROXY_CONNECTION:
case HD_TRANSFER_ENCODING:
case HD_UPGRADE:
return false;
default:
return true;
}
}
bool http2_mandatory_request_headers_presence(const HeaderIndex &hdidx) {
if (hdidx[HD__METHOD] == -1 || hdidx[HD__PATH] == -1 ||
hdidx[HD__SCHEME] == -1 ||
(hdidx[HD__AUTHORITY] == -1 && hdidx[HD_HOST] == -1)) {
return false;
}
return true;
}
const Headers::value_type *get_header(const HeaderIndex &hdidx, int32_t token, const Headers::value_type *get_header(const HeaderIndex &hdidx, int32_t token,
const Headers &nva) { const Headers &nva) {
auto i = hdidx[token]; auto i = hdidx[token];
......
...@@ -279,23 +279,6 @@ void init_hdidx(HeaderIndex &hdidx); ...@@ -279,23 +279,6 @@ void init_hdidx(HeaderIndex &hdidx);
// Indexes header |token| using index |idx|. // Indexes header |token| using index |idx|.
void index_header(HeaderIndex &hdidx, int32_t token, size_t idx); void index_header(HeaderIndex &hdidx, int32_t token, size_t idx);
// Returns true if HTTP/2 request pseudo header |token| is not indexed
// yet and not -1.
bool check_http2_request_pseudo_header(const HeaderIndex &hdidx, int32_t token);
// Returns true if HTTP/2 response pseudo header |token| is not
// indexed yet and not -1.
bool check_http2_response_pseudo_header(const HeaderIndex &hdidx,
int32_t token);
// Returns true if header field denoted by |token| is allowed for
// HTTP/2.
bool http2_header_allowed(int32_t token);
// Returns true that |hdidx| contains mandatory HTTP/2 request
// headers.
bool http2_mandatory_request_headers_presence(const HeaderIndex &hdidx);
// Returns header denoted by |token| using index |hdidx|. // Returns header denoted by |token| using index |hdidx|.
const Headers::value_type *get_header(const HeaderIndex &hdidx, int32_t token, const Headers::value_type *get_header(const HeaderIndex &hdidx, int32_t token,
const Headers &nva); const Headers &nva);
......
...@@ -271,53 +271,6 @@ void test_http2_lookup_token(void) { ...@@ -271,53 +271,6 @@ void test_http2_lookup_token(void) {
CU_ASSERT(http2::HD_EXPECT == http2::lookup_token("expect")); CU_ASSERT(http2::HD_EXPECT == http2::lookup_token("expect"));
} }
void test_http2_check_http2_pseudo_header(void) {
http2::HeaderIndex hdidx;
http2::init_hdidx(hdidx);
CU_ASSERT(http2::check_http2_request_pseudo_header(hdidx, http2::HD__METHOD));
hdidx[http2::HD__PATH] = 0;
CU_ASSERT(http2::check_http2_request_pseudo_header(hdidx, http2::HD__METHOD));
hdidx[http2::HD__METHOD] = 1;
CU_ASSERT(
!http2::check_http2_request_pseudo_header(hdidx, http2::HD__METHOD));
CU_ASSERT(!http2::check_http2_request_pseudo_header(hdidx, http2::HD_VIA));
http2::init_hdidx(hdidx);
CU_ASSERT(
http2::check_http2_response_pseudo_header(hdidx, http2::HD__STATUS));
hdidx[http2::HD__STATUS] = 0;
CU_ASSERT(
!http2::check_http2_response_pseudo_header(hdidx, http2::HD__STATUS));
CU_ASSERT(!http2::check_http2_response_pseudo_header(hdidx, http2::HD_VIA));
}
void test_http2_http2_header_allowed(void) {
CU_ASSERT(http2::http2_header_allowed(http2::HD__PATH));
CU_ASSERT(http2::http2_header_allowed(http2::HD_CONTENT_LENGTH));
CU_ASSERT(!http2::http2_header_allowed(http2::HD_CONNECTION));
}
void test_http2_mandatory_request_headers_presence(void) {
http2::HeaderIndex hdidx;
http2::init_hdidx(hdidx);
CU_ASSERT(!http2::http2_mandatory_request_headers_presence(hdidx));
hdidx[http2::HD__AUTHORITY] = 0;
CU_ASSERT(!http2::http2_mandatory_request_headers_presence(hdidx));
hdidx[http2::HD__METHOD] = 1;
CU_ASSERT(!http2::http2_mandatory_request_headers_presence(hdidx));
hdidx[http2::HD__PATH] = 2;
CU_ASSERT(!http2::http2_mandatory_request_headers_presence(hdidx));
hdidx[http2::HD__SCHEME] = 3;
CU_ASSERT(http2::http2_mandatory_request_headers_presence(hdidx));
hdidx[http2::HD__AUTHORITY] = -1;
hdidx[http2::HD_HOST] = 0;
CU_ASSERT(http2::http2_mandatory_request_headers_presence(hdidx));
}
void test_http2_parse_link_header(void) { void test_http2_parse_link_header(void) {
{ {
// only URI appears; we don't extract URI unless it bears rel=preload // only URI appears; we don't extract URI unless it bears rel=preload
......
...@@ -40,9 +40,6 @@ void test_http2_rewrite_location_uri(void); ...@@ -40,9 +40,6 @@ void test_http2_rewrite_location_uri(void);
void test_http2_parse_http_status_code(void); void test_http2_parse_http_status_code(void);
void test_http2_index_header(void); void test_http2_index_header(void);
void test_http2_lookup_token(void); void test_http2_lookup_token(void);
void test_http2_check_http2_pseudo_header(void);
void test_http2_http2_header_allowed(void);
void test_http2_mandatory_request_headers_presence(void);
void test_http2_parse_link_header(void); void test_http2_parse_link_header(void);
void test_http2_path_join(void); void test_http2_path_join(void);
void test_http2_normalize_path(void); void test_http2_normalize_path(void);
......
...@@ -89,12 +89,6 @@ int main(int argc, char *argv[]) { ...@@ -89,12 +89,6 @@ int main(int argc, char *argv[]) {
shrpx::test_http2_index_header) || shrpx::test_http2_index_header) ||
!CU_add_test(pSuite, "http2_lookup_token", !CU_add_test(pSuite, "http2_lookup_token",
shrpx::test_http2_lookup_token) || shrpx::test_http2_lookup_token) ||
!CU_add_test(pSuite, "http2_check_http2_pseudo_header",
shrpx::test_http2_check_http2_pseudo_header) ||
!CU_add_test(pSuite, "http2_http2_header_allowed",
shrpx::test_http2_http2_header_allowed) ||
!CU_add_test(pSuite, "http2_mandatory_request_headers_presence",
shrpx::test_http2_mandatory_request_headers_presence) ||
!CU_add_test(pSuite, "http2_parse_link_header", !CU_add_test(pSuite, "http2_parse_link_header",
shrpx::test_http2_parse_link_header) || shrpx::test_http2_parse_link_header) ||
!CU_add_test(pSuite, "http2_path_join", shrpx::test_http2_path_join) || !CU_add_test(pSuite, "http2_path_join", shrpx::test_http2_path_join) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment