From 64b7b66e3bdadde6e6a407da3f336b8a9cff0596 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 25 Sep 2022 21:52:41 +0200 Subject: [PATCH] Always write a raw payload in srv_archive(). --- snac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/snac.c b/snac.c index 9532c3b..52ac7d3 100644 --- a/snac.c +++ b/snac.c @@ -164,6 +164,7 @@ void srv_archive(char *direction, char *req, char *payload, int p_size, if (p_size && payload) { xs *payload_fn; + xs *payload_fn_raw; char *v = xs_dict_get(req, "content-type"); if (v && xs_str_in(v, "json") != -1) { @@ -181,13 +182,12 @@ void srv_archive(char *direction, char *req, char *payload, int p_size, fclose(f); } } - else { - payload_fn = xs_fmt("%s/payload", dir); - if ((f = fopen(payload_fn, "w")) != NULL) { - fwrite(payload, p_size, 1, f); - fclose(f); - } + payload_fn_raw = xs_fmt("%s/payload", dir); + + if ((f = fopen(payload_fn_raw, "w")) != NULL) { + fwrite(payload, p_size, 1, f); + fclose(f); } }