Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Questdb
提交
2f3e5c93
Q
Questdb
项目概览
jobily
/
Questdb
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Questdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2f3e5c93
编写于
7月 15, 2020
作者:
V
Vlad Ilyushchenko
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(http): escape ascii 0 character in JSON
上级
9d4d4b45
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
59 addition
and
2 deletion
+59
-2
core/src/main/java/io/questdb/cutlass/http/HttpResponseSink.java
...c/main/java/io/questdb/cutlass/http/HttpResponseSink.java
+2
-0
core/src/test/java/io/questdb/cutlass/http/IODispatcherTest.java
...c/test/java/io/questdb/cutlass/http/IODispatcherTest.java
+57
-2
未找到文件。
core/src/main/java/io/questdb/cutlass/http/HttpResponseSink.java
浏览文件 @
2f3e5c93
...
...
@@ -575,6 +575,8 @@ public class HttpResponseSink implements Closeable, Mutable {
private
void
escapeSpace
(
char
c
)
{
switch
(
c
)
{
case
'\0'
:
break
;
case
'\b'
:
put
(
"\\b"
);
break
;
...
...
core/src/test/java/io/questdb/cutlass/http/IODispatcherTest.java
浏览文件 @
2f3e5c93
...
...
@@ -109,6 +109,23 @@ public class IODispatcherTest {
Assert
.
assertEquals
(
requestLen
,
Net
.
send
(
fd
,
buffer
,
requestLen
));
}
public
static
void
createTestTable
(
CairoConfiguration
configuration
,
int
n
)
{
try
(
TableModel
model
=
new
TableModel
(
configuration
,
"y"
,
PartitionBy
.
NONE
))
{
model
.
col
(
"j"
,
ColumnType
.
SYMBOL
);
CairoTestUtils
.
create
(
model
);
}
try
(
TableWriter
writer
=
new
TableWriter
(
configuration
,
"y"
))
{
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
TableWriter
.
Row
row
=
writer
.
newRow
();
row
.
putSym
(
0
,
"ok\0ok"
);
row
.
append
();
}
writer
.
commit
();
}
}
@Test
public
void
testBiasWrite
()
throws
Exception
{
...
...
@@ -1924,6 +1941,44 @@ public class IODispatcherTest {
);
}
@Test
public
void
testJsonQueryJsonReplaceZero
()
throws
Exception
{
testJsonQuery0
(
2
,
engine
->
{
// create table with all column types
createTestTable
(
engine
.
getConfiguration
(),
20
);
sendAndReceive
(
NetworkFacadeImpl
.
INSTANCE
,
"GET /query?query=y HTTP/1.1\r\n"
+
"Host: localhost:9001\r\n"
+
"Connection: keep-alive\r\n"
+
"Cache-Control: max-age=0\r\n"
+
"Upgrade-Insecure-Requests: 1\r\n"
+
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36\r\n"
+
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3\r\n"
+
"Accept-Encoding: gzip, deflate, br\r\n"
+
"Accept-Language: en-GB,en-US;q=0.9,en;q=0.8\r\n"
+
"\r\n"
,
"HTTP/1.1 200 OK\r\n"
+
"Server: questDB/1.0\r\n"
+
"Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n"
+
"Transfer-Encoding: chunked\r\n"
+
"Content-Type: application/json; charset=utf-8\r\n"
+
"Keep-Alive: timeout=5, max=10000\r\n"
+
"\r\n"
+
"0101\r\n"
+
"{\"query\":\"y\",\"columns\":[{\"name\":\"j\",\"type\":\"SYMBOL\"}],\"dataset\":[[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"],[\"okok\"]],\"count\":20}\r\n"
+
"00\r\n"
+
"\r\n"
,
100
,
0
,
false
);
},
false
);
}
@Test
public
void
testMissingURL
()
throws
Exception
{
testJsonQuery0
(
2
,
engine
->
{
...
...
@@ -3185,7 +3240,7 @@ public class IODispatcherTest {
"0185\r\n"
+
"{\"query\":\"x\",\"columns\":[{\"name\":\"a\",\"type\":\"BYTE\"},{\"name\":\"b\",\"type\":\"SHORT\"},{\"name\":\"c\",\"type\":\"INT\"},{\"name\":\"d\",\"type\":\"LONG\"},{\"name\":\"e\",\"type\":\"DATE\"},{\"name\":\"f\",\"type\":\"TIMESTAMP\"},{\"name\":\"g\",\"type\":\"FLOAT\"},{\"name\":\"h\",\"type\":\"DOUBLE\"},{\"name\":\"i\",\"type\":\"STRING\"},{\"name\":\"j\",\"type\":\"SYMBOL\"},{\"name\":\"k\",\"type\":\"BOOLEAN\"},{\"name\":\"l\",\"type\":\"BINARY\"}],\"dataset\":[],\"count\":0}\r\n"
+
"00\r\n"
+
"\r\n"
,
"\r\n"
,
1
,
true
);
...
...
@@ -3225,7 +3280,7 @@ public class IODispatcherTest {
"0185\r\n"
+
"{\"query\":\"x\",\"columns\":[{\"name\":\"a\",\"type\":\"BYTE\"},{\"name\":\"b\",\"type\":\"SHORT\"},{\"name\":\"c\",\"type\":\"INT\"},{\"name\":\"d\",\"type\":\"LONG\"},{\"name\":\"e\",\"type\":\"DATE\"},{\"name\":\"f\",\"type\":\"TIMESTAMP\"},{\"name\":\"g\",\"type\":\"FLOAT\"},{\"name\":\"h\",\"type\":\"DOUBLE\"},{\"name\":\"i\",\"type\":\"STRING\"},{\"name\":\"j\",\"type\":\"SYMBOL\"},{\"name\":\"k\",\"type\":\"BOOLEAN\"},{\"name\":\"l\",\"type\":\"BINARY\"}],\"dataset\":[],\"count\":0}\r\n"
+
"00\r\n"
+
"\r\n"
,
"\r\n"
,
2
,
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录