Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
dfa681df
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dfa681df
编写于
9月 14, 2020
作者:
R
root
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1291]
上级
0f01ebf5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
60 addition
and
51 deletion
+60
-51
src/plugins/http/inc/httpParser.h
src/plugins/http/inc/httpParser.h
+1
-0
src/plugins/http/src/httpContext.c
src/plugins/http/src/httpContext.c
+13
-13
src/plugins/http/src/httpHandle.c
src/plugins/http/src/httpHandle.c
+2
-2
src/plugins/http/src/httpJson.c
src/plugins/http/src/httpJson.c
+1
-1
src/plugins/http/src/httpParser.c
src/plugins/http/src/httpParser.c
+23
-15
src/plugins/http/src/httpQueue.c
src/plugins/http/src/httpQueue.c
+1
-1
src/plugins/http/src/httpServer.c
src/plugins/http/src/httpServer.c
+3
-3
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+16
-16
未找到文件。
src/plugins/http/inc/httpParser.h
浏览文件 @
dfa681df
...
@@ -111,6 +111,7 @@ typedef struct HttpParser {
...
@@ -111,6 +111,7 @@ typedef struct HttpParser {
void
httpInitParser
(
HttpParser
*
parser
);
void
httpInitParser
(
HttpParser
*
parser
);
HttpParser
*
httpCreateParser
(
struct
HttpContext
*
pContext
);
HttpParser
*
httpCreateParser
(
struct
HttpContext
*
pContext
);
void
httpClearParser
(
HttpParser
*
parser
);
void
httpDestroyParser
(
HttpParser
*
parser
);
void
httpDestroyParser
(
HttpParser
*
parser
);
int32_t
httpParseBuf
(
HttpParser
*
parser
,
const
char
*
buf
,
int32_t
len
);
int32_t
httpParseBuf
(
HttpParser
*
parser
,
const
char
*
buf
,
int32_t
len
);
char
*
httpGetStatusDesc
(
int32_t
statusCode
);
char
*
httpGetStatusDesc
(
int32_t
statusCode
);
...
...
src/plugins/http/src/httpContext.c
浏览文件 @
dfa681df
...
@@ -138,7 +138,7 @@ HttpContext *httpGetContext(void *ptr) {
...
@@ -138,7 +138,7 @@ HttpContext *httpGetContext(void *ptr) {
HttpContext
*
pContext
=
*
ppContext
;
HttpContext
*
pContext
=
*
ppContext
;
if
(
pContext
)
{
if
(
pContext
)
{
int32_t
refCount
=
atomic_add_fetch_32
(
&
pContext
->
refCount
,
1
);
int32_t
refCount
=
atomic_add_fetch_32
(
&
pContext
->
refCount
,
1
);
http
Debug
(
"context:%p, fd:%d, is accquired, data:%p refCount:%d"
,
pContext
,
pContext
->
fd
,
ppContext
,
refCount
);
http
Trace
(
"context:%p, fd:%d, is accquired, data:%p refCount:%d"
,
pContext
,
pContext
->
fd
,
ppContext
,
refCount
);
return
pContext
;
return
pContext
;
}
}
}
}
...
@@ -152,9 +152,9 @@ void httpReleaseContext(HttpContext *pContext) {
...
@@ -152,9 +152,9 @@ void httpReleaseContext(HttpContext *pContext) {
return
;
return
;
}
}
pContext
->
parser
->
inited
=
0
;
httpClearParser
(
pContext
->
parser
)
;
HttpContext
**
ppContext
=
pContext
->
ppContext
;
HttpContext
**
ppContext
=
pContext
->
ppContext
;
http
Debug
(
"context:%p, is released, data:%p refCount:%d"
,
pContext
,
ppContext
,
refCount
);
http
Trace
(
"context:%p, is released, data:%p refCount:%d"
,
pContext
,
ppContext
,
refCount
);
if
(
tsHttpServer
.
contextCache
!=
NULL
)
{
if
(
tsHttpServer
.
contextCache
!=
NULL
)
{
taosCacheRelease
(
tsHttpServer
.
contextCache
,
(
void
**
)(
&
ppContext
),
false
);
taosCacheRelease
(
tsHttpServer
.
contextCache
,
(
void
**
)(
&
ppContext
),
false
);
...
@@ -173,7 +173,7 @@ bool httpInitContext(HttpContext *pContext) {
...
@@ -173,7 +173,7 @@ bool httpInitContext(HttpContext *pContext) {
memset
(
&
pContext
->
singleCmd
,
0
,
sizeof
(
HttpSqlCmd
));
memset
(
&
pContext
->
singleCmd
,
0
,
sizeof
(
HttpSqlCmd
));
http
Debug
(
"context:%p, fd:%d, parsed:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
parsed
);
http
Trace
(
"context:%p, fd:%d, parsed:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
parsed
);
return
true
;
return
true
;
}
}
...
@@ -191,15 +191,15 @@ void httpCloseContextByApp(HttpContext *pContext) {
...
@@ -191,15 +191,15 @@ void httpCloseContextByApp(HttpContext *pContext) {
if
(
keepAlive
)
{
if
(
keepAlive
)
{
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_HANDLING
,
HTTP_CONTEXT_STATE_READY
))
{
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_HANDLING
,
HTTP_CONTEXT_STATE_READY
))
{
http
Debug
(
"context:%p, fd:%d, last state:handling, keepAlive:true, reuse context"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, last state:handling, keepAlive:true, reuse context"
,
pContext
,
pContext
->
fd
);
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_DROPPING
,
HTTP_CONTEXT_STATE_CLOSED
))
{
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_DROPPING
,
HTTP_CONTEXT_STATE_CLOSED
))
{
httpRemoveContextFromEpoll
(
pContext
);
httpRemoveContextFromEpoll
(
pContext
);
http
Debug
(
"context:%p, fd:%d, ast state:dropping, keepAlive:true, close connect"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, ast state:dropping, keepAlive:true, close connect"
,
pContext
,
pContext
->
fd
);
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_READY
))
{
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_READY
))
{
http
Debug
(
"context:%p, fd:%d, last state:ready, keepAlive:true, reuse context"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, last state:ready, keepAlive:true, reuse context"
,
pContext
,
pContext
->
fd
);
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_CLOSED
,
HTTP_CONTEXT_STATE_CLOSED
))
{
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_CLOSED
,
HTTP_CONTEXT_STATE_CLOSED
))
{
httpRemoveContextFromEpoll
(
pContext
);
httpRemoveContextFromEpoll
(
pContext
);
http
Debug
(
"context:%p, fd:%d, last state:ready, keepAlive:true, close connect"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, last state:ready, keepAlive:true, close connect"
,
pContext
,
pContext
->
fd
);
}
else
{
}
else
{
httpRemoveContextFromEpoll
(
pContext
);
httpRemoveContextFromEpoll
(
pContext
);
httpError
(
"context:%p, fd:%d, last state:%s:%d, keepAlive:true, close connect"
,
pContext
,
pContext
->
fd
,
httpError
(
"context:%p, fd:%d, last state:%s:%d, keepAlive:true, close connect"
,
pContext
,
pContext
->
fd
,
...
@@ -207,7 +207,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
...
@@ -207,7 +207,7 @@ void httpCloseContextByApp(HttpContext *pContext) {
}
}
}
else
{
}
else
{
httpRemoveContextFromEpoll
(
pContext
);
httpRemoveContextFromEpoll
(
pContext
);
http
Debug
(
"context:%p, fd:%d, ilast state:%s:%d, keepAlive:false, close context"
,
pContext
,
pContext
->
fd
,
http
Trace
(
"context:%p, fd:%d, ilast state:%s:%d, keepAlive:false, close context"
,
pContext
,
pContext
->
fd
,
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
httpContextStateStr
(
pContext
->
state
),
pContext
->
state
);
}
}
...
@@ -216,13 +216,13 @@ void httpCloseContextByApp(HttpContext *pContext) {
...
@@ -216,13 +216,13 @@ void httpCloseContextByApp(HttpContext *pContext) {
void
httpCloseContextByServer
(
HttpContext
*
pContext
)
{
void
httpCloseContextByServer
(
HttpContext
*
pContext
)
{
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_HANDLING
,
HTTP_CONTEXT_STATE_DROPPING
))
{
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_HANDLING
,
HTTP_CONTEXT_STATE_DROPPING
))
{
http
Debug
(
"context:%p, fd:%d, epoll finished, still used by app"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, epoll finished, still used by app"
,
pContext
,
pContext
->
fd
);
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_DROPPING
,
HTTP_CONTEXT_STATE_DROPPING
))
{
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_DROPPING
,
HTTP_CONTEXT_STATE_DROPPING
))
{
http
Debug
(
"context:%p, fd:%d, epoll already finished, wait app finished"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, epoll already finished, wait app finished"
,
pContext
,
pContext
->
fd
);
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_CLOSED
))
{
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_CLOSED
))
{
http
Debug
(
"context:%p, fd:%d, epoll finished, close connect"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, epoll finished, close connect"
,
pContext
,
pContext
->
fd
);
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_CLOSED
,
HTTP_CONTEXT_STATE_CLOSED
))
{
}
else
if
(
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_CLOSED
,
HTTP_CONTEXT_STATE_CLOSED
))
{
http
Debug
(
"context:%p, fd:%d, epoll finished, will be closed soon"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, epoll finished, will be closed soon"
,
pContext
,
pContext
->
fd
);
}
else
{
}
else
{
httpError
(
"context:%p, fd:%d, unknown state:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
state
);
httpError
(
"context:%p, fd:%d, unknown state:%d"
,
pContext
,
pContext
->
fd
,
pContext
->
state
);
}
}
...
...
src/plugins/http/src/httpHandle.c
浏览文件 @
dfa681df
...
@@ -33,7 +33,7 @@ bool httpDecodeRequest(HttpContext* pContext) {
...
@@ -33,7 +33,7 @@ bool httpDecodeRequest(HttpContext* pContext) {
*/
*/
bool
httpProcessData
(
HttpContext
*
pContext
)
{
bool
httpProcessData
(
HttpContext
*
pContext
)
{
if
(
!
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_HANDLING
))
{
if
(
!
httpAlterContextState
(
pContext
,
HTTP_CONTEXT_STATE_READY
,
HTTP_CONTEXT_STATE_HANDLING
))
{
http
Debug
(
"context:%p, fd:%d, state:%s not in ready state, stop process request"
,
pContext
,
pContext
->
fd
,
http
Trace
(
"context:%p, fd:%d, state:%s not in ready state, stop process request"
,
pContext
,
pContext
->
fd
,
httpContextStateStr
(
pContext
->
state
));
httpContextStateStr
(
pContext
->
state
));
httpCloseContextByApp
(
pContext
);
httpCloseContextByApp
(
pContext
);
return
false
;
return
false
;
...
@@ -41,7 +41,7 @@ bool httpProcessData(HttpContext* pContext) {
...
@@ -41,7 +41,7 @@ bool httpProcessData(HttpContext* pContext) {
// handle Cross-domain request
// handle Cross-domain request
if
(
strcmp
(
pContext
->
parser
->
method
,
"OPTIONS"
)
==
0
)
{
if
(
strcmp
(
pContext
->
parser
->
method
,
"OPTIONS"
)
==
0
)
{
http
Debug
(
"context:%p, fd:%d, process options request"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, process options request"
,
pContext
,
pContext
->
fd
);
httpSendOptionResp
(
pContext
,
"process options request success"
);
httpSendOptionResp
(
pContext
,
"process options request success"
);
}
else
{
}
else
{
if
(
!
httpDecodeRequest
(
pContext
))
{
if
(
!
httpDecodeRequest
(
pContext
))
{
...
...
src/plugins/http/src/httpJson.c
浏览文件 @
dfa681df
...
@@ -189,7 +189,7 @@ void httpInitJsonBuf(JsonBuf* buf, struct HttpContext* pContext) {
...
@@ -189,7 +189,7 @@ void httpInitJsonBuf(JsonBuf* buf, struct HttpContext* pContext) {
httpGzipCompressInit
(
buf
->
pContext
);
httpGzipCompressInit
(
buf
->
pContext
);
}
}
http
Debug
(
"context:%p, fd:%d, json buffer initialized"
,
buf
->
pContext
,
buf
->
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, json buffer initialized"
,
buf
->
pContext
,
buf
->
pContext
->
fd
);
}
}
void
httpJsonItemToken
(
JsonBuf
*
buf
)
{
void
httpJsonItemToken
(
JsonBuf
*
buf
)
{
...
...
src/plugins/http/src/httpParser.c
浏览文件 @
dfa681df
...
@@ -178,7 +178,7 @@ static int32_t httpOnRequestLine(HttpParser *pParser, char *method, char *target
...
@@ -178,7 +178,7 @@ static int32_t httpOnRequestLine(HttpParser *pParser, char *method, char *target
}
}
if
(
pContext
->
decodeMethod
!=
NULL
)
{
if
(
pContext
->
decodeMethod
!=
NULL
)
{
http
Debug
(
"context:%p, fd:%d, decode method is %s"
,
pContext
,
pContext
->
fd
,
pContext
->
decodeMethod
->
module
);
http
Trace
(
"context:%p, fd:%d, decode method is %s"
,
pContext
,
pContext
->
fd
,
pContext
->
decodeMethod
->
module
);
}
else
{
}
else
{
httpError
(
"context:%p, fd:%d, the url is not support, target:%s"
,
pContext
,
pContext
->
fd
,
target
);
httpError
(
"context:%p, fd:%d, the url is not support, target:%s"
,
pContext
,
pContext
->
fd
,
target
);
httpOnError
(
pParser
,
0
,
TSDB_CODE_HTTP_UNSUPPORT_URL
);
httpOnError
(
pParser
,
0
,
TSDB_CODE_HTTP_UNSUPPORT_URL
);
...
@@ -190,7 +190,7 @@ static int32_t httpOnRequestLine(HttpParser *pParser, char *method, char *target
...
@@ -190,7 +190,7 @@ static int32_t httpOnRequestLine(HttpParser *pParser, char *method, char *target
httpError
(
"context:%p, fd:%d, unsupport httpVersion %d"
,
pContext
,
pContext
->
fd
,
pParser
->
httpVersion
);
httpError
(
"context:%p, fd:%d, unsupport httpVersion %d"
,
pContext
,
pContext
->
fd
,
pParser
->
httpVersion
);
httpOnError
(
pParser
,
0
,
TSDB_CODE_HTTP_INVALID_VERSION
);
httpOnError
(
pParser
,
0
,
TSDB_CODE_HTTP_INVALID_VERSION
);
}
else
{
}
else
{
http
Debug
(
"context:%p, fd:%d, httpVersion:1.%d"
,
pContext
,
pContext
->
fd
,
pParser
->
httpVersion
);
http
Trace
(
"context:%p, fd:%d, httpVersion:1.%d"
,
pContext
,
pContext
->
fd
,
pParser
->
httpVersion
);
}
}
return
0
;
return
0
;
...
@@ -204,7 +204,7 @@ static int32_t httpOnStatusLine(HttpParser *pParser, int32_t code, const char *r
...
@@ -204,7 +204,7 @@ static int32_t httpOnStatusLine(HttpParser *pParser, int32_t code, const char *r
static
int32_t
httpOnParseHeaderField
(
HttpParser
*
parser
,
const
char
*
key
,
const
char
*
val
)
{
static
int32_t
httpOnParseHeaderField
(
HttpParser
*
parser
,
const
char
*
key
,
const
char
*
val
)
{
HttpContext
*
pContext
=
parser
->
pContext
;
HttpContext
*
pContext
=
parser
->
pContext
;
http
Debug
(
"context:%p, fd:%d, key:%s val:%s"
,
pContext
,
pContext
->
fd
,
key
,
val
);
http
Trace
(
"context:%p, fd:%d, key:%s val:%s"
,
pContext
,
pContext
->
fd
,
key
,
val
);
if
(
0
==
strcasecmp
(
key
,
"Content-Length"
))
{
if
(
0
==
strcasecmp
(
key
,
"Content-Length"
))
{
int32_t
len
=
0
;
int32_t
len
=
0
;
...
@@ -214,7 +214,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
...
@@ -214,7 +214,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
parser
->
contentLength
=
len
;
parser
->
contentLength
=
len
;
parser
->
chunkSize
=
len
;
parser
->
chunkSize
=
len
;
parser
->
contentLengthSpecified
=
1
;
parser
->
contentLengthSpecified
=
1
;
http
Debug
(
"context:%p, fd:%d, contentLength:%d chunkSize:%d contentLengthSpecified:%d"
,
pContext
,
pContext
->
fd
,
http
Trace
(
"context:%p, fd:%d, contentLength:%d chunkSize:%d contentLengthSpecified:%d"
,
pContext
,
pContext
->
fd
,
parser
->
contentLength
,
parser
->
chunkSize
,
parser
->
contentLengthSpecified
);
parser
->
contentLength
,
parser
->
chunkSize
,
parser
->
contentLengthSpecified
);
return
0
;
return
0
;
}
else
{
}
else
{
...
@@ -227,11 +227,11 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
...
@@ -227,11 +227,11 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
else
if
(
0
==
strcasecmp
(
key
,
"Accept-Encoding"
))
{
else
if
(
0
==
strcasecmp
(
key
,
"Accept-Encoding"
))
{
if
(
strstr
(
val
,
"gzip"
))
{
if
(
strstr
(
val
,
"gzip"
))
{
parser
->
acceptEncodingGzip
=
1
;
parser
->
acceptEncodingGzip
=
1
;
http
Debug
(
"context:%p, fd:%d, acceptEncodingGzip:%d"
,
pContext
,
pContext
->
fd
,
parser
->
acceptEncodingGzip
);
http
Trace
(
"context:%p, fd:%d, acceptEncodingGzip:%d"
,
pContext
,
pContext
->
fd
,
parser
->
acceptEncodingGzip
);
}
}
if
(
strstr
(
val
,
"chunked"
))
{
if
(
strstr
(
val
,
"chunked"
))
{
parser
->
acceptEncodingChunked
=
1
;
parser
->
acceptEncodingChunked
=
1
;
http
Debug
(
"context:%p, fd:%d, acceptEncodingChunked:%d"
,
pContext
,
pContext
->
fd
,
parser
->
acceptEncodingChunked
);
http
Trace
(
"context:%p, fd:%d, acceptEncodingChunked:%d"
,
pContext
,
pContext
->
fd
,
parser
->
acceptEncodingChunked
);
}
}
return
0
;
return
0
;
}
}
...
@@ -248,7 +248,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
...
@@ -248,7 +248,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
else
if
(
0
==
strcasecmp
(
key
,
"Content-Encoding"
))
{
else
if
(
0
==
strcasecmp
(
key
,
"Content-Encoding"
))
{
if
(
0
==
strcmp
(
val
,
"gzip"
))
{
if
(
0
==
strcmp
(
val
,
"gzip"
))
{
parser
->
contentChunked
=
1
;
parser
->
contentChunked
=
1
;
http
Debug
(
"context:%p, fd:%d, contentChunked:%d"
,
pContext
,
pContext
->
fd
,
parser
->
contentChunked
);
http
Trace
(
"context:%p, fd:%d, contentChunked:%d"
,
pContext
,
pContext
->
fd
,
parser
->
contentChunked
);
}
}
return
0
;
return
0
;
}
}
...
@@ -271,7 +271,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
...
@@ -271,7 +271,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
}
}
if
(
strstr
(
val
,
"chunked"
))
{
if
(
strstr
(
val
,
"chunked"
))
{
parser
->
transferChunked
=
1
;
parser
->
transferChunked
=
1
;
http
Debug
(
"context:%p, fd:%d, transferChunked:%d"
,
pContext
,
pContext
->
fd
,
parser
->
transferChunked
);
http
Trace
(
"context:%p, fd:%d, transferChunked:%d"
,
pContext
,
pContext
->
fd
,
parser
->
transferChunked
);
}
}
return
0
;
return
0
;
}
}
...
@@ -289,7 +289,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
...
@@ -289,7 +289,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
s
=
NULL
;
s
=
NULL
;
free
(
t
);
free
(
t
);
free
(
s
);
free
(
s
);
http
Debug
(
"context:%p, fd:%d, basic auth:%s"
,
pContext
,
pContext
->
fd
,
parser
->
authContent
);
http
Trace
(
"context:%p, fd:%d, basic auth:%s"
,
pContext
,
pContext
->
fd
,
parser
->
authContent
);
int32_t
ok
=
httpParseBasicAuthToken
(
pContext
,
parser
->
authContent
,
strlen
(
parser
->
authContent
));
int32_t
ok
=
httpParseBasicAuthToken
(
pContext
,
parser
->
authContent
,
strlen
(
parser
->
authContent
));
if
(
ok
!=
0
)
{
if
(
ok
!=
0
)
{
httpOnError
(
parser
,
0
,
TSDB_CODE_HTTP_INVALID_BASIC_AUTH
);
httpOnError
(
parser
,
0
,
TSDB_CODE_HTTP_INVALID_BASIC_AUTH
);
...
@@ -303,7 +303,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
...
@@ -303,7 +303,7 @@ static int32_t httpOnParseHeaderField(HttpParser *parser, const char *key, const
s
=
NULL
;
s
=
NULL
;
free
(
t
);
free
(
t
);
free
(
s
);
free
(
s
);
http
Debug
(
"context:%p, fd:%d, taosd auth:%s"
,
pContext
,
pContext
->
fd
,
parser
->
authContent
);
http
Trace
(
"context:%p, fd:%d, taosd auth:%s"
,
pContext
,
pContext
->
fd
,
parser
->
authContent
);
int32_t
ok
=
httpParseTaosdAuthToken
(
pContext
,
parser
->
authContent
,
strlen
(
parser
->
authContent
));
int32_t
ok
=
httpParseTaosdAuthToken
(
pContext
,
parser
->
authContent
,
strlen
(
parser
->
authContent
));
if
(
ok
!=
0
)
{
if
(
ok
!=
0
)
{
httpOnError
(
parser
,
0
,
TSDB_CODE_HTTP_INVALID_TAOSD_AUTH
);
httpOnError
(
parser
,
0
,
TSDB_CODE_HTTP_INVALID_TAOSD_AUTH
);
...
@@ -371,7 +371,7 @@ static int32_t httpOnEnd(HttpParser *parser) {
...
@@ -371,7 +371,7 @@ static int32_t httpOnEnd(HttpParser *parser) {
return
-
1
;
return
-
1
;
}
}
http
Debug
(
"context:%p, fd:%d, parse success"
,
pContext
,
pContext
->
fd
);
http
Trace
(
"context:%p, fd:%d, parse success"
,
pContext
,
pContext
->
fd
);
return
0
;
return
0
;
}
}
...
@@ -422,7 +422,7 @@ static int32_t httpCleanupStack(HttpStack *stack) {
...
@@ -422,7 +422,7 @@ static int32_t httpCleanupStack(HttpStack *stack) {
void
httpInitParser
(
HttpParser
*
parser
)
{
void
httpInitParser
(
HttpParser
*
parser
)
{
HttpContext
*
pContext
=
parser
->
pContext
;
HttpContext
*
pContext
=
parser
->
pContext
;
httpTrace
(
"context:%p, fd:%d,
free
parser"
,
pContext
,
pContext
->
fd
);
httpTrace
(
"context:%p, fd:%d,
init
parser"
,
pContext
,
pContext
->
fd
);
parser
->
parsed
=
false
;
parser
->
parsed
=
false
;
parser
->
inited
=
1
;
parser
->
inited
=
1
;
...
@@ -475,9 +475,17 @@ HttpParser *httpCreateParser(HttpContext *pContext) {
...
@@ -475,9 +475,17 @@ HttpParser *httpCreateParser(HttpContext *pContext) {
return
parser
;
return
parser
;
}
}
void
httpClearParser
(
HttpParser
*
parser
)
{
HttpContext
*
pContext
=
parser
->
pContext
;
httpTrace
(
"context:%p, fd:%d, clear parser"
,
pContext
,
pContext
->
fd
);
pContext
->
parser
->
inited
=
0
;
pContext
->
parser
->
parsed
=
false
;
}
void
httpDestroyParser
(
HttpParser
*
parser
)
{
void
httpDestroyParser
(
HttpParser
*
parser
)
{
HttpContext
*
pContext
=
parser
->
pContext
;
HttpContext
*
pContext
=
parser
->
pContext
;
httpTrace
(
"context:%p, fd:%d,
free
parser"
,
pContext
,
pContext
->
fd
);
httpTrace
(
"context:%p, fd:%d,
destroy
parser"
,
pContext
,
pContext
->
fd
);
if
(
!
parser
)
return
;
if
(
!
parser
)
return
;
...
@@ -603,7 +611,7 @@ static int32_t httpParserOnMethod(HttpParser *parser, HTTP_PARSER_STATE state, c
...
@@ -603,7 +611,7 @@ static int32_t httpParserOnMethod(HttpParser *parser, HTTP_PARSER_STATE state, c
do
{
do
{
if
(
isalnum
(
c
)
||
strchr
(
"!#$%&'*+-.^_`|~"
,
c
))
{
if
(
isalnum
(
c
)
||
strchr
(
"!#$%&'*+-.^_`|~"
,
c
))
{
if
(
httpAppendString
(
&
parser
->
str
,
&
c
,
1
))
{
if
(
httpAppendString
(
&
parser
->
str
,
&
c
,
1
))
{
http
Debug
(
"context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom"
,
pContext
,
pContext
->
fd
,
state
,
c
,
c
);
http
Error
(
"context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom"
,
pContext
,
pContext
->
fd
,
state
,
c
,
c
);
ok
=
-
1
;
ok
=
-
1
;
httpOnError
(
parser
,
507
,
TSDB_CODE_HTTP_PARSE_METHOD_FAILED
);
httpOnError
(
parser
,
507
,
TSDB_CODE_HTTP_PARSE_METHOD_FAILED
);
break
;
break
;
...
@@ -719,7 +727,7 @@ static int32_t httpParserOnSp(HttpParser *parser, HTTP_PARSER_STATE state, const
...
@@ -719,7 +727,7 @@ static int32_t httpParserOnSp(HttpParser *parser, HTTP_PARSER_STATE state, const
httpPopStack
(
parser
);
httpPopStack
(
parser
);
break
;
break
;
}
}
http
Debug
(
"context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom"
,
pContext
,
pContext
->
fd
,
state
,
c
,
c
);
http
Error
(
"context:%p, fd:%d, parser state:%d, char:[%c]%02x, oom"
,
pContext
,
pContext
->
fd
,
state
,
c
,
c
);
ok
=
-
1
;
ok
=
-
1
;
httpOnError
(
parser
,
507
,
TSDB_CODE_HTTP_PARSE_SP_FAILED
);
httpOnError
(
parser
,
507
,
TSDB_CODE_HTTP_PARSE_SP_FAILED
);
}
while
(
0
);
}
while
(
0
);
...
...
src/plugins/http/src/httpQueue.c
浏览文件 @
dfa681df
...
@@ -71,7 +71,7 @@ static void *httpProcessResultQueue(void *param) {
...
@@ -71,7 +71,7 @@ static void *httpProcessResultQueue(void *param) {
break
;
break
;
}
}
http
Debug
(
"context:%p, res:%p will be processed in result queue"
,
pMsg
->
param
,
pMsg
->
result
);
http
Trace
(
"context:%p, res:%p will be processed in result queue"
,
pMsg
->
param
,
pMsg
->
result
);
(
*
pMsg
->
fp
)(
pMsg
->
param
,
pMsg
->
result
,
pMsg
->
numOfRows
);
(
*
pMsg
->
fp
)(
pMsg
->
param
,
pMsg
->
result
,
pMsg
->
numOfRows
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
...
src/plugins/http/src/httpServer.c
浏览文件 @
dfa681df
...
@@ -302,11 +302,11 @@ bool httpInitConnect() {
...
@@ -302,11 +302,11 @@ bool httpInitConnect() {
static
bool
httpReadData
(
HttpContext
*
pContext
)
{
static
bool
httpReadData
(
HttpContext
*
pContext
)
{
HttpParser
*
pParser
=
pContext
->
parser
;
HttpParser
*
pParser
=
pContext
->
parser
;
ASSERT
(
!
pParser
->
parsed
);
if
(
!
pParser
->
inited
)
{
if
(
!
pParser
->
inited
)
{
httpInitParser
(
pParser
);
httpInitParser
(
pParser
);
}
}
ASSERT
(
!
pParser
->
parsed
);
pContext
->
accessTimes
++
;
pContext
->
accessTimes
++
;
pContext
->
lastAccessTime
=
taosGetTimestampSec
();
pContext
->
lastAccessTime
=
taosGetTimestampSec
();
...
@@ -332,10 +332,10 @@ static bool httpReadData(HttpContext *pContext) {
...
@@ -332,10 +332,10 @@ static bool httpReadData(HttpContext *pContext) {
}
}
if
(
!
pParser
->
parsed
)
{
if
(
!
pParser
->
parsed
)
{
http
Debug
(
"context:%p, fd:%d, read not over yet, len:%d"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
);
http
Trace
(
"context:%p, fd:%d, read not over yet, len:%d"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
);
return
false
;
return
false
;
}
else
{
}
else
{
http
Debug
(
"context:%p, fd:%d, len:%d, body:%s"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
,
pParser
->
body
.
str
);
http
TraceL
(
"context:%p, fd:%d, len:%d, body:%s"
,
pContext
,
pContext
->
fd
,
pParser
->
body
.
pos
,
pParser
->
body
.
str
);
return
true
;
return
true
;
}
}
}
else
if
(
nread
<
0
)
{
}
else
if
(
nread
<
0
)
{
...
...
tests/script/sh/deploy.sh
浏览文件 @
dfa681df
...
@@ -111,23 +111,23 @@ echo "serverPort ${NODE}" >> $TAOS_CFG
...
@@ -111,23 +111,23 @@ echo "serverPort ${NODE}" >> $TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"dataDir
$DATA_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"logDir
$LOG_DIR
"
>>
$TAOS_CFG
echo
"debugFlag 0"
>>
$TAOS_CFG
echo
"debugFlag 0"
>>
$TAOS_CFG
echo
"mDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"mDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"sdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"dDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"vDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"tsdbDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"cDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"cDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
1
"
>>
$TAOS_CFG
echo
"jnidebugFlag 13
5
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"odbcdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"httpDebugFlag
207
"
>>
$TAOS_CFG
echo
"httpDebugFlag
135
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"monitorDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"mqttDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"qdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"udebugFlag 13
1
"
>>
$TAOS_CFG
echo
"udebugFlag 13
5
"
>>
$TAOS_CFG
echo
"sdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"sdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"wdebugFlag 13
1
"
>>
$TAOS_CFG
echo
"wdebugFlag 13
5
"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitor 0"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"monitorInterval 1"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
echo
"http 0"
>>
$TAOS_CFG
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录