Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
e2911703
R
redis
项目概览
Turbo码先生
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e2911703
编写于
12月 10, 2018
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
RESP3: verbatim reply API + DEBUG PROTOCOL support.
上级
afba2112
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
0 deletion
+32
-0
src/debug.c
src/debug.c
+2
-0
src/networking.c
src/networking.c
+29
-0
src/server.h
src/server.h
+1
-0
未找到文件。
src/debug.c
浏览文件 @
e2911703
...
...
@@ -576,6 +576,8 @@ NULL
addReplyBool
(
c
,
1
);
}
else
if
(
!
strcasecmp
(
name
,
"false"
))
{
addReplyBool
(
c
,
0
);
}
else
if
(
!
strcasecmp
(
name
,
"verbatim"
))
{
addReplyVerbatim
(
c
,
"This is a verbatim
\n
string"
,
25
,
"txt"
);
}
else
{
addReplyError
(
c
,
"Wrong protocol type name. Please use one of the following: string|integer|double|bignum|null|array|set|map|attrib|push|verbatim|true|false|state|err|bloberr"
);
}
...
...
src/networking.c
浏览文件 @
e2911703
...
...
@@ -696,6 +696,35 @@ void addReplyBulkLongLong(client *c, long long ll) {
addReplyBulkCBuffer
(
c
,
buf
,
len
);
}
/* Reply with a verbatim type having the specified extension.
*
* The 'ext' is the "extension" of the file, actually just a three
* character type that describes the format of the verbatim string.
* For instance "txt" means it should be interpreted as a text only
* file by the receiver, "md " as markdown, and so forth. Only the
* three first characters of the extension are used, and if the
* provided one is shorter than that, the remaining is filled with
* spaces. */
void
addReplyVerbatim
(
client
*
c
,
const
char
*
s
,
size_t
len
,
const
char
*
ext
)
{
if
(
c
->
resp
==
2
)
{
addReplyBulkCBuffer
(
c
,
s
,
len
);
}
else
{
char
buf
[
32
];
size_t
preflen
=
snprintf
(
buf
,
sizeof
(
buf
),
"=%zu
\r\n
xxx:"
,
len
+
4
);
char
*
p
=
buf
+
preflen
-
4
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
if
(
*
ext
==
'\0'
)
{
p
[
i
]
=
' '
;
}
else
{
p
[
i
]
=
*
ext
++
;
}
}
addReplyString
(
c
,
buf
,
preflen
);
addReplyString
(
c
,
s
,
len
);
addReplyString
(
c
,
"
\r\n
"
,
2
);
}
}
/* Add an array of C strings as status replies with a heading.
* This function is typically invoked by from commands that support
* subcommands in response to the 'help' subcommand. The help array
...
...
src/server.h
浏览文件 @
e2911703
...
...
@@ -1440,6 +1440,7 @@ void readQueryFromClient(aeEventLoop *el, int fd, void *privdata, int mask);
void
addReplyNull
(
client
*
c
);
void
addReplyNullArray
(
client
*
c
);
void
addReplyBool
(
client
*
c
,
int
b
);
void
addReplyVerbatim
(
client
*
c
,
const
char
*
s
,
size_t
len
,
const
char
*
ext
);
void
addReplyString
(
client
*
c
,
const
char
*
s
,
size_t
len
);
void
addReplyBulk
(
client
*
c
,
robj
*
obj
);
void
addReplyBulkCString
(
client
*
c
,
const
char
*
s
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录