diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-06-08 12:49:07 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-06-08 12:49:07 -0700 |
commit | 4da9d4e53a7fc0e0badf0c487cad531ba7662046 (patch) | |
tree | 80d6c0589eca7e7c7c3802665bcb2ac1f708e37d /osdep | |
parent | 0ca764968ae0c09510d055390a3cec252caecfae (diff) | |
download | infinitytier-4da9d4e53a7fc0e0badf0c487cad531ba7662046.tar.gz infinitytier-4da9d4e53a7fc0e0badf0c487cad531ba7662046.zip |
Fix build against Debian version of libhttp-parser -- its old but it will work.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/Http.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/osdep/Http.cpp b/osdep/Http.cpp index 6e3135de..4fe298b3 100644 --- a/osdep/Http.cpp +++ b/osdep/Http.cpp @@ -25,7 +25,12 @@ #include "OSUtils.hpp" #include "../node/Constants.hpp" #include "../node/Utils.hpp" + +#ifdef ZT_USE_SYSTEM_HTTP_PARSER +#include <http_parser.h> +#else #include "../ext/http-parser/http_parser.h" +#endif namespace ZeroTier { @@ -33,7 +38,11 @@ namespace { static int ShttpOnMessageBegin(http_parser *parser); static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length); +#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 2) static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length); +#else +static int ShttpOnStatus(http_parser *parser); +#endif static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length); static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length); static int ShttpOnHeadersComplete(http_parser *parser); @@ -126,12 +135,18 @@ static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length) { return 0; } +#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 2) static int ShttpOnStatus(http_parser *parser,const char *ptr,size_t length) +#else +static int ShttpOnStatus(http_parser *parser) +#endif { + /* HttpPhyHandler *hh = reinterpret_cast<HttpPhyHandler *>(parser->data); hh->messageSize += (unsigned long)length; if (hh->messageSize > hh->maxResponseSize) return -1; + */ return 0; } static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length) |