From 448c4ad7a26fbfac3f9bf68861672c4833cf72a2 Mon Sep 17 00:00:00 2001 From: default Date: Sun, 8 Jan 2023 10:02:31 +0100 Subject: [PATCH] The headers of signature errors are archived in the ~/error directory (if exists). --- http.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/http.c b/http.c index 26ded53..18c4e47 100644 --- a/http.c +++ b/http.c @@ -7,6 +7,7 @@ #include "xs_openssl.h" #include "xs_curl.h" #include "xs_time.h" +#include "xs_json.h" #include "snac.h" @@ -210,5 +211,18 @@ int check_signature(snac *snac, char *req) return 1; error: + { + xs *ntid = tid(0); + xs *fn = xs_fmt("%s/error/check_signature_%s.json", snac->basedir, ntid); + FILE *f; + + if ((f = fopen(fn, "w")) != NULL) { + xs *j = xs_json_dumps_pp(req, 4); + + fwrite(j, strlen(j), 1, f); + fclose(f); + } + } + return 0; }