mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Support yet another old version of http-parser for CentOS/EPEL.
This commit is contained in:
parent
cafa41ba4d
commit
536feb632c
3 changed files with 28 additions and 2 deletions
|
@ -48,6 +48,8 @@ static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnHeadersComplete(http_parser *parser);
|
static int ShttpOnHeadersComplete(http_parser *parser);
|
||||||
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnMessageComplete(http_parser *parser);
|
static int ShttpOnMessageComplete(http_parser *parser);
|
||||||
|
|
||||||
|
#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 1)
|
||||||
static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
||||||
ShttpOnMessageBegin,
|
ShttpOnMessageBegin,
|
||||||
ShttpOnUrl,
|
ShttpOnUrl,
|
||||||
|
@ -58,6 +60,17 @@ static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
||||||
ShttpOnBody,
|
ShttpOnBody,
|
||||||
ShttpOnMessageComplete
|
ShttpOnMessageComplete
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
||||||
|
ShttpOnMessageBegin,
|
||||||
|
ShttpOnUrl,
|
||||||
|
ShttpOnHeaderField,
|
||||||
|
ShttpOnValue,
|
||||||
|
ShttpOnHeadersComplete,
|
||||||
|
ShttpOnBody,
|
||||||
|
ShttpOnMessageComplete
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct HttpPhyHandler
|
struct HttpPhyHandler
|
||||||
{
|
{
|
||||||
|
|
|
@ -252,7 +252,7 @@ public:
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
::send(_whackSendSocket,(const char *)this,1,0);
|
::send(_whackSendSocket,(const char *)this,1,0);
|
||||||
#else
|
#else
|
||||||
(void)::write(_whackSendSocket,(PhySocket *)this,1);
|
(void)(::write(_whackSendSocket,(PhySocket *)this,1));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,7 +871,7 @@ public:
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
::recv(_whackReceiveSocket,tmp,16,0);
|
::recv(_whackReceiveSocket,tmp,16,0);
|
||||||
#else
|
#else
|
||||||
(void)::read(_whackReceiveSocket,tmp,16);
|
(void)(::read(_whackReceiveSocket,tmp,16));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -416,6 +416,8 @@ static int ShttpOnValue(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnHeadersComplete(http_parser *parser);
|
static int ShttpOnHeadersComplete(http_parser *parser);
|
||||||
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length);
|
static int ShttpOnBody(http_parser *parser,const char *ptr,size_t length);
|
||||||
static int ShttpOnMessageComplete(http_parser *parser);
|
static int ShttpOnMessageComplete(http_parser *parser);
|
||||||
|
|
||||||
|
#if (HTTP_PARSER_VERSION_MAJOR >= 2) && (HTTP_PARSER_VERSION_MINOR >= 1)
|
||||||
static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
||||||
ShttpOnMessageBegin,
|
ShttpOnMessageBegin,
|
||||||
ShttpOnUrl,
|
ShttpOnUrl,
|
||||||
|
@ -426,6 +428,17 @@ static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
||||||
ShttpOnBody,
|
ShttpOnBody,
|
||||||
ShttpOnMessageComplete
|
ShttpOnMessageComplete
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
static const struct http_parser_settings HTTP_PARSER_SETTINGS = {
|
||||||
|
ShttpOnMessageBegin,
|
||||||
|
ShttpOnUrl,
|
||||||
|
ShttpOnHeaderField,
|
||||||
|
ShttpOnValue,
|
||||||
|
ShttpOnHeadersComplete,
|
||||||
|
ShttpOnBody,
|
||||||
|
ShttpOnMessageComplete
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct TcpConnection
|
struct TcpConnection
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue