mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-07-25 21:08:35 -07:00
dev-cpp/cpp-httplib: add 0.27.0
Signed-off-by: Alexey Sokolov <alexey+gentoo@asokolov.org> Part-of: https://github.com/gentoo/gentoo/pull/44362 Closes: https://github.com/gentoo/gentoo/pull/44362 Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
This commit is contained in:
committed by
Eli Schwartz
parent
18aa0887ff
commit
7199a23208
@@ -1 +1,2 @@
|
||||
DIST cpp-httplib-0.26.0.tar.gz 1305573 BLAKE2B 4fcb11a4d3af71fa5b67f2dac7c0f3e0a5cae6ed2bf527686ca05dd03b4a91042dfdcfb068b5dc7dd58fd31a537a44ae6f38df7c5d87a1973e3ff738a51dd946 SHA512 b364500f76e2ecb0fe21b032d831272e3f1dfeea71af74e325f8fc4ce9dcdb3c941b97a5b422bdeafb9facd058597b90f8bfc284fb9afe3c33fefa15dd5a010b
|
||||
DIST cpp-httplib-0.27.0.tar.gz 1311061 BLAKE2B b273d9ac6a79d74b47d27b49357f0d9ae61501cecba21b61cd53a74d056b9acdaeba530cdfd02111debaadab15c9076e44727997be32de3947eaf16ecdc846c5 SHA512 884d6be8209d8128af2b11c35d7fc592d8a236a65cdcd9b123a77aa73fbd0dbd03c1cbe17cf4dd92797b06d312c9476d59646b9034d8e559095852b021138acc
|
||||
|
||||
92
dev-cpp/cpp-httplib/cpp-httplib-0.27.0.ebuild
Normal file
92
dev-cpp/cpp-httplib/cpp-httplib-0.27.0.ebuild
Normal file
@@ -0,0 +1,92 @@
|
||||
# Copyright 2022-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{11..13} )
|
||||
|
||||
inherit cmake-multilib python-any-r1 toolchain-funcs
|
||||
|
||||
DESCRIPTION="C++ HTTP/HTTPS server and client library"
|
||||
HOMEPAGE="https://github.com/yhirose/cpp-httplib/"
|
||||
|
||||
if [[ "${PV}" == *9999* ]] ; then
|
||||
inherit git-r3
|
||||
|
||||
EGIT_REPO_URI="https://github.com/yhirose/${PN}.git"
|
||||
else
|
||||
SRC_URI="https://github.com/yhirose/${PN}/archive/v${PV}.tar.gz
|
||||
-> ${P}.tar.gz"
|
||||
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
|
||||
fi
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0/$(ver_cut 0-2)" # soversion
|
||||
|
||||
IUSE="brotli ssl test zlib zstd"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
brotli? (
|
||||
app-arch/brotli:=[${MULTILIB_USEDEP}]
|
||||
)
|
||||
ssl? (
|
||||
>=dev-libs/openssl-3.0.13:=[${MULTILIB_USEDEP}]
|
||||
)
|
||||
zlib? (
|
||||
sys-libs/zlib[${MULTILIB_USEDEP}]
|
||||
)
|
||||
zstd? (
|
||||
app-arch/zstd[${MULTILIB_USEDEP}]
|
||||
)
|
||||
"
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
"
|
||||
BDEPEND="
|
||||
${PYTHON_DEPS}
|
||||
virtual/pkgconfig
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PV}-fixpidtest.patch
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
local -a mycmakeargs=(
|
||||
-DHTTPLIB_COMPILE=yes
|
||||
-DBUILD_SHARED_LIBS=yes
|
||||
-DHTTPLIB_USE_BROTLI_IF_AVAILABLE=no
|
||||
-DHTTPLIB_USE_OPENSSL_IF_AVAILABLE=no
|
||||
-DHTTPLIB_USE_ZLIB_IF_AVAILABLE=no
|
||||
-DHTTPLIB_USE_ZSTD_IF_AVAILABLE=no
|
||||
-DHTTPLIB_REQUIRE_BROTLI=$(usex brotli)
|
||||
-DHTTPLIB_REQUIRE_OPENSSL=$(usex ssl)
|
||||
-DHTTPLIB_REQUIRE_ZLIB=$(usex zlib)
|
||||
-DHTTPLIB_REQUIRE_ZSTD=$(usex zstd)
|
||||
-DPython3_EXECUTABLE="${PYTHON}"
|
||||
)
|
||||
cmake-multilib_src_configure
|
||||
}
|
||||
|
||||
multilib_src_test() {
|
||||
cp -p -R --reflink=auto "${S}/test" ./test || die
|
||||
|
||||
local -a failing_tests=(
|
||||
# Disable all online tests.
|
||||
"*.*_Online"
|
||||
|
||||
# Fails on musl x86:
|
||||
ServerTest.GetRangeWithMaxLongLength
|
||||
ServerTest.GetStreamedWithTooManyRanges
|
||||
)
|
||||
|
||||
# Little dance to please the GTEST filter (join array using ":").
|
||||
failing_tests_str="${failing_tests[@]}"
|
||||
failing_tests_filter="${failing_tests_str// /:}"
|
||||
|
||||
# PREFIX is . to avoid calling "brew" and relying on stuff in /opt
|
||||
GTEST_FILTER="-${failing_tests_filter}" emake -C test \
|
||||
CXX="$(tc-getCXX)" CXXFLAGS="${CXXFLAGS} -I." PREFIX=.
|
||||
}
|
||||
109
dev-cpp/cpp-httplib/files/0.27.0-fixpidtest.patch
Normal file
109
dev-cpp/cpp-httplib/files/0.27.0-fixpidtest.patch
Normal file
@@ -0,0 +1,109 @@
|
||||
From 551f96d4a2a07a56d72a13d4837b31eead884d34 Mon Sep 17 00:00:00 2001
|
||||
From: yhirose <yuji.hirose.bug@gmail.com>
|
||||
Date: Mon, 27 Oct 2025 20:40:12 -0400
|
||||
Subject: [PATCH] Remove REMOTE_PORT dependency from UnixSocketTest.PeerPid
|
||||
|
||||
---
|
||||
.gitignore | 2 ++
|
||||
test/test.cc | 26 +++++++++++++-------------
|
||||
2 files changed, 15 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/.gitignore b/.gitignore
|
||||
index b9acdca78e..21839782df 100644
|
||||
--- a/.gitignore
|
||||
+++ b/.gitignore
|
||||
@@ -23,6 +23,8 @@ example/one_time_request
|
||||
!example/one_time_request.*
|
||||
example/server_and_client
|
||||
!example/server_and_client.*
|
||||
+example/accept_header
|
||||
+!example/accept_header.*
|
||||
example/*.pem
|
||||
test/httplib.cc
|
||||
test/httplib.h
|
||||
diff --git a/test/test.cc b/test/test.cc
|
||||
index e5b3639629..c9d6421719 100644
|
||||
--- a/test/test.cc
|
||||
+++ b/test/test.cc
|
||||
@@ -196,7 +196,7 @@ TEST_F(UnixSocketTest, PeerPid) {
|
||||
std::string remote_port_val;
|
||||
svr.Get(pattern_, [&](const httplib::Request &req, httplib::Response &res) {
|
||||
res.set_content(content_, "text/plain");
|
||||
- remote_port_val = req.get_header_value("REMOTE_PORT");
|
||||
+ remote_port_val = std::to_string(req.remote_port);
|
||||
});
|
||||
|
||||
std::thread t{[&] {
|
||||
@@ -11236,7 +11236,8 @@ TEST(ForwardedHeadersTest, NoProxiesSetting) {
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
|
||||
EXPECT_EQ(observed_xff, "203.0.113.66");
|
||||
- EXPECT_TRUE(observed_remote_addr == "::1" || observed_remote_addr == "127.0.0.1");
|
||||
+ EXPECT_TRUE(observed_remote_addr == "::1" ||
|
||||
+ observed_remote_addr == "127.0.0.1");
|
||||
}
|
||||
|
||||
TEST(ForwardedHeadersTest, NoForwardedHeaders) {
|
||||
@@ -11269,7 +11270,8 @@ TEST(ForwardedHeadersTest, NoForwardedHeaders) {
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
|
||||
EXPECT_EQ(observed_xff, "");
|
||||
- EXPECT_TRUE(observed_remote_addr == "::1" || observed_remote_addr == "127.0.0.1");
|
||||
+ EXPECT_TRUE(observed_remote_addr == "::1" ||
|
||||
+ observed_remote_addr == "127.0.0.1");
|
||||
}
|
||||
|
||||
TEST(ForwardedHeadersTest, SingleTrustedProxy_UsesIPBeforeTrusted) {
|
||||
@@ -11296,7 +11298,8 @@ TEST(ForwardedHeadersTest, SingleTrustedProxy_UsesIPBeforeTrusted) {
|
||||
svr.wait_until_ready();
|
||||
|
||||
Client cli(HOST, PORT);
|
||||
- auto res = cli.Get("/ip", {{"X-Forwarded-For", "198.51.100.23, 203.0.113.66"}});
|
||||
+ auto res =
|
||||
+ cli.Get("/ip", {{"X-Forwarded-For", "198.51.100.23, 203.0.113.66"}});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
@@ -11330,8 +11333,7 @@ TEST(ForwardedHeadersTest, MultipleTrustedProxies_UsesClientIP) {
|
||||
|
||||
Client cli(HOST, PORT);
|
||||
auto res = cli.Get(
|
||||
- "/ip",
|
||||
- {{"X-Forwarded-For", "198.51.100.23, 203.0.113.66, 192.0.2.45"}});
|
||||
+ "/ip", {{"X-Forwarded-For", "198.51.100.23, 203.0.113.66, 192.0.2.45"}});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
@@ -11364,8 +11366,8 @@ TEST(ForwardedHeadersTest, TrustedProxyNotInHeader_UsesFirstFromXFF) {
|
||||
svr.wait_until_ready();
|
||||
|
||||
Client cli(HOST, PORT);
|
||||
- auto res = cli.Get("/ip",
|
||||
- {{"X-Forwarded-For", "198.51.100.23, 198.51.100.24"}});
|
||||
+ auto res =
|
||||
+ cli.Get("/ip", {{"X-Forwarded-For", "198.51.100.23, 198.51.100.24"}});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
@@ -11399,8 +11401,7 @@ TEST(ForwardedHeadersTest, LastHopTrusted_SelectsImmediateLeftIP) {
|
||||
|
||||
Client cli(HOST, PORT);
|
||||
auto res = cli.Get(
|
||||
- "/ip",
|
||||
- {{"X-Forwarded-For", "198.51.100.23, 203.0.113.66, 192.0.2.45"}});
|
||||
+ "/ip", {{"X-Forwarded-For", "198.51.100.23, 203.0.113.66, 192.0.2.45"}});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
@@ -11433,9 +11434,8 @@ TEST(ForwardedHeadersTest, HandlesWhitespaceAroundIPs) {
|
||||
svr.wait_until_ready();
|
||||
|
||||
Client cli(HOST, PORT);
|
||||
- auto res = cli.Get(
|
||||
- "/ip",
|
||||
- {{"X-Forwarded-For", " 198.51.100.23 , 203.0.113.66 , 192.0.2.45 "}});
|
||||
+ auto res = cli.Get("/ip", {{"X-Forwarded-For",
|
||||
+ " 198.51.100.23 , 203.0.113.66 , 192.0.2.45 "}});
|
||||
|
||||
ASSERT_TRUE(res);
|
||||
EXPECT_EQ(StatusCode::OK_200, res->status);
|
||||
Reference in New Issue
Block a user