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 /service | |
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 'service')
-rw-r--r-- | service/ControlPlane.cpp | 4 | ||||
-rw-r--r-- | service/OneService.cpp | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/service/ControlPlane.cpp b/service/ControlPlane.cpp index 060f49e2..2006346f 100644 --- a/service/ControlPlane.cpp +++ b/service/ControlPlane.cpp @@ -22,7 +22,11 @@ #include "../version.h" #include "../include/ZeroTierOne.h" +#ifdef ZT_USE_SYSTEM_HTTP_PARSER +#include <http_parser.h> +#else #include "../ext/http-parser/http_parser.h" +#endif #ifdef ZT_ENABLE_NETWORK_CONTROLLER #include "../controller/SqliteNetworkController.hpp" diff --git a/service/OneService.cpp b/service/OneService.cpp index 6f51430f..a5e49f36 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -30,7 +30,11 @@ #include "../version.h" #include "../include/ZeroTierOne.h" +#ifdef ZT_USE_SYSTEM_HTTP_PARSER +#include <http_parser.h> +#else #include "../ext/http-parser/http_parser.h" +#endif #include "../node/Constants.hpp" #include "../node/Mutex.hpp" @@ -402,7 +406,11 @@ static void StapFrameHandler(void *uptr,uint64_t nwid,const MAC &from,const MAC 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); @@ -1621,13 +1629,19 @@ static int ShttpOnUrl(http_parser *parser,const char *ptr,size_t length) tc->url.append(ptr,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 { + /* TcpConnection *tc = reinterpret_cast<TcpConnection *>(parser->data); tc->messageSize += (unsigned long)length; if (tc->messageSize > ZT_MAX_HTTP_MESSAGE_SIZE) return -1; tc->status.append(ptr,length); + */ return 0; } static int ShttpOnHeaderField(http_parser *parser,const char *ptr,size_t length) |