mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-15 01:55:03 +00:00
Added the url to srv_archive().
This commit is contained in:
parent
8451d66601
commit
b2ce9323db
4 changed files with 12 additions and 4 deletions
10
data.c
10
data.c
|
@ -1818,7 +1818,7 @@ void purge_all(void)
|
||||||
|
|
||||||
/** archive **/
|
/** archive **/
|
||||||
|
|
||||||
void srv_archive(const char *direction, xs_dict *req,
|
void srv_archive(const char *direction, const char *url, xs_dict *req,
|
||||||
const char *payload, int p_size,
|
const char *payload, int p_size,
|
||||||
int status, xs_dict *headers,
|
int status, xs_dict *headers,
|
||||||
const char *body, int b_size)
|
const char *body, int b_size)
|
||||||
|
@ -1837,6 +1837,10 @@ void srv_archive(const char *direction, xs_dict *req,
|
||||||
xs *j2 = xs_json_dumps_pp(headers, 4);
|
xs *j2 = xs_json_dumps_pp(headers, 4);
|
||||||
|
|
||||||
fprintf(f, "dir: %s\n", direction);
|
fprintf(f, "dir: %s\n", direction);
|
||||||
|
|
||||||
|
if (url)
|
||||||
|
fprintf(f, "url: %s\n", url);
|
||||||
|
|
||||||
fprintf(f, "req: %s\n", j1);
|
fprintf(f, "req: %s\n", j1);
|
||||||
fprintf(f, "p_size: %d\n", p_size);
|
fprintf(f, "p_size: %d\n", p_size);
|
||||||
fprintf(f, "status: %d\n", status);
|
fprintf(f, "status: %d\n", status);
|
||||||
|
@ -1928,6 +1932,8 @@ void srv_archive_error(const char *prefix, const xs_str *err,
|
||||||
|
|
||||||
xs *j = xs_json_dumps_pp(req, 4);
|
xs *j = xs_json_dumps_pp(req, 4);
|
||||||
fwrite(j, strlen(j), 1, f);
|
fwrite(j, strlen(j), 1, f);
|
||||||
|
|
||||||
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -1935,6 +1941,8 @@ void srv_archive_error(const char *prefix, const xs_str *err,
|
||||||
|
|
||||||
xs *j = xs_json_dumps_pp(data, 4);
|
xs *j = xs_json_dumps_pp(data, 4);
|
||||||
fwrite(j, strlen(j), 1, f);
|
fwrite(j, strlen(j), 1, f);
|
||||||
|
|
||||||
|
fprintf(f, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
2
http.c
2
http.c
|
@ -96,7 +96,7 @@ xs_dict *http_signed_request_raw(const char *keyid, const char *seckey,
|
||||||
response = xs_http_request(method, url, hdrs,
|
response = xs_http_request(method, url, hdrs,
|
||||||
body, b_size, status, payload, p_size, timeout);
|
body, b_size, status, payload, p_size, timeout);
|
||||||
|
|
||||||
srv_archive("SEND", hdrs, body, b_size, *status, response, *payload, *p_size);
|
srv_archive("SEND", url, hdrs, body, b_size, *status, response, *payload, *p_size);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
2
httpd.c
2
httpd.c
|
@ -228,7 +228,7 @@ void httpd_connection(FILE *f)
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
srv_archive("RECV", req, payload, p_size, status, headers, body, b_size);
|
srv_archive("RECV", NULL, req, payload, p_size, status, headers, body, b_size);
|
||||||
|
|
||||||
xs_free(body);
|
xs_free(body);
|
||||||
}
|
}
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -51,7 +51,7 @@ int validate_uid(const char *uid);
|
||||||
d_char *hash_password(const char *uid, const char *passwd, const char *nonce);
|
d_char *hash_password(const char *uid, const char *passwd, const char *nonce);
|
||||||
int check_password(const char *uid, const char *passwd, const char *hash);
|
int check_password(const char *uid, const char *passwd, const char *hash);
|
||||||
|
|
||||||
void srv_archive(const char *direction, xs_dict *req,
|
void srv_archive(const char *direction, const char *url, xs_dict *req,
|
||||||
const char *payload, int p_size,
|
const char *payload, int p_size,
|
||||||
int status, xs_dict *headers,
|
int status, xs_dict *headers,
|
||||||
const char *body, int b_size);
|
const char *body, int b_size);
|
||||||
|
|
Loading…
Reference in a new issue