From 4da9d4e53a7fc0e0badf0c487cad531ba7662046 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 8 Jun 2016 12:49:07 -0700 Subject: Fix build against Debian version of libhttp-parser -- its old but it will work. --- osdep/Http.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'osdep') 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 +#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(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) -- cgit v1.2.3