http-parser: use our bundled http-parser by default Our bundled http-parser includes bugfixes, therefore we should prefer our http-parser until such time as we can identify that the system http-parser has these bugfixes (using a version check). Since these bugs are - at present - minor, retain the ability for users to force that they want to use the system http-parser anyway. This does change the cmake specification so that people _must_ opt-in to the new behavior knowingly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 007963c..b7f2bc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,10 +60,10 @@ OPTION(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
OPTION(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
OPTION(VALGRIND "Configure build for valgrind" OFF)
-OPTION(USE_EXT_HTTP_PARSER "Use system HTTP_Parser if available" ON)
OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
+ SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
diff --git a/docs/changelog.md b/docs/changelog.md
index 666eecd..75f8392 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -1,3 +1,20 @@
+v0.28 + 1
+---------
+
+### Breaking CMake configuration changes
+
+* The CMake option to use a system http-parser library, instead of the
+ bundled dependency, has changed. This is due to a deficiency in
+ http-parser that we have fixed in our implementation. The bundled
+ library is now the default, but if you wish to force the use of the
+ system http-parser implementation despite incompatibilities, you can
+ specify `-DUSE_HTTP_PARSER=system` to CMake.
+
+### Changes or improvements
+
+* libgit2 can now correctly cope with URLs where the host contains a colon
+ but a port is not specified. (eg `http://example.com:/repo.git`).
+
v0.28
-----
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 647bb09..5a0cf34 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -340,12 +340,17 @@ ELSE()
ENDIF()
# Optional external dependency: http-parser
-FIND_PACKAGE(HTTP_Parser)
-IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
- LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
- LIST(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES})
- LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
- ADD_FEATURE_INFO(http-parser ON "http-parser support")
+IF(USE_HTTP_PARSER STREQUAL "system")
+ FIND_PACKAGE(HTTP_Parser)
+
+ IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
+ LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
+ LIST(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES})
+ LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
+ ADD_FEATURE_INFO(http-parser ON "http-parser support (system)")
+ ELSE()
+ MESSAGE(FATAL_ERROR "http-parser support was requested but not found")
+ ENDIF()
ELSE()
MESSAGE(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser")