Compare commits
10 Commits
dc59a387c1
...
3650a10816
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3650a10816 | ||
|
|
9769dfda16 | ||
|
|
b277b49a31 | ||
|
|
d10767fcb1 | ||
|
|
0e3739ba28 | ||
|
|
057c021317 | ||
|
|
d4b8f2db4f | ||
|
|
6123b9ea55 | ||
|
|
abab53a6c7 | ||
|
|
12aece64bd |
46
0005-libevhtp-add-securce-compile-options.patch
Normal file
46
0005-libevhtp-add-securce-compile-options.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From cb1d37837d76928670c414d3b498d898ee0b32ae Mon Sep 17 00:00:00 2001
|
||||
From: wujing <wujing50@huawei.com>
|
||||
Date: Tue, 16 Mar 2021 10:37:07 +0800
|
||||
Subject: [PATCH] libevhtp: add securce compile options
|
||||
|
||||
Signed-off-by: wujing <wujing50@huawei.com>
|
||||
---
|
||||
CMakeLists.txt | 7 ++++++-
|
||||
cmake/options.cmake | 3 +++
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index fbb0f50..5bc89d5 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -110,7 +110,12 @@ elseif(EVHTP_ALLOCATOR STREQUAL "tcmalloc")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
-add_library(evhtp SHARED ${LIBEVHTP_SOURCE_FILES})
|
||||
+if (NOT EVHTP_BUILD_SHARED)
|
||||
+ add_library(evhtp ${LIBEVHTP_SOURCE_FILES})
|
||||
+else()
|
||||
+ add_library(evhtp SHARED ${LIBEVHTP_SOURCE_FILES})
|
||||
+ target_link_options(evhtp PUBLIC "-Wl,-z,now -s")
|
||||
+endif()
|
||||
target_link_libraries(evhtp PUBLIC ${LIBEVHTP_EXTERNAL_LIBS})
|
||||
target_include_directories(evhtp PUBLIC ${LIBEVHTP_EXTERNAL_INCLUDES})
|
||||
|
||||
diff --git a/cmake/options.cmake b/cmake/options.cmake
|
||||
index 1738642..e781110 100644
|
||||
--- a/cmake/options.cmake
|
||||
+++ b/cmake/options.cmake
|
||||
@@ -11,6 +11,9 @@ option (EVHTP_DISABLE_REGEX "Disable regex support" OFF)
|
||||
# -DEVHTP_DEBUG=ON
|
||||
option (EVHTP_DEBUG "Enable verbose debug logging" OFF)
|
||||
|
||||
+# -DEVHTP_BUILD_SHARED=ON
|
||||
+option (EVHTP_BUILD_SHARED "Build shared libraries" OFF)
|
||||
+
|
||||
# can be overwritten by new set_alloc functions
|
||||
set(EVHTP_ALLOCATOR CACHE STRING "Allocator library")
|
||||
set_property(CACHE EVHTP_ALLOCATOR PROPERTY STRINGS "jemalloc;tcmalloc")
|
||||
--
|
||||
2.29.2
|
||||
|
||||
143
0006-libevhtp-add-gcov-compile-options.patch
Normal file
143
0006-libevhtp-add-gcov-compile-options.patch
Normal file
@ -0,0 +1,143 @@
|
||||
From c5845d807bd88118bb5974ce08c469cfe6c6d258 Mon Sep 17 00:00:00 2001
|
||||
From: songbuhuang <544824346@qq.com>
|
||||
Date: Thu, 10 Nov 2022 16:17:53 +0800
|
||||
Subject: [PATCH] libevhtp add gcov compile options
|
||||
|
||||
Signed-off-by: songbuhuang <544824346@qq.com>
|
||||
---
|
||||
CMakeLists.txt | 12 ++++++++++++
|
||||
examples/example_basic.c | 7 +++++--
|
||||
examples/example_chunked.c | 9 +++++----
|
||||
examples/example_pause.c | 4 ++++
|
||||
examples/example_request_fini.c | 4 ++++
|
||||
examples/example_vhost.c | 4 ++++
|
||||
examples/https/example_https_server.c | 7 +++++--
|
||||
7 files changed, 39 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5bc89d5..d4596f6 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -64,6 +64,17 @@ set(evhtp_dir_headers
|
||||
"include/evhtp/parser.h"
|
||||
"include/evhtp/log.h")
|
||||
|
||||
+if(ENABLE_GCOV)
|
||||
+ MESSAGE(STATUS "Enable coverage compile option")
|
||||
+ set(COVERAGE_C_OPTION "${COVERAGE_OPTION} -fprofile-arcs -ftest-coverage -fkeep-static-functions -fkeep-inline-functions")
|
||||
+ set(COVERAGE_CXX_OPTION "${COVERAGE_OPTION} -fprofile-arcs -ftest-coverage")
|
||||
+endif(ENABLE_GCOV)
|
||||
+
|
||||
+if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${COVERAGE_C_OPTION}")
|
||||
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${COVERAGE_CXX_OPTION}")
|
||||
+endif()
|
||||
+
|
||||
if(NOT EVHTP_DISABLE_SSL)
|
||||
find_package(OpenSSL)
|
||||
if(OPENSSL_FOUND)
|
||||
@@ -334,6 +345,7 @@ message(STATUS "${Blue}CMAKE_SYSTEM_VERSION${ColourReset} : " ${CMAKE_SYSTEM
|
||||
message(STATUS "${Blue}CMAKE_C_COMPILER${ColourReset} : " ${CMAKE_C_COMPILER})
|
||||
message(STATUS "${Blue}CMAKE_AR${ColourReset} : " ${CMAKE_AR})
|
||||
message(STATUS "${Blue}CMAKE_RANLIB${ColourReset} : " ${CMAKE_RANLIB})
|
||||
+message(STATUS "${Blue}COVERAGE_C_OPTION${ColourReset} : " ${COVERAGE_C_OPTION})
|
||||
message(STATUS "${Blue}CFLAGS${ColourReset} : ${CMAKE_C_FLAGS}")
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
diff --git a/examples/example_basic.c b/examples/example_basic.c
|
||||
index 9948152..a2f0c18 100644
|
||||
--- a/examples/example_basic.c
|
||||
+++ b/examples/example_basic.c
|
||||
@@ -43,6 +43,9 @@ main(int argc, char ** argv)
|
||||
|
||||
log_info("Basic server, run: curl http://127.0.0.1:%d/",
|
||||
bind__sock_port0_(htp));
|
||||
- event_base_loop(evbase, 0);
|
||||
- return 0;
|
||||
+ struct timeval ten_sec;
|
||||
+ ten_sec.tv_sec = 10;
|
||||
+ ten_sec.tv_usec = 0;
|
||||
+ event_base_loopexit(evbase, &ten_sec);
|
||||
+ return event_base_loop(evbase, 0);
|
||||
}
|
||||
diff --git a/examples/example_chunked.c b/examples/example_chunked.c
|
||||
index cfab23d..6289286 100644
|
||||
--- a/examples/example_chunked.c
|
||||
+++ b/examples/example_chunked.c
|
||||
@@ -157,8 +157,9 @@ main(int argc, char ** argv)
|
||||
|
||||
log_info("curl http://127.0.0.1:%d/", bind__sock_port0_(htp));
|
||||
|
||||
- event_base_loop(evbase, 0);
|
||||
-
|
||||
-
|
||||
- return 0;
|
||||
+ struct timeval ten_sec;
|
||||
+ ten_sec.tv_sec = 10;
|
||||
+ ten_sec.tv_usec = 0;
|
||||
+ event_base_loopexit(evbase, &ten_sec);
|
||||
+ return event_base_loop(evbase, 0);
|
||||
}
|
||||
diff --git a/examples/example_pause.c b/examples/example_pause.c
|
||||
index 0cccac2..8293e0e 100644
|
||||
--- a/examples/example_pause.c
|
||||
+++ b/examples/example_pause.c
|
||||
@@ -106,5 +106,9 @@ main(int argc, char ** argv) {
|
||||
log_info("response delayed for 10s: "
|
||||
"curl http://127.0.0.1:%d/", bind__sock_port0_(htp));
|
||||
|
||||
+ struct timeval sec;
|
||||
+ sec.tv_sec = 15;
|
||||
+ sec.tv_usec = 0;
|
||||
+ event_base_loopexit(evbase, &sec);
|
||||
return event_base_loop(evbase, 0);
|
||||
}
|
||||
diff --git a/examples/example_request_fini.c b/examples/example_request_fini.c
|
||||
index d4d6da6..46a1fce 100644
|
||||
--- a/examples/example_request_fini.c
|
||||
+++ b/examples/example_request_fini.c
|
||||
@@ -59,5 +59,9 @@ main(int argc, char ** argv) {
|
||||
GENCHAR(), GENCHAR(), GENCHAR());
|
||||
|
||||
|
||||
+ struct timeval ten_sec;
|
||||
+ ten_sec.tv_sec = 10;
|
||||
+ ten_sec.tv_usec = 0;
|
||||
+ event_base_loopexit(evbase, &ten_sec);
|
||||
return event_base_loop(evbase, 0);
|
||||
}
|
||||
diff --git a/examples/example_vhost.c b/examples/example_vhost.c
|
||||
index 3b6881c..76116e8 100644
|
||||
--- a/examples/example_vhost.c
|
||||
+++ b/examples/example_vhost.c
|
||||
@@ -112,5 +112,9 @@ main(int argc, char ** argv) {
|
||||
log_info("curl -H'Host: gmail.google.com' http://127.0.0.1:%d/vhost", port);
|
||||
}
|
||||
|
||||
+ struct timeval ten_sec;
|
||||
+ ten_sec.tv_sec = 10;
|
||||
+ ten_sec.tv_usec = 0;
|
||||
+ event_base_loopexit(evbase, &ten_sec);
|
||||
return event_base_loop(evbase, 0);
|
||||
} /* main */
|
||||
diff --git a/examples/https/example_https_server.c b/examples/https/example_https_server.c
|
||||
index 3e020b2..0dc5afd 100644
|
||||
--- a/examples/https/example_https_server.c
|
||||
+++ b/examples/https/example_https_server.c
|
||||
@@ -252,8 +252,11 @@ main(int argc, char ** argv) {
|
||||
|
||||
log_info("curl https://127.0.0.1:4443/");
|
||||
|
||||
- event_base_loop(evbase, 0);
|
||||
- return 0;
|
||||
+ struct timeval ten_sec;
|
||||
+ ten_sec.tv_sec = 10;
|
||||
+ ten_sec.tv_usec = 0;
|
||||
+ event_base_loopexit(evbase, &ten_sec);
|
||||
+ return event_base_loop(evbase, 0);
|
||||
#else
|
||||
log_error("Not compiled with SSL support, go away");
|
||||
return EXIT_FAILURE;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -1,15 +1,19 @@
|
||||
%global debug_package %{nil}
|
||||
|
||||
Name: libevhtp
|
||||
Version: 1.2.18
|
||||
Release: 1
|
||||
Release: 6
|
||||
Summary: Libevent based HTTP API.
|
||||
|
||||
License: BSD3
|
||||
URL: https://criticalstack.com
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com
|
||||
Source0: https://github.com/criticalstack/libevhtp/archive/1.2.18.tar.gz
|
||||
Patch9000: 0001-decrease-numbers-of-fd-for-shared-pipe-mode.patch
|
||||
Patch9001: 0002-evhtp-enable-dynamic-thread-pool.patch
|
||||
Patch9002: 0003-close-open-ssl.-we-do-NOT-use-it-in-lcrd.patch
|
||||
Patch9003: 0004-Use-shared-library-instead-static-one.patch
|
||||
Patch9004: 0005-libevhtp-add-securce-compile-options.patch
|
||||
Patch9005: 0006-libevhtp-add-gcov-compile-options.patch
|
||||
|
||||
BuildRequires: git gcc-c++ cmake libevent-devel
|
||||
|
||||
@ -28,8 +32,6 @@ Requires: %{name} = %{version}-%{release}
|
||||
%{name}-devel contains the header files for developing
|
||||
applications that want to make use of %{name}.
|
||||
|
||||
%global debug_package %{nil}
|
||||
|
||||
%prep
|
||||
%autosetup -n %{name}-%{version} -p1
|
||||
|
||||
@ -46,6 +48,7 @@ cd build
|
||||
|
||||
%delete_la_and_a
|
||||
find %{buildroot} -name '*.cmake' -exec rm -f {} ';'
|
||||
find %{buildroot} -name '*.so.*' -exec strip {} ';'
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
@ -63,6 +66,33 @@ find %{buildroot} -name '*.cmake' -exec rm -f {} ';'
|
||||
/usr/lib/pkgconfig/evhtp.pc
|
||||
|
||||
%changelog
|
||||
* Thu Nov 08 2022 huangsong <huangsong14@huawei.com> - 1.2.18-6
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: add gcov compile options
|
||||
|
||||
* Thu Jul 28 2022 fushanqing <fushanqing@kylinos.cn> - 1.2.18-5
|
||||
- Unified license name specification
|
||||
|
||||
* Thu May 05 2022 zhangxiaoyu <zhangxiaoyu58@huawei.com> - 1.2.18-4
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: update release
|
||||
|
||||
* Fri Mar 19 2021 wujing <wujing50@huawei.com> - 1.2.18-3
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: add secure compile options
|
||||
|
||||
* Tue Sep 01 2020 openeuler Buildteam <buildteam@openeuler.org> - 1.2.18-2
|
||||
- Type:enhancement
|
||||
- ID:NA
|
||||
- SUG:NA
|
||||
- DESC: modify source0 address
|
||||
|
||||
* Wed Apr 15 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.2.18-1
|
||||
- Package init
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user