Skip to content

Commit 126d97e

Browse files
Feat support llhttp (#5794)
* support llhttp * optimize code * Update codecov.yml * optimize code --------- Co-authored-by: NathanFreeman <[email protected]>
1 parent 7c6764d commit 126d97e

28 files changed

+12671
-10803
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ file(GLOB_RECURSE SRC_LIST FOLLOW_SYMLINKS src/*.c src/*.cc
6666
thirdparty/hiredis/net.c
6767
thirdparty/hiredis/read.c
6868
thirdparty/hiredis/sds.c
69-
thirdparty/swoole_http_parser.c
69+
thirdparty/llhttp/api.c
70+
thirdparty/llhttp/http.c
71+
thirdparty/llhttp/llhttp.c
7072
thirdparty/multipart_parser.c
7173
)
7274
file(GLOB_RECURSE HEAD_FILES FOLLOW_SYMLINKS include/*.h)
@@ -82,7 +84,7 @@ add_definitions(-DHAVE_CONFIG_H)
8284
# test
8385
#add_definitions(-DSW_USE_THREAD_CONTEXT)
8486

85-
include_directories(BEFORE ./include ./include/wrapper ext-src/ thirdparty/ ./)
87+
include_directories(BEFORE ./include ./include/wrapper ext-src/ thirdparty/ thirdparty/llhttp ./)
8688

8789
# find OpenSSL
8890
if (DEFINED openssl_dir)
@@ -219,10 +221,10 @@ if (!${GTEST_FOUND})
219221
endif()
220222
message(STATUS "Found GTest")
221223

222-
file(GLOB_RECURSE core_test_files core-tests/src/*.cpp core-tests/deps/llhttp/src/*.c)
224+
file(GLOB_RECURSE core_test_files core-tests/src/*.cpp thirdparty/llhttp/*.c)
223225
add_executable(core-tests ${core_test_files})
224226
add_dependencies(core-tests lib-swoole)
225-
include_directories(BEFORE core-tests/include thirdparty thirdparty/hiredis core-tests/deps/llhttp/include ${GTEST_INCLUDE_DIRS} ${NGHTTP2_INCLUDE_DIR})
227+
include_directories(BEFORE core-tests/include thirdparty thirdparty/hiredis thirdparty/llhttp/ ${GTEST_INCLUDE_DIRS} ${NGHTTP2_INCLUDE_DIR})
226228
target_link_libraries(core-tests swoole pthread ssl crypto ${GTEST_BOTH_LIBRARIES} ${NGHTTP2_LIBRARIES})
227229

228230
# find libpq

codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ignore:
22
- "src/core/error.cc"
33
- "thirdparty/hiredis/*"
4+
- "thirdparty/llhttp/*"
45

56
coverage:
67
range: 60..80

config.m4

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,9 @@ EOF
11101110
thirdparty/php/standard/proc_open.cc"
11111111

11121112
swoole_source_file="$swoole_source_file \
1113-
thirdparty/swoole_http_parser.c \
1113+
thirdparty/llhttp/api.c \
1114+
thirdparty/llhttp/http.c \
1115+
thirdparty/llhttp/llhttp.c \
11141116
thirdparty/multipart_parser.c"
11151117

11161118
if test "$PHP_NGHTTP2_DIR" = "no"; then
@@ -1300,6 +1302,7 @@ EOF
13001302
include/*.h \
13011303
stubs/*.h \
13021304
thirdparty/*.h \
1305+
thirdparty/llhttp/*.h \
13031306
thirdparty/nghttp2/*.h])
13041307

13051308
PHP_REQUIRE_CXX()
@@ -1333,6 +1336,7 @@ EOF
13331336
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php/standard)
13341337
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php/curl)
13351338
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/php84/curl)
1339+
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/llhttp)
13361340
if test "$PHP_NGHTTP2_DIR" = "no"; then
13371341
PHP_ADD_BUILD_DIR($ext_builddir/thirdparty/nghttp2)
13381342
fi

0 commit comments

Comments
 (0)