From a9cfe96ae5892b36d536d94d69ef960cde4ed920 Mon Sep 17 00:00:00 2001 From: Keeyou Date: Sun, 19 May 2024 14:51:51 +0800 Subject: [PATCH] net-proxy/yass: add 1.10.1 and 1.9.6 --- net-proxy/yass/Manifest | 4 +- net-proxy/yass/files/boringssl-gcc-14.patch | 22 -- net-proxy/yass/files/libcxx-gcc-14.patch | 27 ++- net-proxy/yass/files/telegram-http-proxy-fix.patch | 226 --------------------- .../{yass-1.10.0-r1.ebuild => yass-1.10.1.ebuild} | 1 - .../{yass-1.9.5-r2.ebuild => yass-1.9.6.ebuild} | 2 - 6 files changed, 22 insertions(+), 260 deletions(-) rewrite net-proxy/yass/Manifest (100%) delete mode 100644 net-proxy/yass/files/boringssl-gcc-14.patch delete mode 100644 net-proxy/yass/files/telegram-http-proxy-fix.patch rename net-proxy/yass/{yass-1.10.0-r1.ebuild => yass-1.10.1.ebuild} (96%) rename net-proxy/yass/{yass-1.9.5-r2.ebuild => yass-1.9.6.ebuild} (93%) diff --git a/net-proxy/yass/Manifest b/net-proxy/yass/Manifest dissimilarity index 100% index 29a4b9c41..328692af6 100644 --- a/net-proxy/yass/Manifest +++ b/net-proxy/yass/Manifest @@ -1,2 +1,2 @@ -DIST yass-1.10.0.tar.bz2 75271531 BLAKE2B 5db85439c276b4ff05b548e6bac72f0ec8ec95e4156d639ae6b485a1fd45f63a861e09d9fcc3380b4be2a26384180094638d220d8683e57293ef6428f961b941 SHA512 5937c1335ec4a69854254e69df00173883a1c1f008357af1bf7f1242edb76f8c2a41222f5fa5fa369b4f5f55e06a866449b079d49bdbfe90ae7348d800509f47 -DIST yass-1.9.5.tar.bz2 75492963 BLAKE2B 891c09d93f47d4400369ccfd4c6ac2cc17b2a7a3ed9f6efcfa556e245784f96976bca33fc7760ac231b892af94be80c66b603a2b0cb05d94773a091ba79941eb SHA512 bd6c5b9e0697fb16f48869e6836d8b3ec0ca1ebfcedad76dae0df8aea998abc0eb7fa389157fd6038983da522de3eb946e6e2560255660866b774c8f56cf4534 +DIST yass-1.10.1.tar.bz2 75263434 BLAKE2B 1194f84849ae8a84c58e89b459f0902948e494fdeb858f12f5cab582d4b809c4ca1c6ca99c79a00f470115fac9d69c211216981808af2f86eb9451ccc6d7f20c SHA512 6a4a05ec9b911f8594f0607ad5d3849662565d74f84c511edac98eff2b9c1da56ebcddbabd44f70c4afd8f4fce704bde40833e8703a0ff1dfbbfe646191f4245 +DIST yass-1.9.6.tar.bz2 75457346 BLAKE2B 25ac8a78b0984cf9315c5fda1811a127e5292600cc65cfd766832554eb218a2c0fa4c873ef33ba4d057fc5adc53b745eb5345f4eb27912bc7eb8b73b216bb775 SHA512 24f2f2c36948d33bb0a9c3c50a12aa570c47cc5e5cc1f0684c6a0dea4e729d570adb0dc31634d79e2c73bf1d43bce0cb35796baf67a434436ce47729e8b363f9 diff --git a/net-proxy/yass/files/boringssl-gcc-14.patch b/net-proxy/yass/files/boringssl-gcc-14.patch deleted file mode 100644 index 366e21f45..000000000 --- a/net-proxy/yass/files/boringssl-gcc-14.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/third_party/boringssl/src/crypto/internal.h b/third_party/boringssl/src/crypto/internal.h -index 762eaae8c..27652fbe9 100644 ---- a/third_party/boringssl/src/crypto/internal.h -+++ b/third_party/boringssl/src/crypto/internal.h -@@ -1201,7 +1201,7 @@ static inline uint64_t CRYPTO_rotr_u64(uint64_t value, int shift) { - - // CRYPTO_addc_* returns |x + y + carry|, and sets |*out_carry| to the carry - // bit. |carry| must be zero or one. --#if OPENSSL_HAS_BUILTIN(__builtin_addc) -+#if OPENSSL_HAS_BUILTIN(__builtin_addc) && !defined(__cplusplus) - - #define CRYPTO_GENERIC_ADDC(x, y, carry, out_carry) \ - (_Generic((x), \ -@@ -1253,7 +1253,7 @@ static inline uint64_t CRYPTO_addc_u64(uint64_t x, uint64_t y, uint64_t carry, - - // CRYPTO_subc_* returns |x - y - borrow|, and sets |*out_borrow| to the borrow - // bit. |borrow| must be zero or one. --#if OPENSSL_HAS_BUILTIN(__builtin_subc) -+#if OPENSSL_HAS_BUILTIN(__builtin_subc) && !defined(__cplusplus) - - #define CRYPTO_GENERIC_SUBC(x, y, borrow, out_borrow) \ - (_Generic((x), \ diff --git a/net-proxy/yass/files/libcxx-gcc-14.patch b/net-proxy/yass/files/libcxx-gcc-14.patch index e0fb00c20..9474312ed 100644 --- a/net-proxy/yass/files/libcxx-gcc-14.patch +++ b/net-proxy/yass/files/libcxx-gcc-14.patch @@ -1,13 +1,26 @@ diff --git a/third_party/libc++/trunk/include/__type_traits/remove_pointer.h b/third_party/libc++/trunk/include/__type_traits/remove_pointer.h -index 54390a193..c01eb3c37 100644 +index 54390a193..eea523ab2 100644 --- a/third_party/libc++/trunk/include/__type_traits/remove_pointer.h +++ b/third_party/libc++/trunk/include/__type_traits/remove_pointer.h -@@ -17,7 +17,7 @@ +@@ -22,9 +22,6 @@ template + struct remove_pointer { + using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); + }; +- +-template +-using __remove_pointer_t = __remove_pointer(_Tp); + #else + // clang-format off + template struct _LIBCPP_TEMPLATE_VIS remove_pointer {typedef _LIBCPP_NODEBUG _Tp type;}; +@@ -33,10 +30,10 @@ template struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const> + template struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; + template struct _LIBCPP_TEMPLATE_VIS remove_pointer<_Tp* const volatile> {typedef _LIBCPP_NODEBUG _Tp type;}; + // clang-format on ++#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) - _LIBCPP_BEGIN_NAMESPACE_STD + template + using __remove_pointer_t = typename remove_pointer<_Tp>::type; +-#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) --#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) -+#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) && !defined(_LIBCPP_GCC_VER) + #if _LIBCPP_STD_VER >= 14 template - struct remove_pointer { - using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); diff --git a/net-proxy/yass/files/telegram-http-proxy-fix.patch b/net-proxy/yass/files/telegram-http-proxy-fix.patch deleted file mode 100644 index 5d59aef3b..000000000 --- a/net-proxy/yass/files/telegram-http-proxy-fix.patch +++ /dev/null @@ -1,226 +0,0 @@ -diff --git a/src/cli/cli_connection.cpp b/src/cli/cli_connection.cpp -index 6384629d..aae9f7e2 100644 ---- a/src/cli/cli_connection.cpp -+++ b/src/cli/cli_connection.cpp -@@ -708,6 +708,8 @@ asio::error_code CliConnection::OnReadHttpRequest(std::shared_ptr buf) { - << " http: " << std::string(reinterpret_cast(buf->data()), nparsed); - } - -+ http_is_keep_alive_ = false; -+ - if (ok) { - buf->trimStart(nparsed); - buf->retreat(nparsed); -@@ -722,7 +724,10 @@ asio::error_code CliConnection::OnReadHttpRequest(std::shared_ptr buf) { - buf->reserve(header.size(), 0); - buf->prepend(header.size()); - memcpy(buf->mutable_data(), header.c_str(), header.size()); -- VLOG(3) << "Connection (client) " << connection_id() << " Host: " << http_host_ << " PORT: " << http_port_; -+ http_is_keep_alive_ = absl::AsciiStrToLower(parser.connection()) == "keep-alive"; -+ http_keep_alive_remaining_bytes_ += parser.content_length() + header.size() - buf->length(); -+ VLOG(3) << "Connection (client) " << connection_id() << " Host: " << http_host_ << " PORT: " << http_port_ -+ << " KEEPALIVE: " << std::boolalpha << http_is_keep_alive_; - } else { - VLOG(3) << "Connection (client) " << connection_id() << " CONNECT: " << http_host_ << " PORT: " << http_port_; - } -@@ -1614,6 +1619,20 @@ std::shared_ptr CliConnection::GetNextUpstreamBuf(asio::error_code& ec, s - return nullptr; - } - -+ if (http_is_keep_alive_) { -+ if (http_keep_alive_remaining_bytes_ < (int64_t)read) { -+ VLOG(1) << "Connection (client) " << connection_id() << " reused for keep-alive connection"; -+ // currently, we assume the host doesn't change -+ ec = OnReadHttpRequest(buf); -+ SetState(state_stream); -+ if (ec) { -+ return nullptr; -+ } -+ } else { -+ http_keep_alive_remaining_bytes_ -= read; -+ } -+ } -+ - #ifdef HAVE_QUICHE - if (adapter_) { - if (!data_frame_) { -@@ -2129,7 +2148,7 @@ void CliConnection::connected() { - std::string hdr = absl::StrFormat( - "CONNECT %s HTTP/1.1\r\n" - "Host: %s\r\n" -- "Proxy-Connection: Keep-Alive\r\n" -+ "Proxy-Connection: Close\r\n" - "\r\n", - hostname_and_port.c_str(), hostname_and_port.c_str()); - // write variable address directly as https header -diff --git a/src/cli/cli_connection.hpp b/src/cli/cli_connection.hpp -index e207b053..75a58c53 100644 ---- a/src/cli/cli_connection.hpp -+++ b/src/cli/cli_connection.hpp -@@ -348,6 +348,10 @@ class CliConnection : public RefCountedThreadSafe, - bool http_is_connect_ = false; - /// copy of connect response - static const std::string_view http_connect_reply_; -+ /// copy of keep alive state -+ bool http_is_keep_alive_ = false; -+ /// copy of remaining bytes in keep alive cycle -+ int64_t http_keep_alive_remaining_bytes_ = 0; - - /// copy of upstream request - std::unique_ptr ss_request_; -diff --git a/src/net/http_parser.cpp b/src/net/http_parser.cpp -index 8c46ff9c..ce8e1adb 100644 ---- a/src/net/http_parser.cpp -+++ b/src/net/http_parser.cpp -@@ -49,6 +49,15 @@ static void ReforgeHttpRequestImpl(std::string* header, - if (key == "Proxy-Connection") { - continue; - } -+ if (key == "Proxy-Authorization") { -+ continue; -+ } -+ if (additional_headers) { -+ auto has_key = [&](const std::pair& rhs) { return rhs.first == key; }; -+ if (std::find_if(additional_headers->begin(), additional_headers->end(), has_key) != additional_headers->end()) { -+ continue; -+ } -+ } - ss << key << ": " << value << "\r\n"; - } - if (additional_headers) { -@@ -265,6 +274,9 @@ void HttpRequestParser::ProcessHeaders(const quiche::BalsaHeaders& headers) { - if (key == "Content-Type") { - content_type_ = std::string(value); - } -+ if (key == "Connection") { -+ connection_ = std::string(value); -+ } - } - } - -@@ -315,6 +327,11 @@ void HttpRequestParser::OnRequestFirstLineInput(std::string_view /*line_input*/, - error_message_ = "HPE_INVALID_VERSION"; - return; - } -+ if (version_input == "HTTP/1.1") { -+ connection_ = "Keep-Alive"; -+ } else { -+ connection_ = "Close"; -+ } - } - - void HttpRequestParser::OnResponseFirstLineInput(std::string_view /*line_input*/, -@@ -481,6 +498,12 @@ int HttpRequestParser::OnReadHttpRequestURL(http_parser* p, const char* buf, siz - } - self->http_is_connect_ = true; - } -+ -+ if (p->http_major == 1 && p->http_minor == 1) { -+ self->connection_ = "Keep-Alive"; -+ } else { -+ self->connection_ = "Close"; -+ } - return 0; - } - -@@ -526,6 +549,9 @@ int HttpRequestParser::OnReadHttpRequestHeaderValue(http_parser* parser, const c - if (self->http_field_ == "Content-Type") { - self->content_type_ = std::string(buf, len); - } -+ if (self->http_field_ == "Connection") { -+ self->connection_ = std::string(buf, len); -+ } - return 0; - } - -diff --git a/src/net/http_parser.hpp b/src/net/http_parser.hpp -index 94ef4893..8146cbac 100644 ---- a/src/net/http_parser.hpp -+++ b/src/net/http_parser.hpp -@@ -49,6 +49,7 @@ class HttpRequestParser : public quiche::BalsaVisitorInterface { - bool is_connect() const { return http_is_connect_; } - uint64_t content_length() const { return content_length_; } - const std::string& content_type() const { return content_type_; } -+ const std::string& connection() const { return connection_; } - - void ReforgeHttpRequest(std::string* header, - const absl::flat_hash_map* additional_headers = nullptr); -@@ -102,6 +103,8 @@ class HttpRequestParser : public quiche::BalsaVisitorInterface { - uint64_t content_length_ = 0; - /// copy of content type - std::string content_type_; -+ /// copy of connection -+ std::string connection_; - - bool first_byte_processed_ = false; - bool headers_done_ = false; -@@ -133,6 +136,7 @@ class HttpRequestParser { - bool is_connect() const { return http_is_connect_; } - uint64_t content_length() const { return content_length_; } - const std::string& content_type() const { return content_type_; } -+ const std::string& connection() const { return connection_; } - - int status_code() const; - -@@ -166,6 +170,8 @@ class HttpRequestParser { - uint64_t content_length_ = 0; - /// copy of content type - std::string content_type_; -+ /// copy of connection -+ std::string connection_; - }; - - class HttpResponseParser : public HttpRequestParser { -diff --git a/src/server/server_connection.cpp b/src/server/server_connection.cpp -index 68fd25a7..48f85b51 100644 ---- a/src/server/server_connection.cpp -+++ b/src/server/server_connection.cpp -@@ -626,19 +626,15 @@ void ServerConnection::OnReadHandshakeViaHttps() { - - if (!http_is_connect_) { - absl::flat_hash_map via_headers; -+ via_headers["Connection"s] = "Close"s; - if (!absl::GetFlag(FLAGS_hide_ip)) { -- asio::error_code ec; -- auto peer_endpoint = peer_endpoint_; -- if (ec) { -- LOG(WARNING) << "Failed to retrieve remote endpoint: " << ec; -- } - std::ostringstream ss; -- ss << "for=\"" << peer_endpoint << "\""; -+ ss << "for=\"" << peer_endpoint_ << "\""; - via_headers["Forwarded"s] = ss.str(); - } - // https://datatracker.ietf.org/doc/html/rfc7230#section-5.7.1 - if (!absl::GetFlag(FLAGS_hide_via)) { -- via_headers["Via"s] = "1.1 asio"s; -+ via_headers["Via"s] = "YASS/" YASS_APP_PRODUCT_VERSION; - } - std::string header; - parser.ReforgeHttpRequest(&header, &via_headers); -diff --git a/src/ss_benchmark.cpp b/src/ss_benchmark.cpp -index 02976a5f..99a08c61 100644 ---- a/src/ss_benchmark.cpp -+++ b/src/ss_benchmark.cpp -@@ -223,7 +223,7 @@ void GenerateConnectRequest(std::string_view host, int port_num, IOBuf* buf) { - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: packages.endpointdev.com:443\r\n" - "User-Agent: curl/7.77.0\r\n" -- "Proxy-Connection: Keep-Alive\r\n" -+ "Proxy-Connection: Close\r\n" - "\r\n", - host, port_num); - buf->reserve(request_header.size(), 0); -diff --git a/src/ss_test.cpp b/src/ss_test.cpp -index 201022c4..2c9a673c 100644 ---- a/src/ss_test.cpp -+++ b/src/ss_test.cpp -@@ -294,7 +294,7 @@ void GenerateConnectRequest(std::string_view host, int port_num, IOBuf* buf) { - "CONNECT %s:%d HTTP/1.1\r\n" - "Host: packages.endpointdev.com:443\r\n" - "User-Agent: curl/7.77.0\r\n" -- "Proxy-Connection: Keep-Alive\r\n" -+ "Proxy-Connection: Close\r\n" - "\r\n", - host, port_num); - buf->reserve(request_header.size(), 0); diff --git a/net-proxy/yass/yass-1.10.0-r1.ebuild b/net-proxy/yass/yass-1.10.1.ebuild similarity index 96% rename from net-proxy/yass/yass-1.10.0-r1.ebuild rename to net-proxy/yass/yass-1.10.1.ebuild index 2482e9cda..9f33aa82b 100644 --- a/net-proxy/yass/yass-1.10.0-r1.ebuild +++ b/net-proxy/yass/yass-1.10.1.ebuild @@ -40,7 +40,6 @@ BDEPEND=" PATCHES=( "${FILESDIR}"/libcxx-gcc-14.patch - "${FILESDIR}"/telegram-http-proxy-fix.patch ) src_configure() { diff --git a/net-proxy/yass/yass-1.9.5-r2.ebuild b/net-proxy/yass/yass-1.9.6.ebuild similarity index 93% rename from net-proxy/yass/yass-1.9.5-r2.ebuild rename to net-proxy/yass/yass-1.9.6.ebuild index 5c62fe0b5..541c0737e 100644 --- a/net-proxy/yass/yass-1.9.5-r2.ebuild +++ b/net-proxy/yass/yass-1.9.6.ebuild @@ -39,9 +39,7 @@ BDEPEND=" " PATCHES=( - "${FILESDIR}"/boringssl-gcc-14.patch "${FILESDIR}"/libcxx-gcc-14.patch - "${FILESDIR}"/telegram-http-proxy-fix.patch ) src_configure() { -- 2.11.4.GIT