MCPcopy Create free account
hub / github.com/F-Stack/f-stack / addReplyVerbatim

Function addReplyVerbatim

app/redis-6.2.6/src/networking.c:877–895  ·  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

875 * provided one is shorter than that, the remaining is filled with
876 * spaces. */
877void addReplyVerbatim(client *c, const char *s, size_t len, const char *ext) {
878 if (c->resp == 2) {
879 addReplyBulkCBuffer(c,s,len);
880 } else {
881 char buf[32];
882 size_t preflen = snprintf(buf,sizeof(buf),"=%zu\r\nxxx:",len+4);
883 char *p = buf+preflen-4;
884 for (int i = 0; i < 3; i++) {
885 if (*ext == '\0') {
886 p[i] = ' ';
887 } else {
888 p[i] = *ext++;
889 }
890 }
891 addReplyProto(c,buf,preflen);
892 addReplyProto(c,s,len);
893 addReplyProto(c,"\r\n",2);
894 }
895}
896
897/* Add an array of C strings as status replies with a heading.
898 * This function is typically invoked by from commands that support

Callers 10

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

Calls 3

addReplyBulkCBufferFunction · 0.85
snprintfFunction · 0.85
addReplyProtoFunction · 0.85

Tested by

no test coverage detected