MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / addReplyVerbatim

Function addReplyVerbatim

src/networking.cpp:1040–1058  ·  view source on GitHub ↗

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 * p

Source from the content-addressed store, hash-verified

1038 * provided one is shorter than that, the remaining is filled with
1039 * spaces. */
1040void addReplyVerbatim(client *c, const char *s, size_t len, const char *ext) {
1041 if (c->resp == 2) {
1042 addReplyBulkCBuffer(c,s,len);
1043 } else {
1044 char buf[32];
1045 size_t preflen = snprintf(buf,sizeof(buf),"=%zu\r\nxxx:",len+4);
1046 char *p = buf+preflen-4;
1047 for (int i = 0; i < 3; i++) {
1048 if (*ext == '\0') {
1049 p[i] = ' ';
1050 } else {
1051 p[i] = *ext++;
1052 }
1053 }
1054 addReplyProto(c,buf,preflen);
1055 addReplyProto(c,s,len);
1056 addReplyProto(c,"\r\n",2);
1057 }
1058}
1059
1060/* Add an array of C strings as status replies with a heading.
1061 * This function is typically invoked by from commands that support

Callers 10

lolwutUnstableCommandFunction · 0.85
latencyCommandFunction · 0.85
clusterCommandFunction · 0.85
lolwut5CommandFunction · 0.85
memoryCommandFunction · 0.85
infoCommandFunction · 0.85
lolwut6CommandFunction · 0.85
debugCommandFunction · 0.85
clientCommandFunction · 0.85

Calls 2

addReplyBulkCBufferFunction · 0.85
addReplyProtoFunction · 0.85

Tested by

no test coverage detected