From b52f96d38a5c32b692ecbfbd4c25c49aa684232b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Mon, 26 Dec 2022 17:10:04 +0900 Subject: [PATCH] Remove unused function --- src/shrpx-unittest.cc | 2 -- src/util.cc | 16 ---------------- src/util.h | 3 --- src/util_test.cc | 5 ----- src/util_test.h | 1 - 5 files changed, 27 deletions(-) diff --git a/src/shrpx-unittest.cc b/src/shrpx-unittest.cc index 35108529..8c357978 100644 --- a/src/shrpx-unittest.cc +++ b/src/shrpx-unittest.cc @@ -152,8 +152,6 @@ int main(int argc, char *argv[]) { !CU_add_test(pSuite, "util_to_token68", shrpx::test_util_to_token68) || !CU_add_test(pSuite, "util_percent_encode_token", shrpx::test_util_percent_encode_token) || - !CU_add_test(pSuite, "util_percent_encode_path", - shrpx::test_util_percent_encode_path) || !CU_add_test(pSuite, "util_percent_decode", shrpx::test_util_percent_decode) || !CU_add_test(pSuite, "util_quote_string", diff --git a/src/util.cc b/src/util.cc index 78c8c859..06b6e292 100644 --- a/src/util.cc +++ b/src/util.cc @@ -135,22 +135,6 @@ std::string percent_encode(const std::string &target) { target.size()); } -std::string percent_encode_path(const std::string &s) { - std::string dest; - for (auto c : s) { - if (in_rfc3986_unreserved_chars(c) || in_rfc3986_sub_delims(c) || - c == '/') { - dest += c; - continue; - } - - dest += '%'; - dest += UPPER_XDIGITS[(c >> 4) & 0x0f]; - dest += UPPER_XDIGITS[(c & 0x0f)]; - } - return dest; -} - bool in_token(char c) { static constexpr char extra[] = {'!', '#', '$', '%', '&', '\'', '*', '+', '-', '.', '^', '_', '`', '|', '~'}; diff --git a/src/util.h b/src/util.h index f17154ec..a53f77fc 100644 --- a/src/util.h +++ b/src/util.h @@ -106,9 +106,6 @@ std::string percent_encode(const unsigned char *target, size_t len); std::string percent_encode(const std::string &target); -// percent-encode path component of URI |s|. -std::string percent_encode_path(const std::string &s); - template std::string percent_decode(InputIt first, InputIt last) { std::string result; diff --git a/src/util_test.cc b/src/util_test.cc index 6c31e157..0ac0f1de 100644 --- a/src/util_test.cc +++ b/src/util_test.cc @@ -144,11 +144,6 @@ void test_util_percent_encode_token(void) { util::percent_encode_token(balloc, StringRef::from_lit("http 2"))); } -void test_util_percent_encode_path(void) { - CU_ASSERT("/foo1/bar%3F&/%0A" == util::percent_encode_path("/foo1/bar?&/" - "\x0a")); -} - void test_util_percent_decode(void) { { std::string s = "%66%6F%6f%62%61%72"; diff --git a/src/util_test.h b/src/util_test.h index 9c12e9f1..48925ab2 100644 --- a/src/util_test.h +++ b/src/util_test.h @@ -37,7 +37,6 @@ void test_util_inp_strlower(void); void test_util_to_base64(void); void test_util_to_token68(void); void test_util_percent_encode_token(void); -void test_util_percent_encode_path(void); void test_util_percent_decode(void); void test_util_quote_string(void); void test_util_utox(void);