diff options
| author | 2023-03-02 17:13:17 +0100 | |
|---|---|---|
| committer | 2023-03-02 17:13:17 +0100 | |
| commit | b2ce9323db88539860e0e71960ffdf22f33005e4 (patch) | |
| tree | 07bc53406d00f0a00fcc5f861b970db444ad08b0 | |
| parent | Log the user-agent when serving the actor. (diff) | |
| download | snac2-b2ce9323db88539860e0e71960ffdf22f33005e4.tar.gz snac2-b2ce9323db88539860e0e71960ffdf22f33005e4.tar.xz snac2-b2ce9323db88539860e0e71960ffdf22f33005e4.zip | |
Added the url to srv_archive().
| -rw-r--r-- | data.c | 10 | ||||
| -rw-r--r-- | http.c | 2 | ||||
| -rw-r--r-- | httpd.c | 2 | ||||
| -rw-r--r-- | snac.h | 2 |
4 files changed, 12 insertions, 4 deletions
| @@ -1818,7 +1818,7 @@ void purge_all(void) | |||
| 1818 | 1818 | ||
| 1819 | /** archive **/ | 1819 | /** archive **/ |
| 1820 | 1820 | ||
| 1821 | void srv_archive(const char *direction, xs_dict *req, | 1821 | void srv_archive(const char *direction, const char *url, xs_dict *req, |
| 1822 | const char *payload, int p_size, | 1822 | const char *payload, int p_size, |
| 1823 | int status, xs_dict *headers, | 1823 | int status, xs_dict *headers, |
| 1824 | const char *body, int b_size) | 1824 | const char *body, int b_size) |
| @@ -1837,6 +1837,10 @@ void srv_archive(const char *direction, xs_dict *req, | |||
| 1837 | xs *j2 = xs_json_dumps_pp(headers, 4); | 1837 | xs *j2 = xs_json_dumps_pp(headers, 4); |
| 1838 | 1838 | ||
| 1839 | fprintf(f, "dir: %s\n", direction); | 1839 | fprintf(f, "dir: %s\n", direction); |
| 1840 | |||
| 1841 | if (url) | ||
| 1842 | fprintf(f, "url: %s\n", url); | ||
| 1843 | |||
| 1840 | fprintf(f, "req: %s\n", j1); | 1844 | fprintf(f, "req: %s\n", j1); |
| 1841 | fprintf(f, "p_size: %d\n", p_size); | 1845 | fprintf(f, "p_size: %d\n", p_size); |
| 1842 | fprintf(f, "status: %d\n", status); | 1846 | fprintf(f, "status: %d\n", status); |
| @@ -1928,6 +1932,8 @@ void srv_archive_error(const char *prefix, const xs_str *err, | |||
| 1928 | 1932 | ||
| 1929 | xs *j = xs_json_dumps_pp(req, 4); | 1933 | xs *j = xs_json_dumps_pp(req, 4); |
| 1930 | fwrite(j, strlen(j), 1, f); | 1934 | fwrite(j, strlen(j), 1, f); |
| 1935 | |||
| 1936 | fprintf(f, "\n"); | ||
| 1931 | } | 1937 | } |
| 1932 | 1938 | ||
| 1933 | if (data) { | 1939 | if (data) { |
| @@ -1935,6 +1941,8 @@ void srv_archive_error(const char *prefix, const xs_str *err, | |||
| 1935 | 1941 | ||
| 1936 | xs *j = xs_json_dumps_pp(data, 4); | 1942 | xs *j = xs_json_dumps_pp(data, 4); |
| 1937 | fwrite(j, strlen(j), 1, f); | 1943 | fwrite(j, strlen(j), 1, f); |
| 1944 | |||
| 1945 | fprintf(f, "\n"); | ||
| 1938 | } | 1946 | } |
| 1939 | 1947 | ||
| 1940 | fclose(f); | 1948 | fclose(f); |
| @@ -96,7 +96,7 @@ xs_dict *http_signed_request_raw(const char *keyid, const char *seckey, | |||
| 96 | response = xs_http_request(method, url, hdrs, | 96 | response = xs_http_request(method, url, hdrs, |
| 97 | body, b_size, status, payload, p_size, timeout); | 97 | body, b_size, status, payload, p_size, timeout); |
| 98 | 98 | ||
| 99 | srv_archive("SEND", hdrs, body, b_size, *status, response, *payload, *p_size); | 99 | srv_archive("SEND", url, hdrs, body, b_size, *status, response, *payload, *p_size); |
| 100 | 100 | ||
| 101 | return response; | 101 | return response; |
| 102 | } | 102 | } |
| @@ -228,7 +228,7 @@ void httpd_connection(FILE *f) | |||
| 228 | 228 | ||
| 229 | fclose(f); | 229 | fclose(f); |
| 230 | 230 | ||
| 231 | srv_archive("RECV", req, payload, p_size, status, headers, body, b_size); | 231 | srv_archive("RECV", NULL, req, payload, p_size, status, headers, body, b_size); |
| 232 | 232 | ||
| 233 | xs_free(body); | 233 | xs_free(body); |
| 234 | } | 234 | } |
| @@ -51,7 +51,7 @@ int validate_uid(const char *uid); | |||
| 51 | d_char *hash_password(const char *uid, const char *passwd, const char *nonce); | 51 | d_char *hash_password(const char *uid, const char *passwd, const char *nonce); |
| 52 | int check_password(const char *uid, const char *passwd, const char *hash); | 52 | int check_password(const char *uid, const char *passwd, const char *hash); |
| 53 | 53 | ||
| 54 | void srv_archive(const char *direction, xs_dict *req, | 54 | void srv_archive(const char *direction, const char *url, xs_dict *req, |
| 55 | const char *payload, int p_size, | 55 | const char *payload, int p_size, |
| 56 | int status, xs_dict *headers, | 56 | int status, xs_dict *headers, |
| 57 | const char *body, int b_size); | 57 | const char *body, int b_size); |