commit b2ce932
default
·
2023-03-02 16:13:17 +0000 UTC
parent 8451d66
Added the url to srv_archive().
M
data.c
+9,
-1
1@@ -1818,7 +1818,7 @@ void purge_all(void)
2
3 /** archive **/
4
5-void srv_archive(const char *direction, xs_dict *req,
6+void srv_archive(const char *direction, const char *url, xs_dict *req,
7 const char *payload, int p_size,
8 int status, xs_dict *headers,
9 const char *body, int b_size)
10@@ -1837,6 +1837,10 @@ void srv_archive(const char *direction, xs_dict *req,
11 xs *j2 = xs_json_dumps_pp(headers, 4);
12
13 fprintf(f, "dir: %s\n", direction);
14+
15+ if (url)
16+ fprintf(f, "url: %s\n", url);
17+
18 fprintf(f, "req: %s\n", j1);
19 fprintf(f, "p_size: %d\n", p_size);
20 fprintf(f, "status: %d\n", status);
21@@ -1928,6 +1932,8 @@ void srv_archive_error(const char *prefix, const xs_str *err,
22
23 xs *j = xs_json_dumps_pp(req, 4);
24 fwrite(j, strlen(j), 1, f);
25+
26+ fprintf(f, "\n");
27 }
28
29 if (data) {
30@@ -1935,6 +1941,8 @@ void srv_archive_error(const char *prefix, const xs_str *err,
31
32 xs *j = xs_json_dumps_pp(data, 4);
33 fwrite(j, strlen(j), 1, f);
34+
35+ fprintf(f, "\n");
36 }
37
38 fclose(f);
M
http.c
+1,
-1
1@@ -96,7 +96,7 @@ xs_dict *http_signed_request_raw(const char *keyid, const char *seckey,
2 response = xs_http_request(method, url, hdrs,
3 body, b_size, status, payload, p_size, timeout);
4
5- srv_archive("SEND", hdrs, body, b_size, *status, response, *payload, *p_size);
6+ srv_archive("SEND", url, hdrs, body, b_size, *status, response, *payload, *p_size);
7
8 return response;
9 }
M
httpd.c
+1,
-1
1@@ -228,7 +228,7 @@ void httpd_connection(FILE *f)
2
3 fclose(f);
4
5- srv_archive("RECV", req, payload, p_size, status, headers, body, b_size);
6+ srv_archive("RECV", NULL, req, payload, p_size, status, headers, body, b_size);
7
8 xs_free(body);
9 }
M
snac.h
+1,
-1
1@@ -51,7 +51,7 @@ int validate_uid(const char *uid);
2 d_char *hash_password(const char *uid, const char *passwd, const char *nonce);
3 int check_password(const char *uid, const char *passwd, const char *hash);
4
5-void srv_archive(const char *direction, xs_dict *req,
6+void srv_archive(const char *direction, const char *url, xs_dict *req,
7 const char *payload, int p_size,
8 int status, xs_dict *headers,
9 const char *body, int b_size);