chibipub

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 3dd0ec81b9f72f86005f543ac8fe577bb3ad09a0
parent 6b26836b3665a7a0733dc8f35129cfef66464084
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 17 Jan 2021 09:48:01 -0800

rename to chibipub

Diffstat:
MREADME | 4++--
Msrc/ap_json.h | 6+++---
Msrc/cursor.h | 4++--
Msrc/errors.h | 6+++---
Msrc/http.h | 6+++---
Msrc/inbox.h | 4++--
Msrc/io.h | 6+++---
Msrc/json.h | 4++--
Msrc/parse.h | 6+++---
Msrc/sigcheck.c | 17+----------------
Msrc/sigcheck.h | 6+++---
Msrc/ubjson.h | 6+++---
Msrc/util.h | 4++--
Msrc/wolfsocks.c | 4++--
14 files changed, 34 insertions(+), 49 deletions(-)

diff --git a/README b/README @@ -1,6 +1,6 @@ -wolfsocks ---------- +chibipub +-------- experimental C11 activitypub server diff --git a/src/ap_json.h b/src/ap_json.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_APJSON -#define WOLFSOCKS_APJSON +#ifndef CHIBIPUB_APJSON +#define CHIBIPUB_APJSON #include "json.h" #include "http.h" @@ -20,4 +20,4 @@ struct ap_json { void init_ap_json(struct ap_json *, struct json_handlers *inner); void make_ap_json_pusher(struct json_handlers *h, struct ap_json *out); -#endif /* WOLFSOCKS_APJSON */ +#endif /* CHIBIPUB_APJSON */ diff --git a/src/cursor.h b/src/cursor.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_CURSOR_H -#define WOLFSOCKS_CURSOR_H +#ifndef CHIBIPUB_CURSOR_H +#define CHIBIPUB_CURSOR_H #include <stdio.h> #include <string.h> diff --git a/src/errors.h b/src/errors.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_ERRORS -#define WOLFSOCKS_ERRORS +#ifndef CHIBIPUB_ERRORS +#define CHIBIPUB_ERRORS #include <stdarg.h> @@ -33,4 +33,4 @@ static inline void note_error_(struct errors *errs, const char *fmt, ...) } -#endif /* WOLFSOCKS_ERRORS */ +#endif /* CHIBIPUB_ERRORS */ diff --git a/src/http.h b/src/http.h @@ -1,5 +1,5 @@ -#ifndef WOLFSOCKS_HTTP -#define WOLFSOCKS_HTTP +#ifndef CHIBIPUB_HTTP +#define CHIBIPUB_HTTP #include "cursor.h" #include "errors.h" @@ -40,4 +40,4 @@ int get_header(struct http_header *header, const char *match, const char **resul int parse_http_request(struct http_req *req, struct parser *p, int size); void print_http_request(struct http_req *req); -#endif /* WOLFSOCKS_HTTP */ +#endif /* CHIBIPUB_HTTP */ diff --git a/src/inbox.h b/src/inbox.h @@ -1,5 +1,5 @@ -#ifndef WOLFSOCKS_INBOX -#define WOLFSOCKS_INBOX +#ifndef CHIBIPUB_INBOX +#define CHIBIPUB_INBOX #include "cursor.h" #include "errors.h" diff --git a/src/io.h b/src/io.h @@ -1,9 +1,9 @@ -#ifndef WOLFSOCKS_IO -#define WOLFSOCKS_IO +#ifndef CHIBIPUB_IO +#define CHIBIPUB_IO #include <stddef.h> int map_file(const char *filename, unsigned char **p, size_t *flen); -#endif /* WOLFSOCKS_IO */ +#endif /* CHIBIPUB_IO */ diff --git a/src/json.h b/src/json.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_JSON -#define WOLFSOCKS_JSON +#ifndef CHIBIPUB_JSON +#define CHIBIPUB_JSON #include "cursor.h" #include "errors.h" diff --git a/src/parse.h b/src/parse.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_PARSE -#define WOLFSOCKS_PARSE +#ifndef CHIBIPUB_PARSE +#define CHIBIPUB_PARSE #include "cursor.h" @@ -44,4 +44,4 @@ static inline int consume_char(struct cursor *cur, char match) -#endif /* WOLFSOCKS_PARSE */ +#endif /* CHIBIPUB_PARSE */ diff --git a/src/sigcheck.c b/src/sigcheck.c @@ -69,31 +69,16 @@ static int verify_signature(struct cursor cur, struct cursor *arena) { struct ubjson ubjson; struct json val; - struct sig_header sig; - unsigned char *sigbuf; - int sigbuf_len; init_ubjson(&ubjson, cur.start, cur.p - cur.start); ubjson.data_end = cur.p; - static const char *path[] = {"@wsheaders", "signature"}; + static const char *path[] = {"@wssigbuf"}; if (!ubjson_lookup(&ubjson, path, 2, &val)) { note_error(&ubjson.errs, "Signature header not found"); return 0; } - if (!parse_signature_header(&ubjson.errs, arena, val.string, val.len, - &sig)) { - note_error(&ubjson.errs, "Failed to parse Signature header"); - return 0; - } - - if (!build_sigbuf(&sig, &ubjson, arena, &sigbuf, &sigbuf_len)) { - return 0; - } - - printf("sigbuf: %.*s\n", sigbuf_len, sigbuf); - return 1; } diff --git a/src/sigcheck.h b/src/sigcheck.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_SIGCHECK -#define WOLFSOCKS_SIGCHECK +#ifndef CHIBIPUB_SIGCHECK +#define CHIBIPUB_SIGCHECK struct sigcheck { @@ -9,4 +9,4 @@ struct sigcheck int sigcheck(struct sigcheck *check); -#endif /* WOLFSOCKS_SIGCHECK */ +#endif /* CHIBIPUB_SIGCHECK */ diff --git a/src/ubjson.h b/src/ubjson.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_UBJSON -#define WOLFSOCKS_UBJSON +#ifndef CHIBIPUB_UBJSON +#define CHIBIPUB_UBJSON #include "cursor.h" #include "errors.h" @@ -41,4 +41,4 @@ int parse_ubjson(unsigned char *buf, size_t buf_size, struct ubjson *out); int ubjson_lookup(struct ubjson *ubjson, const char **path, int path_len, struct json *val); void print_value(struct json *val); -#endif /* WOLFSOCKS_UBJSON */ +#endif /* CHIBIPUB_UBJSON */ diff --git a/src/util.h b/src/util.h @@ -1,6 +1,6 @@ -#ifndef WOLFSOCKS_UTIL -#define WOLFSOCKS_UTIL +#ifndef CHIBIPUB_UTIL +#define CHIBIPUB_UTIL #include <ctype.h> #include <string.h> diff --git a/src/wolfsocks.c b/src/wolfsocks.c @@ -38,7 +38,7 @@ static void error(char *msg) static inline const char *get_hostname() { - return getenv("WOLFSOCKS_HOST"); + return getenv("CHIBIPUB_HOST"); } @@ -463,7 +463,7 @@ void run_http_server() static void load_config() { if (!get_hostname()) { - printf("WOLFSOCKS_HOST env not set\n"); + printf("CHIBIPUB_HOST env not set\n"); exit(2); } }