Browse Source

Include bkey header length in forward_passthrough_msg

master
ckolivas 9 years ago
parent
commit
e223264717
  1. 8
      src/generator.c

8
src/generator.c

@ -1924,14 +1924,17 @@ static void reconnect_proxy(proxy_instance_t *proxi)
static void forward_passthrough_msg(ckpool_t *ckp, char *buf, int len) static void forward_passthrough_msg(ckpool_t *ckp, char *buf, int len)
{ {
int slen = strlen(buf), blen = len - slen; int slen = strlen(buf);
char *bkey = NULL; char *bkey = NULL;
if (unlikely(blen > 0)) if (unlikely(len > slen)) {
bkey = strstr(buf + slen - 5, "bkey"); bkey = strstr(buf + slen - 5, "bkey");
if (bkey) { if (bkey) {
json_t *val = json_loads(buf, JSON_DISABLE_EOF_CHECK, NULL); json_t *val = json_loads(buf, JSON_DISABLE_EOF_CHECK, NULL);
int blen;
LOGDEBUG("Bkey found in forward_passthrough_msg");
blen = len - (bkey - buf);
if (unlikely(!val)) { if (unlikely(!val)) {
LOGWARNING("No json in bkey appended message %s", buf); LOGWARNING("No json in bkey appended message %s", buf);
goto out; goto out;
@ -1944,6 +1947,7 @@ static void forward_passthrough_msg(ckpool_t *ckp, char *buf, int len)
free(buf); free(buf);
return; return;
} }
}
out: out:
LOGDEBUG("Passthrough recv received upstream msg: %s", buf); LOGDEBUG("Passthrough recv received upstream msg: %s", buf);
send_proc(ckp->connector, buf); send_proc(ckp->connector, buf);

Loading…
Cancel
Save