Allow Windows with WinHTTP to use external http-parser#4015
Conversation
| ADD_DEFINITIONS(-DGIT_WINHTTP) | ||
|
|
||
| FIND_PACKAGE(HTTP_Parser) | ||
| IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2) |
There was a problem hiding this comment.
I'd say this check HTTP_PARSER_VERSION_MAJOR EQUAL 2 doesn't quite match up with the message for when it fails. http-parser was not found or is too old; using bundled 3rd-party sources. since the failure could (in the future) be due to a version 3 being released?
But this was the case in the old version too, so maybe it doesn't matter.
There was a problem hiding this comment.
I'd be happy to bundle in a change to the error message as well if the maintainers think that's a good idea.
There was a problem hiding this comment.
Yeah, I think that would be delightful. Something like http-parser version 2 not found... would be preferable.
|
I'm assuming the win64 failures are unrelated because they both fail during tests and correctly identify that there is no third-party http-parser library available, so their behavior should be unchanged with respect to this change. |
| IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2) | ||
| INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS}) | ||
| LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES}) | ||
| LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser") |
There was a problem hiding this comment.
does it link correctly under this name when the windows dll usually has the soname in it?
|
What's the goal here? Do you have a newer http-parser that you want to use? Independent of this, does it make sense to also upgrade the http-parser that we're bundling? |
|
Why do we use http-parser on Windows? If it's because of trying to parse out the URL, we should make it ask WinHTTP instead and just not use http-parser. We're certainly not trying to parse any HTTP with it. This is also not how you link to libraries on Windows, but if you expect to find something with |
We use
I'm open to corrections. :) |
| IF (WIN32 AND WINHTTP) | ||
| ADD_DEFINITIONS(-DGIT_WINHTTP) | ||
|
|
||
| FIND_PACKAGE(HTTP_Parser) |
There was a problem hiding this comment.
It probably makes sense to move this block down toward the zlib block; these are quite similar, they both decide whether to load external dependencies, or to use the bundled third party libraries. Also, this looks like it adds some extra whitespace, which would be nice to ⚡️ in that move.
|
Addressed @ethomson's comments. |
|
Thanks @staticfloat , this looks good to me. Enjoy your external httpparser goodness! |
Currently, when building
libgit2on windows, if building against WinHTTP, there is no option to use an externalhttp-parserlibrary, we are locked into using the builtinhttp-parserlibrary. I'd guess this was done because there were purportedly some differences between the third-partyhttp-parserlibrary on windows and the builtinhttp-parserlibrary. However, I cannot find any special treatment of the windows build of the internalhttp-parser, so it stands to reason that we should be able to use the same externalhttp-parserlibrary on windows as we do on Linux or OSX.This patch allows searching for
http-parserlibraries on any platform.