Skip to content

Commit b739aca

Browse files
authored
Merge pull request libgit2#6713 from sgallagher/llhttp
2 parents 93c9444 + fb1797d commit b739aca

File tree

23 files changed

+12212
-2579
lines changed

23 files changed

+12212
-2579
lines changed

.github/workflows/build-containers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
qemu: true
4141
- name: centos7
4242
- name: centos8
43+
- name: fedora
4344
runs-on: ubuntu-latest
4445
name: "Create container: ${{ matrix.container.name }}"
4546
steps:

.github/workflows/nightly.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,15 @@ jobs:
213213
SKIP_NEGOTIATE_TESTS: true
214214
SKIP_SSH_TESTS: true
215215
ARCH: x86
216-
216+
- name: "Linux (Fedora, llhttp)"
217+
id: fedora
218+
os: ubuntu-latest
219+
container:
220+
name: fedora
221+
env:
222+
CC: gcc
223+
CMAKE_GENERATOR: Ninja
224+
CMAKE_OPTIONS: -DUSE_HTTPS=OpenSSL -DREGEX_BACKEND=pcre2 -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=valgrind -DUSE_GSSAPI=ON -DUSE_SSH=libssh2 -DUSE_HTTP_PARSER=llhttp
217225
- name: "Linux (Bionic, GCC, dynamically-loaded OpenSSL)"
218226
id: bionic-gcc-dynamicopenssl
219227
container:

COPYING

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,3 +1383,28 @@ without express or implied warranty of any kind.
13831383

13841384
These notices must be retained in any copies of any part of this
13851385
documentation and/or software.
1386+
1387+
----------------------------------------------------------------------
1388+
1389+
The bundled llhttp dependency is licensed under the MIT license:
1390+
1391+
Copyright Fedor Indutny, 2018.
1392+
1393+
Permission is hereby granted, free of charge, to any person obtaining a
1394+
copy of this software and associated documentation files (the
1395+
"Software"), to deal in the Software without restriction, including
1396+
without limitation the rights to use, copy, modify, merge, publish,
1397+
distribute, sublicense, and/or sell copies of the Software, and to permit
1398+
persons to whom the Software is furnished to do so, subject to the
1399+
following conditions:
1400+
1401+
The above copyright notice and this permission notice shall be included
1402+
in all copies or substantial portions of the Software.
1403+
1404+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
1405+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1406+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
1407+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
1408+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
1409+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
1410+
USE OR OTHER DEALINGS IN THE SOFTWARE.

ci/docker/fedora

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
ARG BASE=fedora:rawhide
2+
3+
FROM ${BASE} AS stream
4+
RUN dnf -y distro-sync
5+
6+
FROM stream AS yum
7+
RUN yum install -y \
8+
which \
9+
bzip2 \
10+
git \
11+
libarchive \
12+
cmake \
13+
gcc \
14+
make \
15+
openssl-devel \
16+
openssh-server \
17+
git-daemon \
18+
java-1.8.0-openjdk-headless \
19+
sudo \
20+
python3 \
21+
valgrind \
22+
krb5-workstation \
23+
krb5-libs \
24+
krb5-devel \
25+
pcre2-devel \
26+
zlib-devel \
27+
ninja-build \
28+
llhttp-devel
29+
30+
FROM yum AS libssh2
31+
RUN cd /tmp && \
32+
curl --location --silent --show-error https://www.libssh2.org/download/libssh2-1.11.0.tar.gz | tar -xz && \
33+
cd libssh2-1.11.0 && \
34+
./configure && \
35+
make && \
36+
make install && \
37+
cd .. && \
38+
rm -rf libssh2-1.11.0
39+
40+
FROM libssh2 AS adduser
41+
ARG UID=""
42+
ARG GID=""
43+
RUN if [ "${UID}" != "" ]; then USER_ARG="--uid ${UID}"; fi && \
44+
if [ "${GID}" != "" ]; then GROUP_ARG="--gid ${GID}"; fi && \
45+
groupadd ${GROUP_ARG} libgit2 && \
46+
useradd ${USER_ARG} --gid libgit2 --shell /bin/bash --create-home libgit2
47+
48+
FROM adduser AS configure
49+
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
50+
RUN mkdir /var/run/sshd
51+
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local && \
52+
ldconfig

cmake/FindLLHTTP.cmake

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# - Try to find llhttp
2+
#
3+
# Defines the following variables:
4+
#
5+
# LLHTTP_FOUND - system has llhttp
6+
# LLHTTP_INCLUDE_DIR - the llhttp include directory
7+
# LLHTTP_LIBRARIES - Link these to use llhttp
8+
# LLHTTP_VERSION_MAJOR - major version
9+
# LLHTTP_VERSION_MINOR - minor version
10+
# LLHTTP_VERSION_STRING - the version of llhttp found
11+
12+
# Find the header and library
13+
find_path(LLHTTP_INCLUDE_DIR NAMES llhttp.h)
14+
find_library(LLHTTP_LIBRARY NAMES llhttp libllhttp)
15+
16+
# Found the header, read version
17+
if(LLHTTP_INCLUDE_DIR AND EXISTS "${LLHTTP_INCLUDE_DIR}/llhttp.h")
18+
file(READ "${LLHTTP_INCLUDE_DIR}/llhttp.h" LLHTTP_H)
19+
if(LLHTTP_H)
20+
string(REGEX REPLACE ".*#define[\t ]+LLHTTP_VERSION_MAJOR[\t ]+([0-9]+).*" "\\1" LLHTTP_VERSION_MAJOR "${LLHTTP_H}")
21+
string(REGEX REPLACE ".*#define[\t ]+LLHTTP_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" LLHTTP_VERSION_MINOR "${LLHTTP_H}")
22+
set(LLHTTP_VERSION_STRING "${LLHTTP_VERSION_MAJOR}.${LLHTTP_VERSION_MINOR}")
23+
endif()
24+
unset(LLHTTP_H)
25+
endif()
26+
27+
# Handle the QUIETLY and REQUIRED arguments and set LLHTTP_FOUND
28+
# to TRUE if all listed variables are TRUE
29+
include(FindPackageHandleStandardArgs)
30+
find_package_handle_standard_args(LLHTTP REQUIRED_VARS LLHTTP_INCLUDE_DIR LLHTTP_LIBRARY)
31+
32+
# Hide advanced variables
33+
mark_as_advanced(LLHTTP_INCLUDE_DIR LLHTTP_LIBRARY)
34+
35+
# Set standard variables
36+
if(LLHTTP_FOUND)
37+
set(LLHTTP_LIBRARIES ${LLHTTP_LIBRARY})
38+
set(LLHTTP_INCLUDE_DIRS ${LLHTTP_INCLUDE_DIR})
39+
endif()

cmake/SelectHTTPParser.cmake

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
11
# Optional external dependency: http-parser
2-
if(USE_HTTP_PARSER STREQUAL "system")
2+
if(USE_HTTP_PARSER STREQUAL "http-parser")
33
find_package(HTTPParser)
44

55
if(HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
66
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
77
list(APPEND LIBGIT2_SYSTEM_LIBS ${HTTP_PARSER_LIBRARIES})
88
list(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
9-
add_feature_info(http-parser ON "http-parser support (system)")
9+
set(GIT_HTTPPARSER_HTTPPARSER 1)
10+
add_feature_info(http-parser ON "using http-parser (system)")
1011
else()
1112
message(FATAL_ERROR "http-parser support was requested but not found")
1213
endif()
14+
elseif(USE_HTTP_PARSER STREQUAL "llhttp")
15+
find_package(LLHTTP)
16+
17+
if(LLHTTP_FOUND AND LLHTTP_VERSION_MAJOR EQUAL 9)
18+
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${LLHTTP_INCLUDE_DIRS})
19+
list(APPEND LIBGIT2_SYSTEM_LIBS ${LLHTTP_LIBRARIES})
20+
list(APPEND LIBGIT2_PC_LIBS "-lllhttp")
21+
set(GIT_HTTPPARSER_LLHTTP 1)
22+
add_feature_info(http-parser ON "using llhttp (system)")
23+
else()
24+
message(FATAL_ERROR "llhttp support was requested but not found")
25+
endif()
1326
else()
14-
message(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
15-
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/http-parser" "${PROJECT_BINARY_DIR}/deps/http-parser")
16-
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/http-parser")
17-
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS "$<TARGET_OBJECTS:http-parser>")
18-
add_feature_info(http-parser ON "http-parser support (bundled)")
27+
add_subdirectory("${PROJECT_SOURCE_DIR}/deps/llhttp" "${PROJECT_BINARY_DIR}/deps/llhttp")
28+
list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/llhttp")
29+
list(APPEND LIBGIT2_DEPENDENCY_OBJECTS "$<TARGET_OBJECTS:llhttp>")
30+
set(GIT_HTTPPARSER_BUILTIN 1)
31+
add_feature_info(http-parser ON "using bundled parser")
1932
endif()

deps/http-parser/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

deps/http-parser/COPYING

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)