commit 448c4ad

default  ·  2023-01-08 09:02:31 +0000 UTC
parent 384cb74
The headers of signature errors are archived in the ~/error directory (if exists).
1 files changed,  +14, -0
M http.c
M http.c
+14, -0
 1@@ -7,6 +7,7 @@
 2 #include "xs_openssl.h"
 3 #include "xs_curl.h"
 4 #include "xs_time.h"
 5+#include "xs_json.h"
 6 
 7 #include "snac.h"
 8 
 9@@ -210,5 +211,18 @@ int check_signature(snac *snac, char *req)
10     return 1;
11 
12 error:
13+    {
14+        xs *ntid = tid(0);
15+        xs *fn   = xs_fmt("%s/error/check_signature_%s.json", snac->basedir, ntid);
16+        FILE *f;
17+
18+        if ((f = fopen(fn, "w")) != NULL) {
19+            xs *j = xs_json_dumps_pp(req, 4);
20+
21+            fwrite(j, strlen(j), 1, f);
22+            fclose(f);
23+        }
24+    }
25+
26     return 0;
27 }